nvim-treesitter/queries/puppet/highlights.scm

239 lines
2.8 KiB
Scheme
Raw Normal View History

2023-04-26 07:32:41 -04:00
; Variables
(identifier) @variable
; Includes
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
"include" @keyword.import
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(include_statement
(identifier) @type)
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(include_statement
(class_identifier
(identifier) @type .))
2023-04-26 07:32:41 -04:00
; Keywords
[
"inherits"
"node"
"tag"
2024-02-18 10:03:44 -05:00
"require"
2023-04-26 07:32:41 -04:00
] @keyword
2024-04-23 12:23:15 -07:00
[
"type"
"class"
] @keyword.type
2023-04-26 07:32:41 -04:00
[
"define"
"function"
] @keyword.function
[
"if"
"elsif"
"else"
"unless"
2023-04-26 07:32:41 -04:00
"case"
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
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(default_case
"default" @keyword.conditional)
2023-04-26 07:32:41 -04:00
; Attributes
2024-01-06 15:05:50 +09:00
(attribute
name: (identifier) @attribute)
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(attribute
name: (variable
(identifier) @attribute))
2023-04-26 07:32:41 -04:00
; Parameters
2024-01-06 15:05:50 +09:00
(lambda
(variable
(identifier) @variable.parameter))
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(parameter
(variable
(identifier) @variable.parameter))
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(function_call
(identifier) @variable.parameter)
2023-04-26 07:32:41 -04:00
2024-02-18 10:03:44 -05:00
(iterator_statement
(variable) @variable.parameter)
2023-04-26 07:32:41 -04:00
; Functions
(function_declaration
2024-01-06 15:05:50 +09:00
"function"
.
(identifier) @function)
2023-04-26 07:32:41 -04:00
(function_call
2024-01-06 15:05:50 +09:00
(identifier) @function.call
"(")
2023-04-26 07:32:41 -04:00
(defined_resource_type
2024-01-06 15:05:50 +09:00
"define"
.
(identifier) @function)
2023-04-26 07:32:41 -04:00
; Methods
(function_declaration
2024-01-06 15:05:50 +09:00
"function"
.
(class_identifier
(identifier) @function.method .))
2023-04-26 07:32:41 -04:00
(function_call
2024-01-06 15:05:50 +09:00
(class_identifier
(identifier) @function.method.call .))
2023-04-26 07:32:41 -04:00
(defined_resource_type
2024-01-06 15:05:50 +09:00
"define"
.
(class_identifier
(identifier) @function.method .))
2023-04-26 07:32:41 -04:00
2024-02-18 10:03:44 -05:00
(function_call
(field_expression
"."
(identifier) @function.method.call)
"(")
2023-04-26 07:32:41 -04:00
; Types
(type) @type
(builtin_type) @type.builtin
(class_definition
(identifier) @type)
2024-01-06 15:05:50 +09:00
2023-04-26 07:32:41 -04:00
(class_definition
2024-01-06 15:05:50 +09:00
(class_identifier
(identifier) @type .))
(class_inherits
(identifier) @type)
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(class_inherits
(class_identifier
(identifier) @type .))
2023-04-26 07:32:41 -04:00
(resource_declaration
(identifier) @type)
2024-01-06 15:05:50 +09:00
2023-04-26 07:32:41 -04:00
(resource_declaration
2024-01-06 15:05:50 +09:00
(class_identifier
(identifier) @type .))
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(node_definition
(node_name
(identifier) @type))
2023-04-26 07:32:41 -04:00
((identifier) @type
(#lua-match? @type "^[A-Z]"))
((identifier) @type.builtin
(#any-of? @type.builtin
"Boolean" "Integer" "Float" "String" "Array" "Hash" "Regexp" "Variant" "Data" "Undef" "Default"
"File"))
2023-04-26 07:32:41 -04:00
; "Namespaces"
2024-01-06 15:05:50 +09:00
(class_identifier
.
(identifier) @module)
2023-04-26 07:32:41 -04:00
; Operators
[
"or"
"and"
"in"
] @keyword.operator
[
"="
"+="
"->"
"~>"
"<<|"
"<|"
"|>"
"|>>"
"?"
">"
">="
"<="
"<"
"=="
"!="
"<<"
">>"
"+"
"-"
"*"
"/"
"%"
"=~"
"!~"
] @operator
; Punctuation
[
"|"
"."
","
";"
":"
"::"
"=>"
] @punctuation.delimiter
2024-01-06 15:05:50 +09:00
[
"{"
"}"
] @punctuation.bracket
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
[
"["
"]"
] @punctuation.bracket
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
[
"("
")"
] @punctuation.bracket
2023-04-26 07:32:41 -04:00
2024-01-06 15:05:50 +09:00
(interpolation
[
"${"
"}"
] @punctuation.special)
2023-04-26 07:32:41 -04:00
[
"$"
"@"
"@@"
] @punctuation.special
; Literals
(number) @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
2023-04-26 07:32:41 -04:00
(string) @string
(escape_sequence) @string.escape
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
(regex) @string.regexp
2023-04-26 07:32:41 -04:00
(boolean) @boolean
[
(undef)
(default)
] @variable.builtin
; Comments
(comment) @comment @spell