Fix #307: Use and document TSVariable/TSVariableBuiltin in all languages

This commit is contained in:
Stephan Seitz 2020-09-12 20:57:01 +02:00 committed by Thomas Vigouroux
parent 50991e370b
commit bcf421b4e7
10 changed files with 39 additions and 8 deletions

View file

@ -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*

View file

@ -1,3 +1,5 @@
(identifier) @variable
[
"const"
"default"

View file

@ -1,3 +1,4 @@
(identifier) @variable
(method_declaration
name: (identifier) @method)

View file

@ -77,7 +77,7 @@
; Constants
(this) @constant.builtin
(this) @variable.builtin
(nullptr) @constant
(true) @boolean

View file

@ -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

View file

@ -2,6 +2,10 @@
; Javascript
; Variables
;-----------
(identifier) @variable
; Properties
;-----------

View file

@ -91,6 +91,9 @@
"}"
] @punctuation.bracket
;; Variables
(identifier) @variable
;; Constants
[
(false)

View file

@ -1,3 +1,7 @@
; Variables
(variable_name) @variable
; Types
[

View file

@ -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

View file

@ -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)