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

219 lines
2.7 KiB
Scheme
Raw Normal View History

2023-06-12 10:15:41 +02:00
; 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
((command_name) @keyword.import
(#eq? @keyword.import "import"))
2023-02-28 00:16:21 -05:00
; Keywords
[
2023-06-12 10:15:41 +02:00
"arguments"
"end"
"events"
"global"
"methods"
"persistent"
"properties"
] @keyword
2023-02-28 00:16:21 -05:00
2024-04-23 12:23:15 -07:00
"enumeration" @keyword.type
(class_definition
[
"classdef"
"end"
] @keyword.type)
2023-02-28 00:16:21 -05:00
; Conditionals
2024-01-06 15:05:50 +09:00
(if_statement
[
"if"
"end"
] @keyword.conditional)
(elseif_clause
"elseif" @keyword.conditional)
(else_clause
"else" @keyword.conditional)
(switch_statement
[
"switch"
"end"
] @keyword.conditional)
(case_clause
"case" @keyword.conditional)
(otherwise_clause
"otherwise" @keyword.conditional)
2023-02-28 00:16:21 -05:00
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
(break_statement) @keyword.conditional
2023-02-28 00:16:21 -05:00
; Repeats
2024-01-06 15:05:50 +09:00
(for_statement
[
"for"
"parfor"
"end"
] @keyword.repeat)
(while_statement
[
"while"
"end"
] @keyword.repeat)
2023-02-28 00:16:21 -05:00
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
(continue_statement) @keyword.repeat
2023-02-28 00:16:21 -05:00
; Exceptions
2024-01-06 15:05:50 +09:00
(try_statement
[
"try"
"end"
] @keyword.exception)
2023-02-28 00:16:21 -05:00
2024-01-06 15:05:50 +09:00
(catch_clause
"catch" @keyword.exception)
2023-02-28 00:16:21 -05:00
2023-06-12 10:15:41 +02:00
; Variables
(identifier) @variable
2023-02-28 00:16:21 -05:00
2023-06-12 10:15:41 +02:00
; Constants
2024-01-06 15:05:50 +09:00
(events
(identifier) @constant)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(attribute
(identifier) @constant)
2023-06-12 10:15:41 +02:00
"~" @constant.builtin
; Fields/Properties
2024-01-06 15:05:50 +09:00
(field_expression
field: (identifier) @variable.member)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(superclass
"."
(identifier) @variable.member)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(property_name
"."
(identifier) @variable.member)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(property
name: (identifier) @variable.member)
2023-06-12 10:15:41 +02:00
; Types
2024-01-06 15:05:50 +09:00
(class_definition
name: (identifier) @type)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(attributes
(identifier) @constant)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(enum
.
(identifier) @type)
2023-06-12 10:15:41 +02:00
((identifier) @type
(#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$"))
; Functions
(function_definition
"function" @keyword.function
name: (identifier) @function
2024-01-06 15:05:50 +09:00
[
"end"
"endfunction"
]? @keyword.function)
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
(function_signature
name: (identifier) @function)
2023-06-12 10:15:41 +02:00
(function_call
name: (identifier) @function.call)
2023-02-28 00:16:21 -05:00
2024-01-06 15:05:50 +09:00
(handle_operator
(identifier) @function)
2023-02-28 00:16:21 -05:00
2024-01-06 15:05:50 +09:00
(validation_functions
(identifier) @function)
2024-01-06 15:05:50 +09:00
(command
(command_name) @function.call)
2023-02-28 00:16:21 -05:00
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
(command_argument) @variable.parameter
2023-06-12 10:15:41 +02:00
(return_statement) @keyword.return
; Parameters
2024-01-06 15:05:50 +09:00
(function_arguments
(identifier) @variable.parameter)
2023-06-12 10:15:41 +02:00
; Punctuation
2024-01-06 15:05:50 +09:00
[
";"
","
"."
] @punctuation.delimiter
2023-06-12 10:15:41 +02:00
2024-01-06 15:05:50 +09:00
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
2023-02-28 00:16:21 -05:00
; Operators
2023-06-12 10:15:41 +02:00
[
"+"
".+"
"-"
".*"
2023-02-28 00:16:21 -05:00
"*"
"/"
"./"
2023-06-12 10:15:41 +02:00
"\\"
".\\"
2023-02-28 00:16:21 -05:00
"^"
".^"
2023-06-12 10:15:41 +02:00
"'"
".'"
"|"
"&"
"?"
"@"
"<"
"<="
">"
">="
"=="
"~="
2023-02-28 00:16:21 -05:00
"="
"&&"
"||"
2023-06-12 10:15:41 +02:00
":"
2023-02-28 00:16:21 -05:00
] @operator
; Literals
(string) @string
2023-06-12 10:15:41 +02:00
(escape_sequence) @string.escape
2024-01-06 15:05:50 +09:00
2023-06-12 10:15:41 +02:00
(formatting_sequence) @string.special
(number) @number
((identifier) @boolean
(#eq? @boolean "true"))
((identifier) @boolean
(#eq? @boolean "false"))
2023-02-28 00:16:21 -05:00
; Comments
(comment) @comment @spell
(line_continuation) @punctuation.special
((comment) @keyword.directive
(#lua-match? @keyword.directive "^%%%% "))