Update generated neovim config
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
; For nvim-treesitter-context support
|
||||
|
||||
(function_definition) @context
|
||||
(condition_statement) @context
|
||||
(while_statement) @context
|
||||
(do_while_statement) @context
|
||||
(switch_statement) @context
|
||||
(switch_case) @context
|
||||
|
||||
(methodmap) @context
|
||||
(methodmap_method_constructor) @context
|
||||
(methodmap_method) @context
|
||||
(methodmap_property) @context
|
||||
(methodmap_property_method) @context
|
||||
|
||||
(enum_struct) @context
|
||||
(enum_struct_method) @context
|
||||
|
||||
(typeset) @context
|
||||
@ -0,0 +1,255 @@
|
||||
; Assume all-caps names are constants
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]+$'"))
|
||||
|
||||
; Function definitions/declarations
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
(parameter_declaration
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Methods / Properties
|
||||
(field_access
|
||||
field: (identifier) @field)
|
||||
|
||||
; Function calls
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_access
|
||||
field: (identifier) @method.call)) ; Must be after field_access
|
||||
|
||||
; Types
|
||||
(builtin_type) @type.builtin
|
||||
(type (identifier) @type)
|
||||
(any_type) @type
|
||||
|
||||
; Variables
|
||||
(variable_storage_class) @storageclass
|
||||
(variable_declaration
|
||||
name: (identifier) @variable)
|
||||
(old_variable_declaration
|
||||
name: (identifier) @variable)
|
||||
|
||||
; Preprocessor
|
||||
(preproc_include) @include
|
||||
(preproc_tryinclude) @include
|
||||
(system_lib_string) @string
|
||||
(string_literal) @string
|
||||
|
||||
(preproc_assert) @preproc
|
||||
(preproc_pragma) @preproc
|
||||
(preproc_arg) @constant
|
||||
(preproc_macro) @function.macro
|
||||
(macro_param) @parameter
|
||||
(preproc_if) @preproc
|
||||
(preproc_else) @preproc
|
||||
(preproc_elseif) @preproc
|
||||
(preproc_endif) @preproc
|
||||
(preproc_endinput) @preproc
|
||||
(preproc_define) @define
|
||||
(preproc_define
|
||||
name: (identifier) @constant)
|
||||
(preproc_undefine) @define
|
||||
(preproc_undefine
|
||||
name: (identifier) @constant)
|
||||
(preproc_error) @function.macro ; Wrong color?
|
||||
(preproc_warning) @function.macro ; Wrong color?
|
||||
|
||||
; Statements
|
||||
(for_statement) @repeat
|
||||
(condition_statement) @conditional
|
||||
(while_statement) @repeat
|
||||
(do_while_statement) @repeat
|
||||
(switch_statement) @conditional
|
||||
(switch_case) @conditional
|
||||
(ternary_expression) @conditional.ternary
|
||||
|
||||
; Expressions
|
||||
(view_as) @function.builtin
|
||||
(sizeof_expression) @function.macro
|
||||
(this) @variable.builtin
|
||||
|
||||
; https://github.com/alliedmodders/sourcemod/blob/5c0ae11a4619e9cba93478683c7737253ea93ba6/plugins/include/handles.inc#L78
|
||||
(hardcoded_symbol) @variable.builtin
|
||||
|
||||
; Comments
|
||||
(comment) @comment
|
||||
|
||||
; General
|
||||
(parameter_declaration
|
||||
defaultValue: (identifier) @constant)
|
||||
(fixed_dimension) @punctuation.bracket ; the [3] in var[3]
|
||||
(dimension) @punctuation.bracket
|
||||
(array_indexed_access) @punctuation.bracket
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
; Constructors
|
||||
(new_expression
|
||||
class: (identifier) @type
|
||||
arguments: (call_arguments) @constructor)
|
||||
|
||||
; Methodmaps
|
||||
(methodmap) @type.definition
|
||||
(methodmap
|
||||
name: (identifier) @type)
|
||||
(methodmap
|
||||
inherits: (identifier) @type)
|
||||
(methodmap_method_constructor
|
||||
name: (identifier) @constructor)
|
||||
(methodmap_method
|
||||
name: (identifier) @method)
|
||||
(methodmap_native
|
||||
name: (identifier) @method)
|
||||
(methodmap_property
|
||||
name: (identifier) @property)
|
||||
(methodmap_property_getter) @method
|
||||
(methodmap_property_setter) @method
|
||||
|
||||
; Enum structs
|
||||
(enum_struct) @type.definition
|
||||
(enum_struct
|
||||
name: (identifier) @type)
|
||||
(enum_struct_field
|
||||
name: (identifier) @field)
|
||||
(enum_struct_method
|
||||
name: (identifier) @method)
|
||||
|
||||
; Non-type Keywords
|
||||
(variable_storage_class) @storageclass
|
||||
(visibility) @storageclass
|
||||
(visibility) @storageclass
|
||||
(assertion) @function.builtin
|
||||
(function_declaration_kind) @keyword.function
|
||||
[
|
||||
"new"
|
||||
"delete"
|
||||
] @keyword.operator
|
||||
[
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"..."
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"++"
|
||||
"--"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"=="
|
||||
"!="
|
||||
"<"
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
"&"
|
||||
"|"
|
||||
"~"
|
||||
"^"
|
||||
"<<"
|
||||
">>"
|
||||
">>>"
|
||||
"|="
|
||||
"&="
|
||||
"^="
|
||||
"~="
|
||||
"<<="
|
||||
">>="
|
||||
] @operator
|
||||
(ignore_argument) @operator
|
||||
(scope_access) @operator
|
||||
(rest_operator) @operator
|
||||
|
||||
; public Plugin myinfo
|
||||
(struct_declaration
|
||||
name: (identifier) @variable.builtin)
|
||||
|
||||
; Typedef/Typedef
|
||||
(typeset) @type.definition
|
||||
(typedef) @type.definition
|
||||
(functag) @type.definition
|
||||
(funcenum) @type.definition
|
||||
(typedef_expression) @keyword.function ; function void(int x)
|
||||
|
||||
; Enums
|
||||
(enum) @type.definition
|
||||
(enum
|
||||
name: (identifier) @type)
|
||||
(enum_entry
|
||||
name: (identifier) @constant)
|
||||
(enum_entry
|
||||
value: (_) @constant)
|
||||
|
||||
; Literals
|
||||
(int_literal) @number
|
||||
(char_literal) @character
|
||||
(float_literal) @float
|
||||
(string_literal) @string
|
||||
(array_literal) @punctuation.bracket
|
||||
[
|
||||
(bool_literal)
|
||||
(null)
|
||||
] @constant.builtin
|
||||
((identifier) @constant
|
||||
(#match? @constant "INVALID_HANDLE"))
|
||||
|
||||
; Comment specialisations (must be after comment)
|
||||
; These might be unnecessary and/or used incorrectly, since they're intended
|
||||
; for markup languages
|
||||
((comment) @text.todo
|
||||
(#match? @text.todo "^\/[\/\*][\t ]TODO"))
|
||||
((comment) @text.note
|
||||
(#match? @text.note "^\/[\/\*][\t ]NOTE"))
|
||||
((comment) @text.warning
|
||||
(#match? @text.warning "^\/[\/\*][\t ]WARNING"))
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"__nullable__"
|
||||
"break"
|
||||
"case"
|
||||
"const"
|
||||
"continue"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
"else"
|
||||
"enum"
|
||||
"for"
|
||||
"forward"
|
||||
"funcenum"
|
||||
"functag"
|
||||
"get"
|
||||
"if"
|
||||
"methodmap"
|
||||
"native"
|
||||
"new"
|
||||
"property"
|
||||
"public"
|
||||
"return"
|
||||
"set"
|
||||
"static"
|
||||
"stock"
|
||||
"struct"
|
||||
"switch"
|
||||
"typedef"
|
||||
"typeset"
|
||||
"void"
|
||||
"while"
|
||||
] @keyword
|
||||
|
||||
(identifier) @variable
|
||||
@ -0,0 +1,4 @@
|
||||
; Parse JSDoc annotations in comments
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "jsdoc"))
|
||||
@ -0,0 +1,18 @@
|
||||
[
|
||||
(function_definition)
|
||||
(alias_declaration)
|
||||
(enum_struct_method)
|
||||
(methodmap_method)
|
||||
(methodmap_method_constructor)
|
||||
(methodmap_method_destructor)
|
||||
(methodmap_property_method)
|
||||
] @local.scope
|
||||
|
||||
; Definitions
|
||||
(variable_declaration
|
||||
name: (identifier) @local.definition)
|
||||
(old_variable_declaration
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
@ -0,0 +1,119 @@
|
||||
; Documentation
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
[
|
||||
(function_definition
|
||||
name: (identifier) @name)
|
||||
(function_declaration
|
||||
name: (identifier) @name)
|
||||
] @definition.function
|
||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||
(#select-adjacent! @doc @definition.function)
|
||||
)
|
||||
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
[
|
||||
(enum_struct_method
|
||||
name: (identifier) @name)
|
||||
(methodmap_method
|
||||
name: (identifier) @name)
|
||||
(methodmap_method_constructor
|
||||
name: (identifier) @name)
|
||||
(methodmap_method_destructor
|
||||
name: (identifier) @name)
|
||||
] @definition.method
|
||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||
(#select-adjacent! @doc @definition.method)
|
||||
)
|
||||
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
[
|
||||
(methodmap
|
||||
name: (identifier) @name)
|
||||
(enum_struct
|
||||
name: (identifier) @name)
|
||||
(enum
|
||||
name: (identifier) @name)
|
||||
] @definition.class
|
||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||
(#select-adjacent! @doc @definition.class)
|
||||
)
|
||||
|
||||
(
|
||||
(comment)* @doc
|
||||
.
|
||||
(global_variable_declaration
|
||||
(variable_declaration
|
||||
name: (identifier) @name
|
||||
) @definition.variable
|
||||
)
|
||||
(#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
|
||||
(#select-adjacent! @doc @definition.variable)
|
||||
)
|
||||
|
||||
; ADT items
|
||||
(methodmap
|
||||
name: (identifier) @name) @definition.class
|
||||
|
||||
(enum_struct
|
||||
name: (identifier) @name) @definition.class
|
||||
|
||||
(enum
|
||||
name: (identifier) @name) @definition.class
|
||||
|
||||
; Method definitions
|
||||
(enum_struct_method
|
||||
name: (identifier) @name) @definition.method
|
||||
(methodmap_method
|
||||
name: (identifier) @name) @definition.method
|
||||
(methodmap_method_constructor
|
||||
name: (identifier) @name) @definition.method
|
||||
(methodmap_method_destructor
|
||||
name: (identifier) @name) @definition.method
|
||||
|
||||
; Variable definitions
|
||||
(global_variable_declaration
|
||||
(variable_declaration
|
||||
name: (identifier) @name
|
||||
) @definition.variable
|
||||
)
|
||||
|
||||
; Function definitions
|
||||
(function_definition
|
||||
name: (identifier) @name) @definition.function
|
||||
(function_declaration
|
||||
name: (identifier) @name) @definition.function
|
||||
|
||||
; Enum entries
|
||||
(enum_entry
|
||||
name: (identifier) @name) @definition.constant
|
||||
|
||||
; Typedef definitions
|
||||
(typeset
|
||||
name: (identifier) @name) @definition.interface
|
||||
(typedef
|
||||
name: (identifier) @name) @definition.interface
|
||||
(functag
|
||||
name: (identifier) @name) @definition.interface
|
||||
(funcenum
|
||||
name: (identifier) @name) @definition.interface
|
||||
|
||||
; Macro definitions
|
||||
(preproc_define
|
||||
name: (identifier) @name) @definition.macro
|
||||
(preproc_macro
|
||||
name: (identifier) @name) @definition.macro
|
||||
|
||||
; References
|
||||
(call_expression
|
||||
function: (identifier) @name) @reference.call
|
||||
(call_expression
|
||||
function: (field_access
|
||||
field: (identifier) @name)) @reference.call
|
||||
(new_expression
|
||||
class: (identifier) @name) @reference.class
|
||||
Reference in New Issue
Block a user