mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -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"
|
||||
"at"
|
||||
"begin"
|
||||
"body"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
|
|
@ -25,17 +26,26 @@
|
|||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"mod"
|
||||
"new"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"overriding"
|
||||
"package"
|
||||
"pragma"
|
||||
"private"
|
||||
"protected"
|
||||
"range"
|
||||
"record"
|
||||
"separate"
|
||||
"subtype"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"type"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
|
|
@ -46,27 +56,14 @@
|
|||
"renames"
|
||||
] @keyword.storage
|
||||
|
||||
[
|
||||
"mod"
|
||||
"new"
|
||||
"protected"
|
||||
"record"
|
||||
"subtype"
|
||||
"type"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"body"
|
||||
"function"
|
||||
"overriding"
|
||||
"procedure"
|
||||
"package"
|
||||
"separate"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -256,4 +256,4 @@
|
|||
"inherited_sharing"
|
||||
] @keyword
|
||||
|
||||
"System.runAs" @type.builtin
|
||||
"System.runAs" @function.builtin
|
||||
|
|
|
|||
|
|
@ -266,10 +266,7 @@
|
|||
] @boolean
|
||||
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "cls"))
|
||||
(#any-of? @variable.builtin "self" "cls"))
|
||||
|
||||
(integer) @number
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
[
|
||||
"ENV"
|
||||
"CACHE"
|
||||
] @keyword.storage
|
||||
] @module
|
||||
|
||||
[
|
||||
"$"
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@
|
|||
(id
|
||||
(identifier) @constant))
|
||||
|
||||
(comment) @comment
|
||||
(comment) @comment @spell
|
||||
|
||||
(preproc) @keyword.directive
|
||||
|
||||
(comment) @spell
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
(string) @string
|
||||
|
||||
; Modules
|
||||
(alias) @type
|
||||
(alias) @module
|
||||
|
||||
; Atoms & Keywords
|
||||
[
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@
|
|||
|
||||
((variable
|
||||
(identifier) @function)
|
||||
(#match? @function ".+\\~$"))
|
||||
(#lua-match? @function ".+[~]$"))
|
||||
|
||||
((variable
|
||||
(identifier) @boolean)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,16 @@
|
|||
(subsection_name)
|
||||
] @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
|
||||
[
|
||||
"["
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
; Keywords
|
||||
(scheme) @keyword
|
||||
; Schemes
|
||||
(scheme) @type
|
||||
|
||||
; Methods
|
||||
(method) @function.method
|
||||
|
|
|
|||
|
|
@ -52,12 +52,13 @@
|
|||
"retry"
|
||||
"retry-interval"
|
||||
"retry-max-count"
|
||||
(variable_option
|
||||
"variable")
|
||||
"verbose"
|
||||
"very-verbose"
|
||||
] @constant.builtin
|
||||
|
||||
(variable_option
|
||||
"variable" @constant.builtin)
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(variable_name) @variable
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@
|
|||
(block_arg_list
|
||||
(value_use) @variable.parameter)
|
||||
|
||||
(caret_id) @tag
|
||||
(caret_id) @string.special
|
||||
|
||||
(value_use) @variable
|
||||
|
||||
|
|
|
|||
|
|
@ -314,5 +314,6 @@
|
|||
(comment)
|
||||
(line_number_directive)
|
||||
(directive)
|
||||
(shebang)
|
||||
] @comment @spell
|
||||
|
||||
(shebang) @keyword.directive
|
||||
|
|
|
|||
|
|
@ -39,11 +39,12 @@
|
|||
(enum_field
|
||||
(identifier) @constant)
|
||||
|
||||
(string) @string
|
||||
|
||||
[
|
||||
(string)
|
||||
"\"proto3\""
|
||||
"\"proto2\""
|
||||
] @string
|
||||
] @string.special
|
||||
|
||||
(int_lit) @number
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
] @label
|
||||
|
||||
((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
|
||||
(#not-lua-match? @type "^[A-Z0-9_]+$"))
|
||||
|
|
|
|||
|
|
@ -150,10 +150,11 @@
|
|||
|
||||
[
|
||||
(string)
|
||||
(character_literal)
|
||||
(interpolated_string_expression)
|
||||
] @string
|
||||
|
||||
(character_literal) @character
|
||||
|
||||
(symbol_literal) @string.special.symbol
|
||||
|
||||
(interpolation
|
||||
|
|
|
|||
|
|
@ -71,10 +71,9 @@
|
|||
"constructor" @constructor
|
||||
|
||||
; Fields
|
||||
[
|
||||
(field_identifier)
|
||||
(annotation_key)
|
||||
] @variable.member
|
||||
(field_identifier) @variable.member
|
||||
|
||||
(annotation_key) @attribute
|
||||
|
||||
((field_identifier) @constant
|
||||
(#lua-match? @constant "^[%u_]*$"))
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
; For function calls
|
||||
(named_argument
|
||||
name: (identifier) @property)
|
||||
name: (identifier) @function.call)
|
||||
|
||||
; Methods
|
||||
(method_call
|
||||
name: (method_name) @function.method)
|
||||
name: (method_name) @function.method.call)
|
||||
|
||||
; Classes
|
||||
(class) @type
|
||||
|
|
|
|||
|
|
@ -237,21 +237,3 @@
|
|||
"{"
|
||||
"}"
|
||||
] @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
|
||||
[
|
||||
"ACTION"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
; Keywords
|
||||
[
|
||||
; block delimiters
|
||||
"begin"
|
||||
"end"
|
||||
(module_keyword)
|
||||
"endmodule"
|
||||
"program"
|
||||
|
|
@ -48,11 +49,6 @@
|
|||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"begin"
|
||||
"end"
|
||||
] @label
|
||||
|
||||
[
|
||||
(always_keyword)
|
||||
"generate"
|
||||
|
|
@ -144,7 +140,7 @@
|
|||
|
||||
(edge_identifier) @attribute
|
||||
|
||||
(port_direction) @label
|
||||
(port_direction) @keyword.storage
|
||||
|
||||
(port_identifier
|
||||
(simple_identifier) @variable)
|
||||
|
|
|
|||
|
|
@ -82,12 +82,19 @@
|
|||
"as"
|
||||
"bring"
|
||||
"class"
|
||||
"else"
|
||||
"for"
|
||||
"if"
|
||||
"in"
|
||||
"let"
|
||||
"new"
|
||||
"return"
|
||||
(inflight_specifier)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"for"
|
||||
"in"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
"return" @keyword.return
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@
|
|||
|
||||
(keypath) @string.special.path
|
||||
|
||||
; Always highlight the value of an enum statement as a string
|
||||
(enum_value) @string
|
||||
; Always highlight the value of an enum statement as a constant
|
||||
(enum_value) @constant
|
||||
|
||||
; Highlight xpath and pattern strings differently from plain strings
|
||||
(statement
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue