mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
fix(highlights): improve consistency
This commit is contained in:
parent
4cd951d703
commit
2f38c36294
22 changed files with 62 additions and 76 deletions
|
|
@ -13,6 +13,7 @@
|
||||||
"array"
|
"array"
|
||||||
"at"
|
"at"
|
||||||
"begin"
|
"begin"
|
||||||
|
"body"
|
||||||
"declare"
|
"declare"
|
||||||
"delay"
|
"delay"
|
||||||
"delta"
|
"delta"
|
||||||
|
|
@ -25,17 +26,26 @@
|
||||||
"interface"
|
"interface"
|
||||||
"is"
|
"is"
|
||||||
"limited"
|
"limited"
|
||||||
|
"mod"
|
||||||
|
"new"
|
||||||
"null"
|
"null"
|
||||||
"of"
|
"of"
|
||||||
"others"
|
"others"
|
||||||
"out"
|
"out"
|
||||||
|
"overriding"
|
||||||
|
"package"
|
||||||
"pragma"
|
"pragma"
|
||||||
"private"
|
"private"
|
||||||
|
"protected"
|
||||||
"range"
|
"range"
|
||||||
|
"record"
|
||||||
|
"separate"
|
||||||
|
"subtype"
|
||||||
"synchronized"
|
"synchronized"
|
||||||
"tagged"
|
"tagged"
|
||||||
"task"
|
"task"
|
||||||
"terminate"
|
"terminate"
|
||||||
|
"type"
|
||||||
"until"
|
"until"
|
||||||
"when"
|
"when"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
@ -46,27 +56,14 @@
|
||||||
"renames"
|
"renames"
|
||||||
] @keyword.storage
|
] @keyword.storage
|
||||||
|
|
||||||
[
|
|
||||||
"mod"
|
|
||||||
"new"
|
|
||||||
"protected"
|
|
||||||
"record"
|
|
||||||
"subtype"
|
|
||||||
"type"
|
|
||||||
] @keyword.type
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"with"
|
"with"
|
||||||
"use"
|
"use"
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
[
|
[
|
||||||
"body"
|
|
||||||
"function"
|
"function"
|
||||||
"overriding"
|
|
||||||
"procedure"
|
"procedure"
|
||||||
"package"
|
|
||||||
"separate"
|
|
||||||
] @keyword.function
|
] @keyword.function
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -256,4 +256,4 @@
|
||||||
"inherited_sharing"
|
"inherited_sharing"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
"System.runAs" @type.builtin
|
"System.runAs" @function.builtin
|
||||||
|
|
|
||||||
|
|
@ -266,10 +266,7 @@
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
((python_identifier) @variable.builtin
|
((python_identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "self"))
|
(#any-of? @variable.builtin "self" "cls"))
|
||||||
|
|
||||||
((python_identifier) @variable.builtin
|
|
||||||
(#eq? @variable.builtin "cls"))
|
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
[
|
[
|
||||||
"ENV"
|
"ENV"
|
||||||
"CACHE"
|
"CACHE"
|
||||||
] @keyword.storage
|
] @module
|
||||||
|
|
||||||
[
|
[
|
||||||
"$"
|
"$"
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@
|
||||||
(id
|
(id
|
||||||
(identifier) @constant))
|
(identifier) @constant))
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment @spell
|
||||||
|
|
||||||
(preproc) @keyword.directive
|
(preproc) @keyword.directive
|
||||||
|
|
||||||
(comment) @spell
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
; Modules
|
; Modules
|
||||||
(alias) @type
|
(alias) @module
|
||||||
|
|
||||||
; Atoms & Keywords
|
; Atoms & Keywords
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
|
|
||||||
((variable
|
((variable
|
||||||
(identifier) @function)
|
(identifier) @function)
|
||||||
(#match? @function ".+\\~$"))
|
(#lua-match? @function ".+[~]$"))
|
||||||
|
|
||||||
((variable
|
((variable
|
||||||
(identifier) @boolean)
|
(identifier) @boolean)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,16 @@
|
||||||
(subsection_name)
|
(subsection_name)
|
||||||
] @string.special)
|
] @string.special)
|
||||||
|
|
||||||
|
((section_header
|
||||||
|
(section_name) @_name
|
||||||
|
(subsection_name) @string.special.url)
|
||||||
|
(#any-of? @_name "credential" "url"))
|
||||||
|
|
||||||
|
((variable
|
||||||
|
(name) @_name
|
||||||
|
value: (string) @string.special.url)
|
||||||
|
(#eq? @_name "insteadOf"))
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
; Keywords
|
; Schemes
|
||||||
(scheme) @keyword
|
(scheme) @type
|
||||||
|
|
||||||
; Methods
|
; Methods
|
||||||
(method) @function.method
|
(method) @function.method
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,13 @@
|
||||||
"retry"
|
"retry"
|
||||||
"retry-interval"
|
"retry-interval"
|
||||||
"retry-max-count"
|
"retry-max-count"
|
||||||
(variable_option
|
|
||||||
"variable")
|
|
||||||
"verbose"
|
"verbose"
|
||||||
"very-verbose"
|
"very-verbose"
|
||||||
] @constant.builtin
|
] @constant.builtin
|
||||||
|
|
||||||
|
(variable_option
|
||||||
|
"variable" @constant.builtin)
|
||||||
|
|
||||||
(boolean) @boolean
|
(boolean) @boolean
|
||||||
|
|
||||||
(variable_name) @variable
|
(variable_name) @variable
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@
|
||||||
(block_arg_list
|
(block_arg_list
|
||||||
(value_use) @variable.parameter)
|
(value_use) @variable.parameter)
|
||||||
|
|
||||||
(caret_id) @tag
|
(caret_id) @string.special
|
||||||
|
|
||||||
(value_use) @variable
|
(value_use) @variable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,5 +314,6 @@
|
||||||
(comment)
|
(comment)
|
||||||
(line_number_directive)
|
(line_number_directive)
|
||||||
(directive)
|
(directive)
|
||||||
(shebang)
|
|
||||||
] @comment @spell
|
] @comment @spell
|
||||||
|
|
||||||
|
(shebang) @keyword.directive
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,12 @@
|
||||||
(enum_field
|
(enum_field
|
||||||
(identifier) @constant)
|
(identifier) @constant)
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
[
|
[
|
||||||
(string)
|
|
||||||
"\"proto3\""
|
"\"proto3\""
|
||||||
"\"proto2\""
|
"\"proto2\""
|
||||||
] @string
|
] @string.special
|
||||||
|
|
||||||
(int_lit) @number
|
(int_lit) @number
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
] @label
|
] @label
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$"))
|
(#any-of? @constant.builtin "__callee__" "__dir__" "__id__" "__method__" "__send__" "__ENCODING__" "__FILE__" "__LINE__"))
|
||||||
|
|
||||||
((constant) @type
|
((constant) @type
|
||||||
(#not-lua-match? @type "^[A-Z0-9_]+$"))
|
(#not-lua-match? @type "^[A-Z0-9_]+$"))
|
||||||
|
|
|
||||||
|
|
@ -150,10 +150,11 @@
|
||||||
|
|
||||||
[
|
[
|
||||||
(string)
|
(string)
|
||||||
(character_literal)
|
|
||||||
(interpolated_string_expression)
|
(interpolated_string_expression)
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
|
(character_literal) @character
|
||||||
|
|
||||||
(symbol_literal) @string.special.symbol
|
(symbol_literal) @string.special.symbol
|
||||||
|
|
||||||
(interpolation
|
(interpolation
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,9 @@
|
||||||
"constructor" @constructor
|
"constructor" @constructor
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
[
|
(field_identifier) @variable.member
|
||||||
(field_identifier)
|
|
||||||
(annotation_key)
|
(annotation_key) @attribute
|
||||||
] @variable.member
|
|
||||||
|
|
||||||
((field_identifier) @constant
|
((field_identifier) @constant
|
||||||
(#lua-match? @constant "^[%u_]*$"))
|
(#lua-match? @constant "^[%u_]*$"))
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
; For function calls
|
; For function calls
|
||||||
(named_argument
|
(named_argument
|
||||||
name: (identifier) @property)
|
name: (identifier) @function.call)
|
||||||
|
|
||||||
; Methods
|
; Methods
|
||||||
(method_call
|
(method_call
|
||||||
name: (method_name) @function.method)
|
name: (method_name) @function.method.call)
|
||||||
|
|
||||||
; Classes
|
; Classes
|
||||||
(class) @type
|
(class) @type
|
||||||
|
|
|
||||||
|
|
@ -237,21 +237,3 @@
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
; Only highlight format specifiers in calls to string.format
|
|
||||||
; string.format('...')
|
|
||||||
;(function_call
|
|
||||||
; called_object: (index
|
|
||||||
; (identifier) @base
|
|
||||||
; key: (identifier) @entry)
|
|
||||||
; arguments: (arguments .
|
|
||||||
; (string (format_specifier) @string.escape))
|
|
||||||
;
|
|
||||||
; (#eq? @base "string")
|
|
||||||
; (#eq? @entry "format"))
|
|
||||||
; ('...'):format()
|
|
||||||
;(function_call
|
|
||||||
; called_object: (method_index
|
|
||||||
; (string (format_specifier) @string.escape)
|
|
||||||
; key: (identifier) @func-name)
|
|
||||||
; (#eq? @func-name "format"))
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
; ; Intended for consumption by nvim-treesitter
|
|
||||||
; ; Default capture names for nvim-treesitter found here:
|
|
||||||
; ; https://github.com/nvim-treesitter/nvim-treesitter/blob/e473630fe0872cb0ed97cd7085e724aa58bc1c84/lua/nvim-treesitter/highlight.lua#L14-L104
|
|
||||||
; ; In this file, captures defined later take precedence over captures defined earlier
|
|
||||||
; Keywords
|
; Keywords
|
||||||
[
|
[
|
||||||
"ACTION"
|
"ACTION"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
; Keywords
|
; Keywords
|
||||||
[
|
[
|
||||||
; block delimiters
|
"begin"
|
||||||
|
"end"
|
||||||
(module_keyword)
|
(module_keyword)
|
||||||
"endmodule"
|
"endmodule"
|
||||||
"program"
|
"program"
|
||||||
|
|
@ -48,11 +49,6 @@
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
[
|
|
||||||
"begin"
|
|
||||||
"end"
|
|
||||||
] @label
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(always_keyword)
|
(always_keyword)
|
||||||
"generate"
|
"generate"
|
||||||
|
|
@ -144,7 +140,7 @@
|
||||||
|
|
||||||
(edge_identifier) @attribute
|
(edge_identifier) @attribute
|
||||||
|
|
||||||
(port_direction) @label
|
(port_direction) @keyword.storage
|
||||||
|
|
||||||
(port_identifier
|
(port_identifier
|
||||||
(simple_identifier) @variable)
|
(simple_identifier) @variable)
|
||||||
|
|
|
||||||
|
|
@ -82,12 +82,19 @@
|
||||||
"as"
|
"as"
|
||||||
"bring"
|
"bring"
|
||||||
"class"
|
"class"
|
||||||
"else"
|
|
||||||
"for"
|
|
||||||
"if"
|
|
||||||
"in"
|
|
||||||
"let"
|
"let"
|
||||||
"new"
|
"new"
|
||||||
"return"
|
|
||||||
(inflight_specifier)
|
(inflight_specifier)
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"for"
|
||||||
|
"in"
|
||||||
|
] @keyword.repeat
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
"return" @keyword.return
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@
|
||||||
|
|
||||||
(keypath) @string.special.path
|
(keypath) @string.special.path
|
||||||
|
|
||||||
; Always highlight the value of an enum statement as a string
|
; Always highlight the value of an enum statement as a constant
|
||||||
(enum_value) @string
|
(enum_value) @constant
|
||||||
|
|
||||||
; Highlight xpath and pattern strings differently from plain strings
|
; Highlight xpath and pattern strings differently from plain strings
|
||||||
(statement
|
(statement
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue