1

Regenerate nvim config

This commit is contained in:
2024-06-02 03:29:20 +02:00
parent 75eea0c030
commit ef2e28883d
5576 changed files with 604886 additions and 503 deletions

View File

@ -0,0 +1,24 @@
[
(arguments)
(for_in_statement)
(for_statement)
(while_statement)
(arrow_function)
(function_expression)
(function_declaration)
(class_declaration)
(method_definition)
(do_statement)
(with_statement)
(switch_statement)
(switch_case)
(switch_default)
(import_statement)+
(if_statement)
(try_statement)
(catch_clause)
(array)
(object)
(generator_function)
(generator_function_declaration)
] @fold

View File

@ -0,0 +1,376 @@
; Types
; Javascript
; Variables
;-----------
(identifier) @variable
; Properties
;-----------
(property_identifier) @variable.member
(shorthand_property_identifier) @variable.member
(private_property_identifier) @variable.member
(object_pattern
(shorthand_property_identifier_pattern) @variable)
(object_pattern
(object_assignment_pattern
(shorthand_property_identifier_pattern) @variable))
; Special identifiers
;--------------------
((identifier) @type
(#lua-match? @type "^[A-Z]"))
((identifier) @constant
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
((shorthand_property_identifier) @constant
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
((identifier) @variable.builtin
(#any-of? @variable.builtin "arguments" "module" "console" "window" "document"))
((identifier) @type.builtin
(#any-of? @type.builtin
"Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set"
"WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array"
"Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView"
"Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError"
"URIError"))
(statement_identifier) @label
(glimmer_opening_tag) @tag.builtin
(glimmer_closing_tag) @tag.builtin
; Function and method definitions
;--------------------------------
(function_expression
name: (identifier) @function)
(function_declaration
name: (identifier) @function)
(generator_function
name: (identifier) @function)
(generator_function_declaration
name: (identifier) @function)
(method_definition
name: [
(property_identifier)
(private_property_identifier)
] @function.method)
(method_definition
name: (property_identifier) @constructor
(#eq? @constructor "constructor"))
(pair
key: (property_identifier) @function.method
value: (function_expression))
(pair
key: (property_identifier) @function.method
value: (arrow_function))
(assignment_expression
left: (member_expression
property: (property_identifier) @function.method)
right: (arrow_function))
(assignment_expression
left: (member_expression
property: (property_identifier) @function.method)
right: (function_expression))
(variable_declarator
name: (identifier) @function
value: (arrow_function))
(variable_declarator
name: (identifier) @function
value: (function_expression))
(assignment_expression
left: (identifier) @function
right: (arrow_function))
(assignment_expression
left: (identifier) @function
right: (function_expression))
; Function and method calls
;--------------------------
(call_expression
function: (identifier) @function.call)
(call_expression
function: (member_expression
property: [
(property_identifier)
(private_property_identifier)
] @function.method.call))
; Builtins
;---------
((identifier) @module.builtin
(#eq? @module.builtin "Intl"))
((identifier) @function.builtin
(#any-of? @function.builtin
"eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI"
"encodeURIComponent" "require"))
; Constructor
;------------
(new_expression
constructor: (identifier) @constructor)
; Variables
;----------
(namespace_import
(identifier) @module)
; Decorators
;----------
(decorator
"@" @attribute
(identifier) @attribute)
(decorator
"@" @attribute
(call_expression
(identifier) @attribute))
(decorator
"@" @attribute
(member_expression
(property_identifier) @attribute))
(decorator
"@" @attribute
(call_expression
(member_expression
(property_identifier) @attribute)))
; Literals
;---------
[
(this)
(super)
] @variable.builtin
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
[
(true)
(false)
] @boolean
[
(null)
(undefined)
] @constant.builtin
[
(comment)
(html_comment)
] @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
(hash_bang_line) @keyword.directive
((string_fragment) @keyword.directive
(#eq? @keyword.directive "use strict"))
(string) @string
(template_string) @string
(escape_sequence) @string.escape
(regex_pattern) @string.regexp
(regex_flags) @character.special
(regex
"/" @punctuation.bracket) ; Regex delimiters
(number) @number
((identifier) @number
(#any-of? @number "NaN" "Infinity"))
; Punctuation
;------------
[
";"
"."
","
":"
] @punctuation.delimiter
[
"--"
"-"
"-="
"&&"
"+"
"++"
"+="
"&="
"/="
"**="
"<<="
"<"
"<="
"<<"
"="
"=="
"==="
"!="
"!=="
"=>"
">"
">="
">>"
"||"
"%"
"%="
"*"
"**"
">>>"
"&"
"|"
"^"
"??"
"*="
">>="
">>>="
"^="
"|="
"&&="
"||="
"??="
"..."
] @operator
(binary_expression
"/" @operator)
(ternary_expression
[
"?"
":"
] @keyword.conditional.ternary)
(unary_expression
[
"!"
"~"
"-"
"+"
] @operator)
(unary_expression
[
"delete"
"void"
] @keyword.operator)
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(template_substitution
[
"${"
"}"
] @punctuation.special) @none
; Keywords
;----------
[
"if"
"else"
"switch"
"case"
] @keyword.conditional
[
"import"
"from"
"as"
"export"
] @keyword.import
[
"for"
"of"
"do"
"while"
"continue"
] @keyword.repeat
[
"break"
"const"
"debugger"
"extends"
"get"
"let"
"set"
"static"
"target"
"var"
"with"
] @keyword
"class" @keyword.type
[
"async"
"await"
] @keyword.coroutine
[
"return"
"yield"
] @keyword.return
"function" @keyword.function
[
"new"
"delete"
"in"
"instanceof"
"typeof"
] @keyword.operator
[
"throw"
"try"
"catch"
"finally"
] @keyword.exception
(export_statement
"default" @keyword)
(switch_default
"default" @keyword.conditional)

View File

@ -0,0 +1,77 @@
[
(arguments)
(array)
(binary_expression)
(class_body)
(export_clause)
(formal_parameters)
(named_imports)
(object)
(object_pattern)
(parenthesized_expression)
(return_statement)
(statement_block)
(switch_case)
(switch_default)
(switch_statement)
(template_substitution)
(ternary_expression)
] @indent.begin
(arguments
(call_expression) @indent.begin)
(binary_expression
(call_expression) @indent.begin)
(expression_statement
(call_expression) @indent.begin)
(arrow_function
body: (_) @_body
(#not-has-type? @_body statement_block)) @indent.begin
(assignment_expression
right: (_) @_right
(#not-has-type? @_right arrow_function function)) @indent.begin
(variable_declarator
value: (_) @_value
(#not-has-type? @_value arrow_function call_expression function)) @indent.begin
(arguments
")" @indent.end)
(object
"}" @indent.end)
(statement_block
"}" @indent.end)
[
(arguments
(object))
")"
"}"
"]"
] @indent.branch
(statement_block
"{" @indent.branch)
(parenthesized_expression
("("
(_)
")" @indent.end))
[
"}"
"]"
] @indent.end
(template_string) @indent.ignore
[
(comment)
(ERROR)
] @indent.auto

View File

@ -0,0 +1,216 @@
(((comment) @_jsdoc_comment
(#lua-match? @_jsdoc_comment "^/[*][*][^*].*[*]/$")) @injection.content
(#set! injection.language "jsdoc"))
((comment) @injection.content
(#set! injection.language "comment"))
; html(`...`), html`...`, sql(`...`), etc.
(call_expression
function: [
(await_expression
(identifier) @injection.language)
(identifier) @injection.language
]
arguments: [
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
; Languages excluded from auto-injection due to special rules
; - svg uses the html parser
; - css uses the styled parser
(#not-any-of? @injection.language "svg" "css"))
; svg`...` or svg(`...`)
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "svg"))
((identifier) @_name
(#eq? @_name "svg"))
]
arguments: [
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "html"))
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "gql"))
((identifier) @_name
(#eq? @_name "gql"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "hbs"))
((identifier) @_name
(#eq? @_name "hbs"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
((glimmer_template) @injection.content
(#set! injection.language "glimmer"))
; css`<css>`, keyframes`<css>`
(call_expression
function: [
(await_expression
(identifier) @_name
(#any-of? @_name "css" "keyframes"))
((identifier) @_name
(#any-of? @_name "css" "keyframes"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div`<css>`
(call_expression
function: (member_expression
object: (identifier) @_name
(#eq? @_name "styled"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component)`<css>`
(call_expression
function: (call_expression
function: (identifier) @_name
(#eq? @_name "styled"))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div.attrs({ prop: "foo" })`<css>`
(call_expression
function: (call_expression
function: (member_expression
object: (member_expression
object: (identifier) @_name
(#eq? @_name "styled"))))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component).attrs({ prop: "foo" })`<css>`
(call_expression
function: (call_expression
function: (member_expression
object: (call_expression
function: (identifier) @_name
(#eq? @_name "styled"))))
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
((regex_pattern) @injection.content
(#set! injection.language "regex"))
; ((comment) @_gql_comment
; (#eq? @_gql_comment "/* GraphQL */")
; (template_string) @injection.content
; (#set! injection.language "graphql"))
((template_string) @injection.content
(#lua-match? @injection.content "^`#graphql")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql"))
; el.innerHTML = `<html>`
(assignment_expression
left: (member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "html"))
; el.innerHTML = '<html>'
(assignment_expression
left: (member_expression
property: (property_identifier) @_prop
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (string
(string_fragment) @injection.content)
(#set! injection.language "html"))
;---- Angular injections -----
; @Component({
; template: `<html>`
; })
(decorator
(call_expression
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "template"))
value: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "angular")))))))
; @Component({
; styles: [`<css>`]
; })
(decorator
(call_expression
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "styles"))
value: (array
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "css"))))))))
; @Component({
; styles: `<css>`
; })
(decorator
(call_expression
function: ((identifier) @_name
(#eq? @_name "Component"))
arguments: (arguments
(object
(pair
key: ((property_identifier) @_prop
(#eq? @_prop "styles"))
value: ((template_string) @injection.content
(#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "css")))))))

View File

@ -0,0 +1,42 @@
; Scopes
;-------
(statement_block) @local.scope
(function_expression) @local.scope
(arrow_function) @local.scope
(function_declaration) @local.scope
(method_definition) @local.scope
(for_statement) @local.scope
(for_in_statement) @local.scope
(catch_clause) @local.scope
; Definitions
;------------
(variable_declarator
name: (identifier) @local.definition.var)
(import_specifier
(identifier) @local.definition.import)
(namespace_import
(identifier) @local.definition.import)
(function_declaration
(identifier) @local.definition.function
(#set! definition.var.scope parent))
(method_definition
(property_identifier) @local.definition.function
(#set! definition.var.scope parent))
; References
;------------
(identifier) @local.reference
(shorthand_property_identifier) @local.reference