1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,220 @@
;;----comments----
[
(line_comment)
(doc_comment) @comment.block.documentation
] @comment
;;----typedefs-----
;; opinion: typedefs cross into documentation and should be
;; highlighted differently from normal code
(opaque_type_def (_ (concrete_type) @type.definition))
(function_type (arrow) @punctuation.delimiter.structural.typedef)
(parenthesized_type ["(" ")"] @punctuation.bracket.typedef)
(tuple_type ["(" ")"] @punctuation.bracket.typedef)
(record_type ["{" "}"] @punctuation.bracket.typedef)
(tags_type ["[" "]"] @punctuation.bracket.typedef)
(function_type "," @punctuation.delimiter.typedef)
(tuple_type "," @punctuation.delimiter.typedef)
(record_type "," @punctuation.delimiter.typedef)
(record_field_type ":" @punctuation.delimiter.typedef)
(record_field_type (field_name) @variable.other.enum.typedef)
(ability_chain "&" @operator.typedef)
(where_implements _
(where) @type.keyword
(identifier) @type.parameter
(implements) @type.keyword
(ability_chain) @type.parameter)
((concrete_type) @type.builtin
(#match? @type.builtin "^(Bool|Str|Num|List|Result|Dict|Set|Dec)"))
((concrete_type) @type.builtin
(#match? @type.builtin "^[IU](8|16|32|64|128)"))
((concrete_type) @type.builtin
(#match? @type.builtin "^F(32|64)"))
(bound_variable) @type.parameter
(tags_type (apply_type(concrete_type) @type.enum.variant))
(concrete_type) @type
;;-----Punctuation----
[
"?"
(arrow)
(back_arrow)
(backslash)
] @punctuation.delimiter.structural
(bang_expr "!" @punctuation.delimiter.structural)
[
","
":"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
(interpolation_char)
] @punctuation.bracket
[
"|"
"&"
"<-"
".."
(operator)
(wildcard_pattern)
] @operator
[
"if"
"then"
"else"
] @keyword.control.conditional
[
(implements)
(when)
(is)
"as"
(to)
] @keyword.control.roc
;----headers-----
[
"app"
"expect"
"module"
"package"
"import"
] @keyword.control
;---annotations----
(annotation_type_def
(annotation_pre_colon
(identifier)@function )
(function_type))
(annotation_type_def
(annotation_pre_colon
(identifier)@parameter.definition ))
;----decleration types----
(value_declaration(decl_left
(identifier_pattern
(identifier)@function.definition))(expr_body(anon_fun_expr)))
(value_declaration(decl_left
(identifier_pattern
(identifier) @parameter.definition)))
(backpassing_expr assignee: (identifier_pattern (identifier) @parameter.definition))
;----tags----
(tag)@constructor
(opaque_tag)@constructor
;-----builtins----
(variable_expr
(module)@module
(identifier)@constant.builtin.boolean
(#eq? @constant.builtin.boolean "true" )
(#eq? @module "Bool" )
)
(variable_expr
(module)@module
(identifier)@constant.builtin.boolean
(#eq? @constant.builtin.boolean "false" )
(#eq? @module "Bool" )
)
[
"dbg"
] @constant.builtin
;----function invocations ----
(function_call_expr
caller: (variable_expr
(identifier)@function))
(function_call_expr
caller: (field_access_expr (identifier)@function .))
(bin_op_expr (operator "|>")@operator(variable_expr(identifier)@function))
;----function arguments----
(argument_patterns(identifier_pattern
(identifier)@variable.parameter))
(argument_patterns(_(identifier_pattern(identifier)@variable.parameter)))
(argument_patterns(_(_(identifier_pattern(identifier)@variable.parameter))))
(argument_patterns(_(_(_(identifier_pattern(identifier)@variable.parameter)))))
(argument_patterns(_(_(_(_(identifier_pattern(identifier)@variable.parameter))))))
(argument_patterns(_(_(_(_(_(identifier_pattern(identifier)@variable.parameter)))))))
; pattern captures
(when_is_branch pattern: (_ (identifier_pattern (identifier) @variable.parameter)))
(range_pattern (identifier) @variable.parameter)
;;----records----
(field_name)@variable.other.member
(record_field_pattern (_(identifier) @variable))
;matches the second identifier and all subsequent ones
(field_access_expr (identifier) @variable.other.member)
;highlight module members as records instead of free variables
; avoids highlighting them as out-of-scope vars
(variable_expr (module) (identifier) @variable.other.member)
;-----consts-----
[
(int)
(uint)
(iint)
(xint)
(natural)
] @constant.numeric.integer
[
(decimal)
(float)
] @constant.numeric.float
(string)@string
(multiline_string)@string
(char) @constant.character
(escape_char)@constant.character.escape
;---keep most generic types at bottom for helix---
;; #any-of? not working in the tree-sitter for helix 23.10
((module) @namespace.builtin (#eq? @namespace.builtin "Bool"))
((module) @namespace.builtin (#eq? @namespace.builtin "Str"))
((module) @namespace.builtin (#eq? @namespace.builtin "Num"))
((module) @namespace.builtin (#eq? @namespace.builtin "List"))
((module) @namespace.builtin (#eq? @namespace.builtin "Result"))
((module) @namespace.builtin (#eq? @namespace.builtin "Dict"))
((module) @namespace.builtin (#eq? @namespace.builtin "Set"))
(module)@namespace
(module)@module
(identifier)@variable

View File

@ -0,0 +1,127 @@
; ;;How to write indents:
; ;;think about the structures that should have indents inside and mark them with indent and extend
; ;;think about the structures that indicate the end of an indent and mark them with extend.prevent-once
; ;;find partially complete structures and create speciall rules for them.
; ;;eg: (ERROR (is))
; [
; (value_declaration)
; (then)
; (else)
; (when_is_expr)
; (when_is_branch)
; (record_field_expr)
; ;(function_call_expr)
; ; (function_type)
; (annotation_type_def)
; ; (parenthesized_type)
; (interface_header)
; (expect)
; ] @indent
; [
; (value_declaration)
; (then)
; (else)
; (when_is_expr)
; (when_is_branch)
; (record_field_expr)
; ;(function_call_expr)
; ; (function_type)
; (annotation_type_def)
; (interface_header)
; (expect)
; ; (record_expr)
; ] @extend
; [
; (exposes)
; (imports)
; (provides)
; (requires)
; ]@indent
; (ERROR "expect")@indent @extend
; [
; "["
; "{"
; "("]@indent @extend
; ["}"
; "]"
; ")"]@outdent
; [
; (record_expr)
; (list_expr)
; (tuple_expr)
; (record_pattern)
; (list_pattern)
; (tuple_pattern)
; (tuple_type)
; (parenthesized_type)
; (parenthesized_expr)
; (paren_pattern)
; ]@indent
; ;;starting a when is expression
; (ERROR (is)@indent @extend)
; ;;starting a record_field
; (ERROR ":"@indent @extend)
; ;starting a type annotation
; (ERROR "(")@indent @extend
; ;starting a variable declaration
; (ERROR "=")@indent @extend
; ;;It's annoying when pipelines automatically dedent this pervents that
; (expr_body
; result: (bin_op_expr)
; )@extend
; ;this automatically dedents, this may be more annying than helpful when writing pipelines
; (expr_body
; result: (_)
; ) @extend.prevent-once
; ;;If we maybe don't want all expressions causing dedents
; ; (value_declaration
; ; (expr_body
; ; result: (_)
; ; ) @extend.prevent-once
; ; )
; ; (then
; ; (expr_body
; ; result: (_)
; ; ) @extend.prevent-once
; ; )
; ; (else
; ; (expr_body
; ; result: (_)
; ; ) @extend.prevent-once
; ; )
; ; (when_is_branch
; ; (expr_body
; ; result: (_)
; ; )@extend.prevent-once
; ; )
; ; (expect
; ; (expr_body
; ; result: (_)
; ; )@extend.prevent-once
; ; )
; ; (record_field_expr
; ; (expr_body
; ; result: (_)
; ; ) @extend.prevent-once
; ; )
; ; (record_field_expr
; ; (expr_body
; ; result: (_)
; ; ) @extend.prevent-once
; ; )

View File

@ -0,0 +1,57 @@
;injection from function calls
(function_call_expr
(variable_expr (identifier) @injection.language)
(const [(multiline_string) (string)] @injection.content)
(#any-of? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
;injection from piping function calls
(bin_op_expr
part: (const
[(multiline_string) (string)] @injection.content
)
part: (operator)
part: (variable_expr
(identifier) @injection.language
)
(#any-of? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
(
[
(line_comment)
(doc_comment)
] @injection.content
(#set! injection.language "comment")
)

View File

@ -0,0 +1,30 @@
(expr_body) @local.scope
(value_declaration(decl_left
(identifier_pattern
(identifier)@local.definition)))
;;This would make parameters that are functions not get highlighted as functions but as parameters.. not sure if that's something we ever want
; (argument_patterns(identifier_pattern
; (identifier)@local.definition))
(argument_patterns(identifier_pattern
(identifier)@local.definition))
(argument_patterns(_(identifier_pattern(identifier)@local.definition)))
(argument_patterns(_(_(identifier_pattern(identifier)@local.definition))))
(argument_patterns(_(_(_(identifier_pattern(identifier)@local.definition)))))
(argument_patterns(_(_(_(_(identifier_pattern(identifier)@local.definition))))))
(argument_patterns(_(_(_(_(_(identifier_pattern(identifier)@local.definition)))))))
(exposes_list(ident)@local.reference)
(import_expr(as)(module)@local.definition)
(opaque_type_def(apply_type(concrete_type)@local.definition))
(alias_type_def(apply_type(concrete_type)@local.definition))
(when_is_branch pattern: (_ (identifier_pattern (identifier) @local.definition)))
(range_pattern (identifier) @local.definition)
(identifier)@local.reference
(tag_expr(tag))@local.reference

View File

@ -0,0 +1,13 @@
; Function calls
(function_call_expr
caller: (variable_expr
(identifier)@name ))@reference.call
(function_call_expr
caller: (field_access_expr (identifier)@name .))@reference.call
; Function definitions
(value_declaration(decl_left
(identifier_pattern
(identifier)@name))(expr_body(anon_fun_expr)))@definition.function

View File

@ -0,0 +1,39 @@
(anon_fun_expr
(expr_body) @function.inside
) @function.around
(argument_patterns
((_) @parameter.inside . ","? @parameter.around) @parameter.around
)
(function_type
((_) @parameter.inside . ","? @parameter.around) @parameter.around(#not-eq? @parameter.inside "->")
)
(function_call_expr
.
(_)
(parenthesized_expr (expr_body) @parameter.inside) @parameter.around
)
(function_call_expr
.
(_) ((_) @parameter.inside) @parameter.around
)
[
(annotation_type_def ) @class.inside
(alias_type_def ) @class.inside
(opaque_type_def ) @class.inside
] @class.around
(apply_type_arg) @parameter.inside
(expect
(expr_body) @test.inside
) @test.around
(line_comment) @comment.around
(doc_comment) @comment.around