nvim-treesitter/runtime/queries/elm/highlights.scm

230 lines
3.7 KiB
Scheme
Raw Permalink Normal View History

2023-01-01 03:22:36 +07:00
[
(line_comment)
(block_comment)
] @comment @spell
((block_comment) @comment.documentation
(#lua-match? @comment.documentation "^{[-]|[^|]"))
2023-01-01 03:22:36 +07:00
2021-11-04 20:47:26 +01:00
; Keywords
2023-01-01 03:22:36 +07:00
;---------
2021-11-04 20:47:26 +01:00
[
2023-01-01 03:22:36 +07:00
"if"
"then"
"else"
(case)
(of)
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-04 20:47:26 +01:00
[
2021-11-28 00:30:48 +01:00
"let"
"in"
2021-11-04 20:47:26 +01:00
(as)
(port)
(alias)
(infix)
(module)
2023-01-01 03:22:36 +07:00
(type)
2021-11-04 20:47:26 +01:00
] @keyword
2023-01-01 03:22:36 +07:00
[
(import)
(exposing)
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.import
2023-01-01 03:22:36 +07:00
; Punctuation
;------------
2024-01-06 15:05:50 +09:00
(double_dot) @punctuation.special
2023-01-01 03:22:36 +07:00
2021-11-04 20:47:26 +01:00
[
","
2023-01-01 03:22:36 +07:00
"|"
2021-11-04 20:47:26 +01:00
(dot)
] @punctuation.delimiter
[
"("
")"
"{"
"}"
2023-01-01 03:22:36 +07:00
"["
"]"
2021-11-04 20:47:26 +01:00
] @punctuation.bracket
2023-01-01 03:22:36 +07:00
; Variables
;----------
(value_qid
(lower_case_identifier) @variable)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(value_declaration
2024-01-06 15:05:50 +09:00
(function_declaration_left
(lower_case_identifier) @variable))
(type_annotation
2023-01-01 03:22:36 +07:00
(lower_case_identifier) @variable)
2024-01-06 15:05:50 +09:00
(port_annotation
2023-01-01 03:22:36 +07:00
(lower_case_identifier) @variable)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(anything_pattern
(underscore) @character.special)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(record_base_identifier
(lower_case_identifier) @variable)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(lower_pattern
(lower_case_identifier) @variable)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(exposed_value
(lower_case_identifier) @variable)
(value_qid
2024-01-06 15:05:50 +09:00
((dot)
(lower_case_identifier) @variable.member))
2023-01-01 03:22:36 +07:00
(field_access_expr
2024-01-06 15:05:50 +09:00
((dot)
(lower_case_identifier) @variable.member))
2023-01-01 03:22:36 +07:00
(function_declaration_left
2024-01-06 15:05:50 +09:00
(anything_pattern
(underscore) @character.special))
2023-01-01 03:22:36 +07:00
2024-01-06 15:05:50 +09:00
(function_declaration_left
(lower_pattern
(lower_case_identifier) @variable.parameter))
2023-01-01 03:22:36 +07:00
; Functions
;----------
(value_declaration
functionDeclarationLeft: (function_declaration_left
(lower_case_identifier) @function
(pattern)))
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(value_declaration
functionDeclarationLeft: (function_declaration_left
(lower_case_identifier) @function
pattern: (_)))
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(value_declaration
functionDeclarationLeft: (function_declaration_left
(lower_case_identifier) @function)
2023-01-01 03:22:36 +07:00
body: (anonymous_function_expr))
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(type_annotation
name: (lower_case_identifier) @function
typeExpression: (type_expression
(arrow)))
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(port_annotation
name: (lower_case_identifier) @function
typeExpression: (type_expression
(arrow)))
2021-11-04 20:47:26 +01:00
2023-01-01 03:22:36 +07:00
(function_call_expr
target: (value_expr
(value_qid
(lower_case_identifier) @function.call)))
2021-11-04 20:47:26 +01:00
2023-01-01 03:22:36 +07:00
; Operators
;----------
2021-11-04 20:47:26 +01:00
[
(operator_identifier)
(eq)
(colon)
(arrow)
2023-01-01 03:22:36 +07:00
(backslash)
"::"
2021-11-04 20:47:26 +01:00
] @operator
2023-01-01 03:22:36 +07:00
; Modules
;--------
(module_declaration
2024-01-06 15:05:50 +09:00
(upper_case_qid
(upper_case_identifier) @module))
2023-01-01 03:22:36 +07:00
(import_clause
2024-01-06 15:05:50 +09:00
(upper_case_qid
(upper_case_identifier) @module))
2023-01-01 03:22:36 +07:00
(as_clause
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
(upper_case_identifier) @module)
2023-01-01 03:22:36 +07:00
2024-01-06 15:05:50 +09:00
(value_expr
(value_qid
(upper_case_identifier) @module))
2023-01-01 03:22:36 +07:00
; Types
;------
(type_declaration
2023-01-01 03:22:36 +07:00
(upper_case_identifier) @type)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(type_ref
2024-01-06 15:05:50 +09:00
(upper_case_qid
(upper_case_identifier) @type))
2023-01-01 03:22:36 +07:00
(type_variable
(lower_case_identifier) @type)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(lower_type_name
(lower_case_identifier) @type)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(exposed_type
(upper_case_identifier) @type)
(type_alias_declaration
2023-01-01 03:22:36 +07:00
(upper_case_identifier) @type.definition)
(field_type
name: (lower_case_identifier) @property)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(field
name: (lower_case_identifier) @property)
2021-11-04 20:47:26 +01:00
2023-01-01 03:22:36 +07:00
(type_declaration
2024-01-06 15:05:50 +09:00
(union_variant
(upper_case_identifier) @constructor))
(nullary_constructor_argument_pattern
2024-01-06 15:05:50 +09:00
(upper_case_qid
(upper_case_identifier) @constructor))
2023-01-01 03:22:36 +07:00
(union_pattern
2024-01-06 15:05:50 +09:00
(upper_case_qid
(upper_case_identifier) @constructor))
2023-01-01 03:22:36 +07:00
2024-01-06 15:05:50 +09:00
(value_expr
(upper_case_qid
(upper_case_identifier)) @constructor)
2021-11-04 20:47:26 +01:00
2023-01-01 03:22:36 +07:00
; Literals
;---------
(number_constant_expr
(number_literal) @number)
(upper_case_qid
2024-01-06 15:05:50 +09:00
((upper_case_identifier) @boolean
(#any-of? @boolean "True" "False")))
2023-01-01 03:22:36 +07:00
[
(open_quote)
(close_quote)
] @string
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(string_constant_expr
(string_escape) @string)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(string_constant_expr
(regular_string_part) @string)
2021-11-04 20:47:26 +01:00
[
(open_char)
(close_char)
] @character
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(char_constant_expr
(string_escape) @character)
2024-01-06 15:05:50 +09:00
2023-01-01 03:22:36 +07:00
(char_constant_expr
(regular_string_part) @character)