mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 08:20:05 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
310f0925ec
commit
692b051b09
1247 changed files with 6096 additions and 9074 deletions
175
runtime/queries/roc/highlights.scm
Normal file
175
runtime/queries/roc/highlights.scm
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
;---Most generic types---
|
||||
(module) @module
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(concrete_type) @type
|
||||
|
||||
;---annotations----
|
||||
(annotation_type_def
|
||||
(annotation_pre_colon
|
||||
(identifier) @type))
|
||||
|
||||
(annotation_type_def
|
||||
(annotation_pre_colon
|
||||
(identifier) @function)
|
||||
(function_type))
|
||||
|
||||
;----decleration types----
|
||||
(value_declaration
|
||||
(decl_left
|
||||
(identifier_pattern
|
||||
(identifier) @variable.parameter)))
|
||||
|
||||
;---records----
|
||||
(field_name) @variable.member
|
||||
|
||||
(record_field_pattern
|
||||
(_
|
||||
(identifier) @variable))
|
||||
|
||||
;matches the second identifier and all subsequent ones
|
||||
(field_access_expr
|
||||
(identifier) @variable.member)
|
||||
|
||||
;highlight module members as records instead of free variables
|
||||
; avoids highlighting them as out-of-scope vars
|
||||
(variable_expr
|
||||
(module)
|
||||
(identifier) @variable.member)
|
||||
|
||||
;----comments----
|
||||
(line_comment) @comment @spell
|
||||
|
||||
(doc_comment) @comment.documentation @spell
|
||||
|
||||
;-----Punctuation----
|
||||
[
|
||||
"?"
|
||||
(arrow)
|
||||
(fat_arrow)
|
||||
"|"
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"|"
|
||||
"&"
|
||||
"<-"
|
||||
".."
|
||||
(operator)
|
||||
] @operator
|
||||
|
||||
(wildcard_pattern) @character.special
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
(implements)
|
||||
(when)
|
||||
(is)
|
||||
(as)
|
||||
"as"
|
||||
(to)
|
||||
] @keyword
|
||||
|
||||
;----headers-----
|
||||
[
|
||||
"app"
|
||||
"expect"
|
||||
"module"
|
||||
"package"
|
||||
] @keyword
|
||||
|
||||
"import" @keyword.import
|
||||
|
||||
(value_declaration
|
||||
(decl_left
|
||||
(identifier_pattern
|
||||
(identifier) @function))
|
||||
(expr_body
|
||||
(anon_fun_expr)))
|
||||
|
||||
;----tags----
|
||||
(tags_type
|
||||
(tag_type) @constructor)
|
||||
|
||||
[
|
||||
(tag)
|
||||
(opaque_tag)
|
||||
] @constructor
|
||||
|
||||
;-----builtins----
|
||||
(variable_expr
|
||||
(module) @module
|
||||
(identifier) @boolean
|
||||
(#any-of? @boolean "true" "false")
|
||||
(#eq? @module "Bool"))
|
||||
|
||||
"dbg" @keyword.debug
|
||||
|
||||
;----function invocations ----
|
||||
(function_call_pnc_expr
|
||||
caller: (variable_expr
|
||||
(identifier) @function.call))
|
||||
|
||||
(function_call_pnc_expr
|
||||
caller: (field_access_expr
|
||||
(identifier) @function.call .))
|
||||
|
||||
(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))))
|
||||
|
||||
;-----consts-----
|
||||
[
|
||||
(int)
|
||||
(uint)
|
||||
(iint)
|
||||
(xint)
|
||||
(natural)
|
||||
] @number
|
||||
|
||||
[
|
||||
(decimal)
|
||||
(float)
|
||||
] @number.float
|
||||
|
||||
[
|
||||
(string)
|
||||
(multiline_string)
|
||||
] @string
|
||||
|
||||
(char) @character
|
||||
60
runtime/queries/roc/indents.scm
Normal file
60
runtime/queries/roc/indents.scm
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
; (value_declaration(expr_body(anon_fun_expr)))@indent.ignore
|
||||
[
|
||||
(when_is_expr)
|
||||
(when_is_branch)
|
||||
(record_expr)
|
||||
(anon_fun_expr)
|
||||
(list_expr)
|
||||
(parenthesized_expr)
|
||||
(function_call_pnc_expr)
|
||||
(tuple_expr)
|
||||
"import"
|
||||
(exposes)
|
||||
(exposes_list)
|
||||
(exposing)
|
||||
;patterns
|
||||
(record_pattern)
|
||||
(tuple_pattern)
|
||||
(list_pattern)
|
||||
;ability stuff
|
||||
(ability_implementation)
|
||||
(opaque_type_def)
|
||||
;types
|
||||
(record_type)
|
||||
(tags_type)
|
||||
(record_expr)
|
||||
(implements_implementation)
|
||||
"{"
|
||||
"("
|
||||
"["
|
||||
] @indent.begin
|
||||
|
||||
; ((record_type)
|
||||
; @indent.align
|
||||
; (#set! indent.open_delimiter "{")
|
||||
; (#set! indent.close_delimiter "}"))
|
||||
; ((record_expr)
|
||||
; @indent.align
|
||||
; (#set! indent.open_delimiter "{")
|
||||
; (#set! indent.close_delimiter "}"))
|
||||
; ((tags_type) @indent.align
|
||||
; (#set! indent.open_delimiter "[")
|
||||
; (#set! indent.close_delimiter "]"))
|
||||
; ((implements_implementation) @indent.align
|
||||
; (#set! indent.open_delimiter "[")
|
||||
; (#set! indent.close_delimiter "]"))
|
||||
(expr_body) @indent.begin
|
||||
|
||||
(ERROR
|
||||
"=") @indent.begin
|
||||
|
||||
(then) @indent.begin
|
||||
|
||||
(else) @indent.begin
|
||||
|
||||
[
|
||||
; result:(_)
|
||||
"]"
|
||||
"}"
|
||||
")"
|
||||
] @indent.branch
|
||||
30
runtime/queries/roc/injections.scm
Normal file
30
runtime/queries/roc/injections.scm
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
;injection from function calls
|
||||
(function_call_pnc_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"))
|
||||
49
runtime/queries/roc/locals.scm
Normal file
49
runtime/queries/roc/locals.scm
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
(expr_body) @local.scope
|
||||
|
||||
(argument_patterns
|
||||
(identifier_pattern
|
||||
(identifier) @local.definition))
|
||||
|
||||
; (argument_patterns(long_identifier)@local.definition)
|
||||
(exposes_list
|
||||
(ident) @local.reference)
|
||||
|
||||
(import_expr
|
||||
(as)
|
||||
(module) @local.definition)
|
||||
|
||||
(opaque_type_def
|
||||
(apply_type
|
||||
(concrete_type) @local.definition.type))
|
||||
|
||||
(alias_type_def
|
||||
(apply_type
|
||||
(concrete_type) @local.definition.type))
|
||||
|
||||
(value_declaration
|
||||
(decl_left
|
||||
(identifier_pattern
|
||||
(identifier) @local.definition.function))
|
||||
(expr_body
|
||||
(anon_fun_expr)))
|
||||
|
||||
(value_declaration
|
||||
(decl_left
|
||||
(identifier_pattern
|
||||
(identifier) @local.definition.var)))
|
||||
|
||||
(identifier_pattern
|
||||
(identifier) @local.definition)
|
||||
|
||||
(when_is_branch
|
||||
pattern: (_
|
||||
(identifier_pattern
|
||||
(identifier) @local.definition)))
|
||||
|
||||
(spread_pattern
|
||||
(identifier) @local.definition)
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
(tag_expr
|
||||
(tag)) @local.reference
|
||||
Loading…
Add table
Add a link
Reference in a new issue