mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -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*
|
||||
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*
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
(identifier) @variable
|
||||
|
||||
[
|
||||
"const"
|
||||
"default"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
(identifier) @variable
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
; Constants
|
||||
|
||||
(this) @constant.builtin
|
||||
(this) @variable.builtin
|
||||
(nullptr) @constant
|
||||
|
||||
(true) @boolean
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
|
||||
|
||||
; Methods
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Methods
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
|
|
@ -105,7 +108,7 @@
|
|||
((identifier) @constant
|
||||
(#vim-match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||
|
||||
(this) @constant.builtin
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
; Javascript
|
||||
|
||||
; Variables
|
||||
;-----------
|
||||
(identifier) @variable
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@
|
|||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
;; Variables
|
||||
(identifier) @variable
|
||||
|
||||
;; Constants
|
||||
[
|
||||
(false)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
; Variables
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
; Types
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
;; From tree-sitter-python licensed under MIT License
|
||||
; Copyright (c) 2016 Max Brunsfeld
|
||||
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
; Reset highlighing in f-string interpolations
|
||||
(interpolation) @Normal
|
||||
|
||||
|
|
@ -105,8 +108,8 @@
|
|||
|
||||
(none) @constant.builtin
|
||||
[(true) (false)] @boolean
|
||||
((identifier) @constant.builtin
|
||||
(#match? @constant.builtin "self"))
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "self"))
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
|
@ -232,8 +235,8 @@
|
|||
((class_definition
|
||||
body: (block
|
||||
(function_definition
|
||||
parameters: (parameters . (identifier) @constant.builtin))))
|
||||
(#vim-match? @constant.builtin "^(self|obj|cls)$"))
|
||||
parameters: (parameters . (identifier) @variable.builtin))))
|
||||
(#vim-match? @variable.builtin "^(self|obj|cls)$"))
|
||||
|
||||
;; Error
|
||||
(ERROR) @error
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
|
|
@ -100,7 +103,7 @@
|
|||
[
|
||||
(self)
|
||||
(super)
|
||||
] @constant.builtin
|
||||
] @variable.builtin
|
||||
|
||||
(method_parameters (identifier) @parameter)
|
||||
(lambda_parameters (identifier) @parameter)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue