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

317 lines
4.5 KiB
Scheme
Raw Normal View History

2023-03-06 04:46:43 -05:00
; Keywords
[
"clone"
"delete"
"extends"
"rawcall"
"resume"
"var"
] @keyword
2024-04-23 12:23:15 -07:00
[
"class"
"enum"
] @keyword.type
2024-01-06 15:05:50 +09:00
"function" @keyword.function
2023-03-06 04:46:43 -05:00
[
"in"
"instanceof"
"typeof"
] @keyword.operator
[
"return"
"yield"
] @keyword.return
((global_variable
2024-01-06 15:05:50 +09:00
"::"
(_) @keyword.coroutine)
2023-03-06 04:46:43 -05:00
(#any-of? @keyword.coroutine "suspend" "newthread"))
; Conditionals
[
"if"
"else"
"switch"
"case"
"default"
"break"
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-03-06 04:46:43 -05:00
; Repeats
[
"for"
"foreach"
"do"
"while"
"continue"
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
2023-03-06 04:46:43 -05:00
; Exceptions
[
"try"
"catch"
"throw"
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.exception
2023-03-06 04:46:43 -05:00
; Storageclasses
"local" @keyword.modifier
2023-03-06 04:46:43 -05:00
; Qualifiers
[
"static"
"const"
] @keyword.modifier
2023-03-06 04:46:43 -05:00
; Variables
[
(identifier)
(global_variable)
] @variable
2023-03-06 04:46:43 -05:00
(local_declaration
(identifier) @variable
2024-01-06 15:05:50 +09:00
.
"=")
2023-03-06 04:46:43 -05:00
((identifier) @variable.builtin
(#any-of? @variable.builtin "base" "this" "vargv"))
; Parameters
(parameter
2024-01-06 15:05:50 +09:00
.
(identifier) @variable.parameter)
2023-03-06 04:46:43 -05:00
; Properties (Slots)
(deref_expression
"."
2024-01-06 15:05:50 +09:00
.
(identifier) @variable.member)
2023-03-06 04:46:43 -05:00
(member_declaration
(identifier) @variable.member
2024-01-06 15:05:50 +09:00
.
"=")
2023-03-06 04:46:43 -05:00
((table_slot
2024-01-06 15:05:50 +09:00
.
(identifier) @variable.member
2024-01-06 15:05:50 +09:00
.
[
"="
":"
])
(#set! priority 105))
2023-03-06 04:46:43 -05:00
; Types
((identifier) @type
2024-01-06 15:05:50 +09:00
(#lua-match? @type "^[A-Z]"))
2023-03-06 04:46:43 -05:00
(class_declaration
(identifier) @type
2024-01-06 15:05:50 +09:00
"extends"?
.
(identifier)? @type)
2023-03-06 04:46:43 -05:00
(enum_declaration
(identifier) @type)
; Attributes
(attribute_declaration
left: (identifier) @attribute)
; Functions & Methods
(member_declaration
(function_declaration
2024-01-06 15:05:50 +09:00
"::"?
(_) @function.method
.
"("
(_)?
")"))
2023-03-06 04:46:43 -05:00
((function_declaration
2024-01-06 15:05:50 +09:00
"::"?
(_) @function
.
"("
(_)?
")")
2023-03-06 04:46:43 -05:00
(#not-has-ancestor? @function member_declaration))
(call_expression
function: (identifier) @function.call)
(call_expression
function: (deref_expression
"."
.
(identifier) @function.call))
2023-03-06 04:46:43 -05:00
(call_expression
(global_variable
"::"
(_) @function.call))
(_
(identifier) @function
"="
(lambda_expression
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
"@" @string.special.symbol))
2023-03-06 04:46:43 -05:00
2024-01-06 15:05:50 +09:00
(call_expression
2023-03-06 04:46:43 -05:00
[
2024-01-06 15:05:50 +09:00
function: (identifier) @function.builtin
function: (global_variable
"::"
(_) @function.builtin)
function: (deref_expression
"."
(_) @function.builtin)
2023-03-06 04:46:43 -05:00
]
(#any-of? @function.builtin
; General Methods
"assert" "array" "callee" "collectgarbage" "compilestring" "enabledebughook" "enabledebuginfo"
"error" "getconsttable" "getroottable" "print" "resurrectunreachable" "setconsttable"
"setdebughook" "seterrorhandler" "setroottable" "type"
; Hidden Methods
"_charsize_" "_intsize_" "_floatsize_" "_version_" "_versionnumber_"
; Number Methods
"tofloat" "tostring" "tointeger" "tochar"
; String Methods
"len" "slice" "find" "tolower" "toupper"
; Table Methods
"rawget" "rawset" "rawdelete" "rawin" "clear" "setdelegate" "getdelegate" "filter" "keys"
"values"
; Array Methods
"append" "push" "extend" "pop" "top" "insert" "remove" "resize" "sort" "reverse" "map" "apply"
"reduce"
; Function Methods
"call" "pcall" "acall" "pacall" "setroot" "getroot" "bindenv" "getinfos"
; Class Methods
"instance" "getattributes" "setattributes" "newmember" "rawnewmember"
; Class Instance Methods
"getclass"
; Generator Methods
"getstatus"
; Thread Methods
"call" "wakeup" "wakeupthrow" "getstackinfos"
; Weak Reference Methods
"ref" "weakref"))
2023-03-06 04:46:43 -05:00
(member_declaration
"constructor" @constructor)
; Constants
(const_declaration
"const"
2024-01-06 15:05:50 +09:00
.
(identifier) @constant)
2023-03-06 04:46:43 -05:00
(enum_declaration
"{"
2024-01-06 15:05:50 +09:00
.
(identifier) @constant)
2023-03-06 04:46:43 -05:00
((identifier) @constant
2024-01-06 15:05:50 +09:00
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
2023-03-06 04:46:43 -05:00
; Operators
[
"+"
"-"
"*"
"/"
"%"
"||"
"&&"
"|"
"^"
"&"
"=="
"!="
"<=>"
">"
">="
"<="
"<"
"<<"
">>"
">>>"
"="
"<-"
"+="
"-="
"*="
"/="
"%="
"~"
"!"
"++"
"--"
] @operator
; Punctuation
2024-01-06 15:05:50 +09:00
[
"{"
"}"
] @punctuation.bracket
2023-03-06 04:46:43 -05:00
2024-01-06 15:05:50 +09:00
[
"["
"]"
] @punctuation.bracket
2023-03-06 04:46:43 -05:00
2024-01-06 15:05:50 +09:00
[
"("
")"
] @punctuation.bracket
2023-03-06 04:46:43 -05:00
2024-01-06 15:05:50 +09:00
[
"</"
"/>"
] @punctuation.bracket
2023-03-06 04:46:43 -05:00
[
"."
","
";"
":"
] @punctuation.delimiter
[
"::"
"..."
] @punctuation.special
; Ternaries
(ternary_expression
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.ternary
":" @keyword.conditional.ternary)
2023-03-06 04:46:43 -05:00
; Literals
(string) @string
(verbatim_string) @string.special
(char) @character
(escape_sequence) @string.escape
(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
2023-03-06 04:46:43 -05:00
(bool) @boolean
(null) @constant.builtin
; Comments
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))