2021-06-28 19:11:33 +02:00
|
|
|
; highlights.scm
|
|
|
|
|
[
|
|
|
|
|
"!"
|
2025-05-13 14:31:03 +02:00
|
|
|
"*"
|
2021-06-28 19:11:33 +02:00
|
|
|
"/"
|
|
|
|
|
"%"
|
2025-05-13 14:31:03 +02:00
|
|
|
"+"
|
2021-06-28 19:11:33 +02:00
|
|
|
"-"
|
|
|
|
|
">"
|
|
|
|
|
">="
|
|
|
|
|
"<"
|
|
|
|
|
"<="
|
|
|
|
|
"=="
|
|
|
|
|
"!="
|
|
|
|
|
"&&"
|
|
|
|
|
"||"
|
|
|
|
|
] @operator
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"("
|
|
|
|
|
")"
|
2021-06-28 20:05:27 +02:00
|
|
|
] @punctuation.bracket
|
2021-06-28 19:11:33 +02:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"."
|
2021-06-28 20:05:27 +02:00
|
|
|
".*"
|
2021-06-28 19:11:33 +02:00
|
|
|
","
|
2021-06-28 20:05:27 +02:00
|
|
|
"[*]"
|
|
|
|
|
] @punctuation.delimiter
|
2021-06-28 19:11:33 +02:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
(ellipsis)
|
2025-05-13 14:31:03 +02:00
|
|
|
"?"
|
2021-06-28 19:11:33 +02:00
|
|
|
"=>"
|
2021-06-28 20:05:27 +02:00
|
|
|
] @punctuation.special
|
2021-06-28 19:11:33 +02:00
|
|
|
|
2021-06-30 23:39:24 +02:00
|
|
|
[
|
|
|
|
|
":"
|
|
|
|
|
"="
|
|
|
|
|
] @none
|
|
|
|
|
|
2021-06-28 19:11:33 +02:00
|
|
|
[
|
|
|
|
|
"for"
|
2021-09-20 21:58:20 +02:00
|
|
|
"endfor"
|
2021-06-28 19:11:33 +02:00
|
|
|
"in"
|
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"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/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`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.repeat
|
2021-06-28 19:11:33 +02:00
|
|
|
|
2023-01-25 14:04:07 -05:00
|
|
|
[
|
2021-06-28 19:11:33 +02:00
|
|
|
"if"
|
2021-09-20 21:58:20 +02:00
|
|
|
"else"
|
|
|
|
|
"endif"
|
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"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/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`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.conditional
|
2021-06-28 19:11:33 +02:00
|
|
|
|
|
|
|
|
[
|
2021-07-02 08:40:08 +02:00
|
|
|
(quoted_template_start) ; "
|
2024-01-05 03:19:54 +09:00
|
|
|
(quoted_template_end) ; "
|
2021-07-02 08:40:08 +02:00
|
|
|
(template_literal) ; non-interpolation/directive content
|
2021-06-28 19:11:33 +02:00
|
|
|
] @string
|
|
|
|
|
|
2021-06-30 23:39:24 +02:00
|
|
|
[
|
2022-04-24 23:16:35 +02:00
|
|
|
(heredoc_identifier) ; END
|
|
|
|
|
(heredoc_start) ; << or <<-
|
2021-07-01 20:00:43 +02:00
|
|
|
] @punctuation.delimiter
|
2021-06-30 23:39:24 +02:00
|
|
|
|
2021-09-20 21:58:20 +02:00
|
|
|
[
|
|
|
|
|
(template_interpolation_start) ; ${
|
|
|
|
|
(template_interpolation_end) ; }
|
|
|
|
|
(template_directive_start) ; %{
|
|
|
|
|
(template_directive_end) ; }
|
|
|
|
|
(strip_marker) ; ~
|
|
|
|
|
] @punctuation.special
|
2021-06-28 20:05:27 +02:00
|
|
|
|
2021-06-28 19:11:33 +02:00
|
|
|
(numeric_lit) @number
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2021-06-28 19:11:33 +02:00
|
|
|
(bool_lit) @boolean
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2021-06-28 19:11:33 +02:00
|
|
|
(null_lit) @constant
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-11-20 16:32:52 +11:00
|
|
|
(comment) @comment @spell
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2021-07-01 08:43:42 +02:00
|
|
|
(identifier) @variable
|
2021-06-28 19:11:33 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(body
|
|
|
|
|
(block
|
|
|
|
|
(identifier) @keyword))
|
|
|
|
|
|
|
|
|
|
(body
|
|
|
|
|
(block
|
|
|
|
|
(body
|
|
|
|
|
(block
|
|
|
|
|
(identifier) @type))))
|
|
|
|
|
|
|
|
|
|
(function_call
|
|
|
|
|
(identifier) @function)
|
|
|
|
|
|
|
|
|
|
(attribute
|
|
|
|
|
(identifier) @variable.member)
|
2021-06-28 19:11:33 +02:00
|
|
|
|
2021-07-02 08:40:08 +02:00
|
|
|
; { key: val }
|
|
|
|
|
;
|
|
|
|
|
; highlight identifier keys as though they were block attributes
|
2024-01-06 15:05:50 +09:00
|
|
|
(object_elem
|
2024-03-21 20:44:35 +09:00
|
|
|
key: (expression
|
|
|
|
|
(variable_expr
|
|
|
|
|
(identifier) @variable.member)))
|
2021-07-02 08:40:08 +02:00
|
|
|
|
2022-12-02 23:47:19 +01:00
|
|
|
; var.foo, data.bar
|
|
|
|
|
;
|
2023-01-25 14:38:41 -05:00
|
|
|
; first element in get_attr is a variable.builtin or a reference to a variable.builtin
|
2024-01-06 15:05:50 +09:00
|
|
|
(expression
|
|
|
|
|
(variable_expr
|
|
|
|
|
(identifier) @variable.builtin)
|
|
|
|
|
(get_attr
|
|
|
|
|
(identifier) @variable.member))
|