mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-09 15:00:04 -04:00
Fix #307: Use and document TSVariable/TSVariableBuiltin in all languages
This commit is contained in:
parent
50991e370b
commit
bcf421b4e7
10 changed files with 39 additions and 8 deletions
|
|
@ -736,6 +736,14 @@ Literal text.
|
||||||
*hl-TSURI*
|
*hl-TSURI*
|
||||||
Any URI like a link or email.
|
Any URI like a link or email.
|
||||||
|
|
||||||
|
`TSVariable`
|
||||||
|
*hl-TSVariable*
|
||||||
|
Any variable name that does not have another highlight.
|
||||||
|
|
||||||
|
`TSVariableBuiltin`
|
||||||
|
*hl-TSVariableBuiltin*
|
||||||
|
Variable names that are defined by the languages, like `this` or `self`.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
MODULE-HIGHLIGHTS *nvim-treesitter-module-highlights*
|
MODULE-HIGHLIGHTS *nvim-treesitter-module-highlights*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
[
|
[
|
||||||
"const"
|
"const"
|
||||||
"default"
|
"default"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
name: (identifier) @method)
|
name: (identifier) @method)
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
(this) @constant.builtin
|
(this) @variable.builtin
|
||||||
(nullptr) @constant
|
(nullptr) @constant
|
||||||
|
|
||||||
(true) @boolean
|
(true) @boolean
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
|
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
|
||||||
|
|
||||||
; Methods
|
; Variables
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
; Methods
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
name: (identifier) @method)
|
name: (identifier) @method)
|
||||||
|
|
@ -105,7 +108,7 @@
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#vim-match? @constant "^_*[A-Z][A-Z\d_]+"))
|
(#vim-match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||||
|
|
||||||
(this) @constant.builtin
|
(this) @variable.builtin
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
; Javascript
|
; Javascript
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
;-----------
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
; Properties
|
; Properties
|
||||||
;-----------
|
;-----------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
;; Variables
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
;; Constants
|
;; Constants
|
||||||
[
|
[
|
||||||
(false)
|
(false)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Variables
|
||||||
|
|
||||||
|
(variable_name) @variable
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
;; From tree-sitter-python licensed under MIT License
|
;; From tree-sitter-python licensed under MIT License
|
||||||
; Copyright (c) 2016 Max Brunsfeld
|
; Copyright (c) 2016 Max Brunsfeld
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
; Reset highlighing in f-string interpolations
|
; Reset highlighing in f-string interpolations
|
||||||
(interpolation) @Normal
|
(interpolation) @Normal
|
||||||
|
|
||||||
|
|
@ -105,8 +108,8 @@
|
||||||
|
|
||||||
(none) @constant.builtin
|
(none) @constant.builtin
|
||||||
[(true) (false)] @boolean
|
[(true) (false)] @boolean
|
||||||
((identifier) @constant.builtin
|
((identifier) @variable.builtin
|
||||||
(#match? @constant.builtin "self"))
|
(#match? @variable.builtin "self"))
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
(float) @float
|
(float) @float
|
||||||
|
|
@ -232,8 +235,8 @@
|
||||||
((class_definition
|
((class_definition
|
||||||
body: (block
|
body: (block
|
||||||
(function_definition
|
(function_definition
|
||||||
parameters: (parameters . (identifier) @constant.builtin))))
|
parameters: (parameters . (identifier) @variable.builtin))))
|
||||||
(#vim-match? @constant.builtin "^(self|obj|cls)$"))
|
(#vim-match? @variable.builtin "^(self|obj|cls)$"))
|
||||||
|
|
||||||
;; Error
|
;; Error
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
; Variables
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -100,7 +103,7 @@
|
||||||
[
|
[
|
||||||
(self)
|
(self)
|
||||||
(super)
|
(super)
|
||||||
] @constant.builtin
|
] @variable.builtin
|
||||||
|
|
||||||
(method_parameters (identifier) @parameter)
|
(method_parameters (identifier) @parameter)
|
||||||
(lambda_parameters (identifier) @parameter)
|
(lambda_parameters (identifier) @parameter)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue