diff --git a/queries/highlights.scm b/queries/highlights.scm index 66130bf..cadeed7 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -7,6 +7,10 @@ ((type_identifier) @type.builtin (#match? @type.builtin "^(int|string|Object)$") (#is-not? local)) + +((identifier) @variable.builtin + (#match? @variable.builtin "^self$") + (#is-not? local)) ; }}} ; Keywords {{{ diff --git a/test/highlight/built-ins.tig b/test/highlight/built-ins.tig index 9fe0487..6879054 100644 --- a/test/highlight/built-ins.tig +++ b/test/highlight/built-ins.tig @@ -18,6 +18,8 @@ let /* ^ type.builtin */ type Object = int + + var self := "self" in let var c : int := "This is an int" @@ -33,6 +35,9 @@ in print("shadowing is fun"); /* <- function.builtin */ + self; + /* <- variable */ + b := print /* ^ variable */ end diff --git a/test/highlight/object-oriented.tig b/test/highlight/object-oriented.tig index 79928bb..930eabf 100644 --- a/test/highlight/object-oriented.tig +++ b/test/highlight/object-oriented.tig @@ -14,7 +14,7 @@ let method meth() : int = self.a /* <- keyword.method */ /* ^ method */ - /* ^ variable */ + /* ^ variable.builtin */ } var object := new B