Closed witnessmonolith closed 9 months ago
Already fixed in #545.
I just merged #545, so if you redownload the dev build this should be fixed.
Updated my local main branch and rebuilt the extension using the npm run package
.
At the commit 98aa85e (#556) after the #545 merge the problem still persists. Same goes for the build available on the GitHub.
Now the as
keyword doesn't get highlighted.
And the line in question is still formatted incorrectly.
source line:
@onready var score := $HBoxContainer/Score as Label
unquoted version formatting:
@onready var score := $HBoxContainer/ScoreasLabel
quoted version formatting:
@onready var score := $"HBoxContainer/Score"as Label
Thanks for reporting back. The unquoted $Node shorthand is one of the hardest things to parse correctly in the entire language. Thankfully we have a brand new test suite we can add these cases to.
I'm surprised the one with quotes is misbehaving, though...
Fixed in #559.
For some reason I can't fetch the branch with the fix, so I guess I'll wait for it to be properly merged. Thanks for the update!
@witnessmonolith Sorry about that, #559 is merged now. Please let me know if that fixes your issue.
Checked out the latest main branch, and it seems like the issue is no more, thanks!
Awesome, thanks for confirming!
Godot version
4.1.3
VS Code version
1.85.1
Godot Tools VS Code extension version
2.0.0 dev build (ec1d9c3)
System information
Windows 11
Issue description
Formatter ruins code by wrongly removing a white space after
get_node()
shorthand ($
) and before the cast keyword (as
) while trying to format this GDScript code:the line in question is
after formatting the whitespace between "Score" and "as" is gone and the code becomes broken:
If the quoted version of the 'get_node' shorthand is used, the white space before
as
keyword still gets trimmed:Steps to reproduce
@onready var score := $HBoxContainer/Score as Label