PrestonKnopp / tree-sitter-gdscript

Tree sitter grammar for Godot's GDScript
https://www.npmjs.com/package/tree-sitter-gdscript
MIT License
50 stars 11 forks source link

Support for gdscript 2 #9

Closed Cretezy closed 9 months ago

Cretezy commented 1 year ago

Godot 4 comes with gdscript 2. I've experience some ERROR nodes with the current version.

Specifically:

It's possible there's more, these are just the ones I've found.

image image image

Cretezy commented 1 year ago

Opened a PR for most of this support: https://github.com/PrestonKnopp/tree-sitter-gdscript/pull/10

Missing in PR:

Cretezy commented 1 year ago

@PrestonKnopp Maybe we can keep this open as it's not fully resolved, unless you planned on making separate issues for annotations and setters/getters.

PrestonKnopp commented 1 year ago

Yeah I'll add on to this.

PrestonKnopp commented 1 year ago

Annotations from what I can tell have the following grammar:

argument_list: "(" (expression ("," expression)* )? ")"
annotation: "@" identifier argument_list?
A-Lamia commented 1 year ago

Is there being no support for GD2 causing highlights to not work ?

As I'm having no highlighting and seems to be support for tool but im getting errors on the @. image

When i check it says identifier has no highlight group set it's like that for a lot of things but i can see the node named and selecting correctly in TSPlayground.

PrestonKnopp commented 1 year ago

Yes that is correct. The only support for GD2 is from Cretezys PR (#10). I'll have to set aside some time to work on this this weekend.

PrestonKnopp commented 1 year ago

Tests are passing, but haven't tested it in an editor yet.

A-Lamia commented 1 year ago

Highlighting is incorrect when just setting get

image

PrestonKnopp commented 1 year ago

@A-Lamia, Thanks! Should now be fixed in 02a8990.

A-Lamia commented 1 year ago

Seems to be a highlight issue when a variable is declared right after a lambda: image

PrestonKnopp commented 1 year ago

Okay, lambda parsing appears reliable enough for general use. There's many edge cases so issue reports are very welcome. Main commits for lambda: 1bf83db, 49b138c, dcd1eb0, and a254369.

Also added some other GDScript 2 things such as:

PrestonKnopp commented 9 months ago

Closing, AFAICT, tree-sitter-gdscript as of v1.9.0 is synced with the latest godot gdscript commit noted in the readme.

New issues are welcomed.