Commit graph

37 commits

Author SHA1 Message Date
Riley Bruins
e9321bb914
feat(nix): misc cleanups + comment injection (#6418)
* fix(nix): highlight strings within interpolations

* feat(nix): move `derivation` to function.builtin

* fix(nix): removes all `priority` workarounds

* feat(nix): arbitrary injections using `#` comments
2024-04-09 14:20:26 +09:00
Riley Bruins
0bfa0be5e4 fix(nix): highlight ellipsis as builtin parameter
This maintains consistency with a lot of other languages that also have
ellipses as parameter types, which we typically highlight as
`@variable.parameter.builtin`
2024-04-01 11:39:38 +02:00
Riley Bruins
3c996dc9fa feat(nix): misc. operator/punctuation highlights 2024-04-01 11:39:38 +02:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
再生花
31641d72a4
feat(format-scripts): linewrap predicates
"format-ignore".kick()
2024-02-23 10:42:01 +02:00
Phạm Huy Hoàng
d198a75e2c
Fixup format (#5934)
* fix(format): newline between top-level field defs

* fixup: newline between node and comment

* fixup: optimize pattern
2024-01-20 18:47:56 +09:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Pham Huy Hoang
edee83272e refactor: manual pre-cleanup
Moving comments, adding `format-ignore` to lines that will be better
with it
2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Christian Clason
5b90ea2aba feat(locals)!: switch to upstream captures 2024-01-19 16:58:37 +01:00
Marc Jakobi
783e5fc307
feat(nix): some highlight improvements
- functions
- builtin functions with prefix
- add test file
2023-10-12 19:04:55 +00:00
figsoda
811e8ba4f3 injections(nix): dynamic language injection via comments 2023-10-01 18:36:24 +02:00
Jaehwang Jung
9567185621 feat: @spell on comments 2023-09-12 17:34:58 +02:00
Pham Huy Hoang
78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02:00
Stephen Huan
e1ab5391e5
feat(nix): highlight hpath_expressions as @string.special 2023-07-06 03:07:07 -04:00
figsoda
332fd5338f injections(nix): remove @combined 2023-01-11 21:27:02 +01:00
figsoda
121044f0b7 fix(nix): reduce injection false positives 2023-01-11 21:27:02 +01:00
figsoda
06989a933e injections(nix): combine injections to work better with interpolations 2022-12-23 13:08:05 +01:00
figsoda
668dec2903 highlights(nix): improve builtins and exceptions highlights 2022-12-23 13:08:05 +01:00
figsoda
90edaba46a highlights(nix): add all builtins 2022-12-23 13:08:05 +01:00
figsoda
df67a47a7e highlights(nix): improve highlights 2022-12-23 13:08:05 +01:00
figsoda
a851cef248 injections(nix): fix runCommand* 2022-12-23 13:08:05 +01:00
figsoda
ace038e1e7 injections(nix): add injections for builtins.match 2022-11-24 00:13:12 +01:00
figsoda
07674600c9 injections(nix): add injections for code blocks
based on https://github.com/cstrahan/tree-sitter-nix/pull/31
2022-11-24 00:13:12 +01:00
figsoda
770066ba01 highlights(nix): highlight parameters 2022-11-24 00:13:12 +01:00
Minijackson
29b0ea8093 fix(nix): update parser and queries 2022-05-24 01:06:15 +02:00
Santos Gallegos
67f0857015 Revert "Comment: use @combined to create just one tree per buffer (#1252)"
This reverts commit 4a7a713c52.
2021-05-07 16:51:57 +02:00
Santos Gallegos
4a7a713c52
Comment: use @combined to create just one tree per buffer (#1252)
* Comment: use `@combined` to create just one tree per buffer

There is no need to create a tree per line/block for comments.
Should fix https://github.com/nvim-treesitter/nvim-treesitter/issues/1251

* Add injections for scss

* Fix jsonc

* Combine jsdoc
2021-04-28 07:19:07 -05:00
Santos Gallegos
e4083fc8e1
Add comment parser to highlight comment tags (#893)
Closes #236
2021-03-12 11:21:46 -05:00
Stephan Seitz
2e3422df8e highlights(nix): fix for alias name of identifier in attrpath 2021-02-12 08:22:34 +01:00
leo60228
e45ab15cf3 Nix escape sequences 2020-11-22 22:29:55 +01:00
leo60228
30acaf5b77 null 2020-11-22 22:29:55 +01:00
leo60228
a0e14a5672 Fix unary - precedence 2020-11-22 22:29:55 +01:00
leo60228
5a25817884 Correct or comment 2020-11-22 22:29:55 +01:00
leo60228
c172b34f84 indented_str -> indented_string 2020-11-22 22:29:55 +01:00
leo60228
4f1dd5c151 Add fields to Nix highlighting 2020-11-22 22:29:55 +01:00
leo60228
ee0e8e8518 Initial Nix queries 2020-11-22 22:29:55 +01:00