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

197 lines
4.2 KiB
Scheme
Raw Normal View History

; Most primitive nodes
(shebang) @keyword.directive
(comment) @comment @spell
2020-08-16 20:11:56 -04:00
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
(nil)
(nil_binding)
] @constant.builtin
2024-01-06 15:05:50 +09:00
[
(boolean)
(boolean_binding)
] @boolean
2024-01-06 15:05:50 +09:00
[
(number)
(number_binding)
] @number
2020-08-16 20:11:56 -04:00
[
(string)
(string_binding)
] @string
2024-01-06 15:05:50 +09:00
[
(symbol)
(symbol_binding)
] @variable
(symbol_option) @keyword.directive
2020-08-16 20:11:56 -04:00
(escape_sequence) @string.escape
2020-08-16 20:11:56 -04:00
(multi_symbol
2024-01-06 15:05:50 +09:00
"." @punctuation.delimiter
member: (symbol_fragment) @variable.member)
2024-01-06 15:05:50 +09:00
(list
call: (symbol) @function.call)
2024-01-06 15:05:50 +09:00
(list
call: (multi_symbol
member: (symbol_fragment) @function.call .))
2024-01-06 15:05:50 +09:00
(multi_symbol_method
":" @punctuation.delimiter
method: (symbol_fragment) @function.method.call)
(quasi_quote_reader_macro
macro: _ @punctuation.special)
(quote_reader_macro
macro: _ @punctuation.special)
(unquote_reader_macro
macro: _ @punctuation.special)
(hashfn_reader_macro
macro: _ @keyword.function)
(sequence_arguments
(symbol_binding) @variable.parameter)
(sequence_arguments
(rest_binding
rhs: (symbol_binding) @variable.parameter))
(docstring) @string.documentation
(fn_form
name: [
(symbol) @function
(multi_symbol
member: (symbol_fragment) @function .)
])
(lambda_form
name: [
(symbol) @function
(multi_symbol
member: (symbol_fragment) @function .)
])
; NOTE: The macro name is highlighted as @variable because it
; gives a nicer contrast instead of everything being the same
; color. Rust queries use this workaround too for `macro_rules!`.
(macro_form
name: [
(symbol) @variable
(multi_symbol
member: (symbol_fragment) @variable .)
])
((symbol) @variable.parameter
(#lua-match? @variable.parameter "^%$[1-9]?$"))
((symbol_fragment) @variable.parameter
(#lua-match? @variable.parameter "^%$[1-9]?$"))
((symbol) @variable.parameter
(#eq? @variable.parameter "$..."))
((symbol) @operator
(#any-of? @operator
; arithmetic
"+" "-" "*" "/" "//" "%" "^"
; comparison
">" "<" ">=" "<=" "=" "~="
; other
"#" "." "?." ".."))
((symbol) @keyword.operator
(#any-of? @keyword.operator
; comparison
"not="
; boolean
"and" "or" "not"
; bitwise
"lshift" "rshift" "band" "bor" "bxor" "bnot"
; other
"length"))
(case_guard
call: (_) @keyword.conditional)
(case_guard_or_special
call: (_) @keyword.conditional)
((symbol) @keyword.function
(#any-of? @keyword.function "fn" "lambda" "λ" "hashfn"))
2024-01-06 15:05:50 +09: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
((symbol) @keyword.repeat
(#any-of? @keyword.repeat "for" "each" "while"))
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
((symbol) @keyword.conditional
(#any-of? @keyword.conditional "if" "when" "match" "case" "match-try" "case-try"))
2024-01-06 15:05:50 +09:00
((symbol) @keyword
(#any-of? @keyword
"global" "local" "let" "set" "var" "comment" "do" "doc" "eval-compiler" "lua" "macros" "unquote"
"quote" "tset" "values" "tail!"))
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
((symbol) @keyword.import
(#any-of? @keyword.import "require-macros" "import-macros" "include"))
((symbol) @function.macro
(#any-of? @function.macro
"collect" "icollect" "fcollect" "accumulate" "faccumulate" "->" "->>" "-?>" "-?>>" "?." "doto"
"macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open"))
(case_catch
call: (symbol) @keyword)
(import_macros_form
imports: (table_binding
(table_binding_pair
value: (symbol_binding) @function.macro)))
; TODO: Highlight builtin methods (`table.unpack`, etc) as @function.builtin
([
(symbol) @module.builtin
(multi_symbol
base: (symbol_fragment) @module.builtin)
]
(#any-of? @module.builtin
"vim" "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
([
(symbol) @variable.builtin
(multi_symbol
.
(symbol_fragment) @variable.builtin)
]
(#eq? @variable.builtin "arg"))
((symbol) @variable.builtin
(#eq? @variable.builtin "..."))
((symbol) @constant.builtin
(#eq? @constant.builtin "_VERSION"))
2020-08-16 20:11:56 -04:00
((symbol) @function.builtin
(#any-of? @function.builtin
"assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next"
"pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable"
"tonumber" "tostring" "type" "warn" "xpcall" "module" "setfenv" "loadstring" "unpack"))