Skip to content

Improve highlighting around self/super#91

Open
YuriSizov wants to merge 1 commit into
GDQuest:mainfrom
YuriSizov:super-self
Open

Improve highlighting around self/super#91
YuriSizov wants to merge 1 commit into
GDQuest:mainfrom
YuriSizov:super-self

Conversation

@YuriSizov

Copy link
Copy Markdown
Contributor

Please check if the PR fulfills these requirements:

  • The commit message follows our guidelines.
  • For bug fixes and features:
    • You tested the changes.

What kind of change does this PR introduce?

This changeset improves highlighting for special GDScript identifiers super and self, at least for the cases now added to the test script. Previous implementation was unsatisfactory in terms of catching some of these cases, and on top of that, since #76, the highlighting was using a tag not present in current Zed themes, at least official ones (@variable.language).


As an extra, this change moves highlighting for base_call from @function.builtin to the basic @function.method. Base calls aren't really any different from method calls, and the built-in highlighting is better reserved for things like super here.

Also, I don't think it's possible to get base_call from the tree-sitter here, since it targets specifically the Godot 3 version of these calls, before super was introduced. I wasn't able to find a way to get it at least. Here's an example from the tree-sitter docs, and this syntax is invalid in Godot 4's version of GDScript:

=====================================
Base Calls
=====================================

.hello()
var x = .hello()
var x = hello(.hello())

---

(source
  (expression_statement (base_call (identifier) (arguments)))
  (variable_statement (name) (base_call (identifier) (arguments)))
  (variable_statement
    (name)
    (call (identifier) (arguments (base_call (identifier) (arguments))))))

=====================================

PS. I've made these changes some weeks ago at this point, so memory is a bit murky about their completeness. But I've been using my local dev version of the extension this whole time and that's probably sufficient testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant