mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(highlights): improve member/property distinction
This commit is contained in:
parent
2f38c36294
commit
fa38f4e6f9
34 changed files with 106 additions and 95 deletions
|
|
@ -1,15 +1,15 @@
|
|||
class H {
|
||||
pub_field = "Hello";
|
||||
// ^ @property
|
||||
// ^ @variable.member
|
||||
|
||||
#priv_field = "World!";
|
||||
// ^ @property
|
||||
// ^ @variable.member
|
||||
|
||||
#private_method() {
|
||||
// ^ @function.method
|
||||
return `${this.pub_field} -- ${this.#priv_field}`;
|
||||
// ^ @property
|
||||
// ^ @property
|
||||
// ^ @variable.member
|
||||
// ^ @variable.member
|
||||
}
|
||||
|
||||
public_method() {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ pub type Cat {
|
|||
Cat(name: String, cuteness: Int)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^ @property
|
||||
// ^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @property
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @type.builtin
|
||||
// ^ @punctuation.bracket
|
||||
|
|
@ -20,11 +20,11 @@ fn cats() {
|
|||
Cat(name: "Nubi", cuteness: 2001)
|
||||
// <- @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^ @property
|
||||
// ^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @string
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @property
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @number
|
||||
// ^ @punctuation.bracket
|
||||
|
|
@ -47,7 +47,7 @@ type Box(inner_type) {
|
|||
Box(inner: inner_type)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^^ @property
|
||||
// ^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
|
|
@ -69,15 +69,15 @@ pub fn have_birthday(person) {
|
|||
// ^^ @operator
|
||||
// ^^^^^^ @variable
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @property
|
||||
// ^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @variable
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @property
|
||||
// ^^^ @variable.member
|
||||
// ^ @operator
|
||||
// ^ @number
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @property
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @boolean
|
||||
// ^ @punctuation.bracket
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ type int_array = array of int
|
|||
/* ^ @type.builtin */
|
||||
|
||||
type record = {a: int, b: string}
|
||||
/* ^ @property */
|
||||
/* ^ @variable.member */
|
||||
/* ^ @type.builtin */
|
||||
/* ^ @property */
|
||||
/* ^ @variable.member */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
var record := record {a = 12, b = "27"}
|
||||
/* ^ @variable */
|
||||
/* ^ @type */
|
||||
/* ^ @property */
|
||||
/* ^ @property */
|
||||
/* ^ @variable.member */
|
||||
/* ^ @variable.member */
|
||||
|
||||
var array := int_array[12] of 27;
|
||||
/* ^ @variable */
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ let
|
|||
/* ^ @keyword.operator */
|
||||
in
|
||||
object.a := 27;
|
||||
/* ^ @property */
|
||||
/* ^ @variable.member */
|
||||
|
||||
object.meth()
|
||||
/* ^ @function.method */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
test1.test2.test3();
|
||||
// <- @variable
|
||||
// ^ @property
|
||||
// ^ @variable.member
|
||||
// ^ @function.method.call
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue