nvim-treesitter/queries/r/highlights.scm

163 lines
1.8 KiB
Scheme
Raw Normal View History

2021-03-09 21:06:07 +02:00
; highlights.scm
; Literals
(integer) @number
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
(float) @number.float
2021-03-09 21:06:07 +02:00
(complex) @number
(string) @string
2024-01-06 15:05:50 +09:00
(string
(escape_sequence) @string.escape)
2021-03-09 21:06:07 +02:00
2022-10-06 10:13:03 +02:00
(comment) @comment @spell
2021-03-09 21:06:07 +02:00
2024-01-06 15:05:50 +09:00
((program
.
(comment) @keyword.directive @nospell)
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
(#lua-match? @keyword.directive "^#!/"))
2021-03-09 21:06:07 +02:00
(identifier) @variable
2024-01-06 15:05:50 +09:00
((dollar
(identifier) @variable.builtin)
(#eq? @variable.builtin "self"))
2022-10-29 22:53:01 -03:00
2024-01-21 22:05:44 +09:00
(dollar
2024-01-06 15:05:50 +09:00
_
2024-01-21 22:05:44 +09:00
(identifier) @variable.member)
2022-10-29 22:53:01 -03:00
; Parameters
2024-01-06 15:05:50 +09:00
(formal_parameters
(identifier) @variable.parameter)
2022-10-29 22:53:01 -03:00
2022-03-28 17:13:48 -03:00
(formal_parameters
2024-01-06 15:05:50 +09:00
(default_parameter
name: (identifier) @variable.parameter))
2022-03-28 17:13:48 -03:00
2024-01-06 15:05:50 +09:00
(default_argument
name: (identifier) @variable.parameter)
2022-10-29 22:53:01 -03:00
; Namespace
2024-01-06 15:05:50 +09:00
(namespace_get
namespace: (identifier) @module)
2022-10-29 22:53:01 -03:00
2024-01-06 15:05:50 +09:00
(namespace_get_internal
namespace: (identifier) @module)
2022-10-29 22:53:01 -03:00
2021-03-09 21:06:07 +02:00
; Operators
[
2024-01-06 15:05:50 +09:00
"="
"<-"
"<<-"
"->"
2021-03-09 21:06:07 +02:00
] @operator
2024-01-06 15:05:50 +09:00
(unary
operator: [
"-"
"+"
"!"
"~"
"?"
] @operator)
2024-01-06 15:05:50 +09:00
(binary
operator: [
"-"
"+"
"*"
"/"
"^"
"<"
">"
"<="
">="
"=="
"!="
"||"
"|"
"&&"
"&"
":"
"~"
] @operator)
2021-03-09 21:06:07 +02:00
[
"|>"
(special)
] @operator
2021-03-09 21:06:07 +02:00
2024-01-06 15:05:50 +09:00
(lambda_function
"\\" @operator)
2021-03-09 21:06:07 +02:00
[
2024-01-06 15:05:50 +09:00
"("
")"
"["
"]"
"{"
"}"
2021-03-09 21:06:07 +02:00
] @punctuation.bracket
2024-04-16 17:09:09 -07:00
"," @punctuation.delimiter
2024-01-06 15:05:50 +09:00
(dollar
_
"$" @operator)
2021-11-15 21:24:32 -03:00
(subset2
"[[" @punctuation.bracket
"]]" @punctuation.bracket)
2021-03-09 21:06:07 +02:00
[
2024-01-06 15:05:50 +09:00
(dots)
(break)
(next)
2021-03-09 21:06:07 +02:00
] @keyword
2021-07-05 15:04:42 -05:00
2021-11-15 21:24:32 -03:00
[
(nan)
(na)
(null)
2022-10-29 23:09:50 -03:00
(inf)
2022-10-29 22:53:01 -03:00
] @constant.builtin
2021-11-15 21:24:32 -03:00
[
"if"
"else"
"switch"
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-11-15 21:24:32 -03:00
[
"while"
"repeat"
"for"
2022-11-29 14:07:39 -03: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-11-15 21:24:32 -03:00
[
(true)
(false)
] @boolean
2021-07-05 15:04:42 -05:00
"function" @keyword.function
2021-11-15 21:24:32 -03:00
2023-03-29 23:47:49 +02:00
; Functions/Methods
2024-01-06 15:05:50 +09:00
(call
function: (identifier) @function.call)
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
2024-01-06 15:05:50 +09:00
(namespace_get
function: (identifier) @function.call))
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
2024-01-06 15:05:50 +09:00
(namespace_get_internal
function: (identifier) @function.call))
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
function: (dollar
_
(identifier) @function.method.call))