nvim: kcl treesitter goodies
This commit is contained in:
parent
2d102dadc5
commit
db9624783a
2 changed files with 183 additions and 0 deletions
14
dot_config/nvim/after/queries/kcl/indents.scm
Normal file
14
dot_config/nvim/after/queries/kcl/indents.scm
Normal file
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
(config_expr)
|
||||
(list_expr)
|
||||
(config_entry)
|
||||
(schema_stmt)
|
||||
(assign_stmt)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent.branch
|
||||
|
169
dot_config/nvim/queries/kcl/highlights.scm
Normal file
169
dot_config/nvim/queries/kcl/highlights.scm
Normal file
|
@ -0,0 +1,169 @@
|
|||
(identifier) @variable
|
||||
|
||||
( config_entry (identifier) @field (_))
|
||||
( config_entry (selector_expr (identifier)) @field (_))
|
||||
|
||||
; Reset highlighting in string interpolations
|
||||
(interpolation) @none
|
||||
|
||||
(import_stmt
|
||||
(dotted_name
|
||||
(identifier) @namespace))
|
||||
|
||||
(import_stmt
|
||||
(dotted_name
|
||||
(identifier) @namespace)
|
||||
(identifier) @namespace)
|
||||
|
||||
(basic_type) @type
|
||||
|
||||
(schema_type
|
||||
(dotted_name
|
||||
(identifier) @type))
|
||||
|
||||
(schema_type
|
||||
(dotted_name
|
||||
(identifier) @namespace
|
||||
(identifier) @type))
|
||||
|
||||
(schema_expr
|
||||
(identifier) @type)
|
||||
|
||||
(protocol_stmt
|
||||
(identifier) @type)
|
||||
|
||||
(rule_stmt
|
||||
(identifier) @type)
|
||||
|
||||
(schema_stmt
|
||||
(identifier) @type)
|
||||
|
||||
(lambda_expr
|
||||
(typed_parameter (identifier) @parameter))
|
||||
|
||||
(lambda_expr
|
||||
(identifier) @parameter)
|
||||
|
||||
(selector_expr
|
||||
(select_suffix
|
||||
(identifier) @property))
|
||||
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(schema_stmt
|
||||
body: (block
|
||||
.
|
||||
(string
|
||||
(string_content) @string.documentation)))
|
||||
|
||||
(decorator
|
||||
(identifier) @attribute)
|
||||
|
||||
(call_expr
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expr
|
||||
function: (selector_expr
|
||||
(select_suffix
|
||||
(identifier) @function)))
|
||||
|
||||
[
|
||||
(integer)
|
||||
(float)
|
||||
] @number
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(none)
|
||||
(undefined)
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
"all"
|
||||
"any"
|
||||
"assert"
|
||||
"as"
|
||||
"check"
|
||||
"elif"
|
||||
"else"
|
||||
"filter"
|
||||
"for"
|
||||
"if"
|
||||
"import"
|
||||
"lambda"
|
||||
"map"
|
||||
"mixin"
|
||||
"protocol"
|
||||
"rule"
|
||||
"schema"
|
||||
"type"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"**"
|
||||
"/"
|
||||
"//"
|
||||
"%"
|
||||
"<<"
|
||||
">>"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"<"
|
||||
">"
|
||||
"~"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"@"
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"in"
|
||||
"is"
|
||||
"="
|
||||
":"
|
||||
] @operator
|
||||
|
||||
; second argument is a regex in all regex functions with at least two arguments
|
||||
(call_expr
|
||||
function: (selector_expr
|
||||
(identifier) @_regex)
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_regex "regex"))
|
||||
|
||||
; first argument is a regex in 'regex.compile' function
|
||||
(call_expr
|
||||
.
|
||||
function: (selector_expr
|
||||
(identifier) @_regex
|
||||
(select_suffix
|
||||
(identifier) @_fn (#eq? @_fn "compile")))
|
||||
arguments: (argument_list
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_regex "regex"))
|
Loading…
Add table
Reference in a new issue