diff --git a/data/parsing_test.gd b/data/parsing_test.gd index 568ce25..ce75008 100644 --- a/data/parsing_test.gd +++ b/data/parsing_test.gd @@ -15,13 +15,21 @@ var setget_property: float = 3.2: func _init() -> void: - pass + super() + super.other() + self.property.x = 20 + method_call(self) + func _process(delta: float) -> void: position += velocity * delta rotation = velocity.angle() +func _not_implemented() -> void: + pass + + class InnerClass extends RefCounted: func _init(arg: int) -> void: pass diff --git a/languages/gdscript/highlights.scm b/languages/gdscript/highlights.scm index 90b3803..685373a 100644 --- a/languages/gdscript/highlights.scm +++ b/languages/gdscript/highlights.scm @@ -3,6 +3,9 @@ ; but a = 10 has 'a matching nothing. ; This is to keep consistency, and is like 'text_editor/theme/highlighting/text_color' in Godot Editor Settings (identifier) @variable +; Self reference in class. +((identifier) @variable.builtin + (#eq? @variable.builtin "self")) ; Class @@ -12,8 +15,16 @@ ; Function calls (attribute_call (identifier) @function.method) -(base_call (identifier) @function.builtin) +(base_call (identifier) @function.method) (call (identifier) @function) +; Super calls have two forms: +; - super() to call this method's parent implementation, +; - super.other() to call another method's parent implementation. +((identifier) @function.builtin + (#eq? @function.builtin "super")) +(call (identifier) @function.builtin + (#eq? @function.builtin "super")) + ; Setget (setget @@ -221,9 +232,6 @@ "extends" ] @keyword -((identifier) @variable.language - (#match? @variable.language "^(self|super)$")) - ; Identifier naming conventions ; This needs to be at the very end in order to override earlier queries