Align queries with 'nvim-treesitter'
Some checks failed
ci/woodpecker/push/check Pipeline failed

I fear the upstream queries may be broken, somehow, as they don't work
with `--apply-all-captures` which should match the "last query wins"
matching behaviour of `nvim-treesitter`.

I also removed `locals.scm`, as `tree-sitter` and `nvim-treesitter` don't
agree on how to write it, and I don't really care about it.

It does mean that the highlights can't tell the difference between `int`
the built-in and `int` the type alias anymore, but that's a small
edge-case (and `nvim-treesitter` didn't support it anyway).
This commit is contained in:
Bruno BELANYI 2025-03-13 21:36:13 +00:00
parent ff1535431b
commit e7a123141f
11 changed files with 149 additions and 149 deletions

View file

@ -6,7 +6,7 @@ let
/* ^ type.builtin */
var b := exit(0)
/* ^ function */
/* ^ function.builtin */
type int = string /* Shadowing the built-in type */
/* ^ type.builtin */
@ -30,13 +30,13 @@ in
end;
exit(1);
/* <- function */
/* <- function.builtin */
print("shadowing is fun");
/* <- function.builtin */
self;
/* <- variable */
/* <- variable.builtin */
b := print
/* ^ variable */

View file

@ -1,8 +1,8 @@
primitive print(s: string)
/* ^ function */
/* ^ parameter */
/* ^ variable.parameter */
function func(a: int) : int = (print("Hello World!"); a)
/* ^ function */
/* ^ parameter */
/* ^ function */
/* ^ variable.parameter */
/* ^ function.builtin */

View file

@ -6,24 +6,24 @@ 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 */
/* ^ type */
primitive func(a: int, b: string) : array
/* ^ parameter */
/* ^ variable.parameter */
/* ^ type.builtin */
/* ^ parameter */
/* ^ variable.parameter */
/* ^ type.builtin */
/* ^ type */

View file

@ -1,3 +1,3 @@
import "lib.tih"
/* <- include */
/* <- keyword.import */
/* ^ string.special.path */

View file

@ -10,7 +10,7 @@ let
/* <- keyword.function */
import "lib.tih"
/* <- include */
/* <- keyword.import */
type array_of_int = array of int
/* <- keyword */

View file

@ -1,11 +1,11 @@
let
class A extends Object {}
/* <- keyword */
/* <- keyword.type */
/* ^ keyword */
/* ^ type.builtin */
type B = class extends A {
/* ^ keyword */
/* ^ keyword.type */
/* ^ keyword */
/* ^ type */
@ -13,16 +13,16 @@ let
method meth() : int = self.a
/* <- keyword.function */
/* ^ method */
/* ^ function.method */
/* ^ variable.builtin */
}
var object := new B
/* ^ keyword.constructor */
/* ^ keyword.operator */
in
object.a := 27;
/* ^ property */
/* ^ variable.member */
object.meth()
/* ^ method */
/* ^ function.method */
end