godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.52k stars 149 forks source link

Multiple highlighting improvements #506

Closed DaelonSuzuka closed 10 months ago

DaelonSuzuka commented 10 months ago
AlfishSoftware commented 10 months ago

Will this fix the lambda_declaration rule? Because I was getting support.function.any-method.gdscript (method color) for func in func(): ... instead of storage.type.function.gdscript (keyword color).

AlfishSoftware commented 10 months ago

Is r"..." actually valid syntax in GDScript? I tested in Godot 3 and 4 script editors and neither is accepting it. It's also not listed here.

DaelonSuzuka commented 10 months ago

Is r"..." actually valid syntax in GDScript?

https://github.com/godotengine/godot/pull/74995

AlfishSoftware commented 10 months ago

Is r"..." actually valid syntax in GDScript?

godotengine/godot#74995

Ah I see, so it's a new feature.

"escaping" in r-strings exists, but the sequences are escaped into themselves

I've never used this r-string before, but if I understood correctly, it seems some care needs to be taken about the internal patterns, because I believe nothing inside should be colored like an escape character. It would probably need a separate rule(s). Otherwise it can be misleading and people won't understand the difference in the syntax.

For example, in r"\"" both the \ and the " are part of the string, even though " won't close it when preceded by \. So it should look like the image in this comment in those tests: r-string coloring

DaelonSuzuka commented 10 months ago

r-string stuff

Makes sense. I was just making sure they were highlighted at all.

screenshot

Wait a second, are triple single quotes valid in Godot 4? IIRC they're illegal in Godot 3 and I have them marked as such.

DaelonSuzuka commented 10 months ago

Will this fix the lambda_declaration rule? Because I was getting support.function.any-method.gdscript (method color) for func in func(): ... instead of storage.type.function.gdscript (keyword color).

This is what I'm currently seeing:

image

image

AlfishSoftware commented 9 months ago

How strange ... this is what I'm getting (both when Godot is connected or disconnected). lambda_declaration rule issue screenshot I'm on geequlim.godot-tools v1.3.1 on VSCodium v1.84.2 I've also disabled all other godot-related extensions (to make sure mine wasn't interfering somehow), same result.

DaelonSuzuka commented 9 months ago

I think I took those screenshots with this PR, not 1.3.1. Would you mind checking with master to make sure that this is working correctly for you?

(both when Godot is connected or disconnected)

Why would this matter?

atirut-w commented 9 months ago

Why would this matter?

I think LSP can affect some highlighting behaviour IIRC

DaelonSuzuka commented 9 months ago

It could, if the Godot LSP supported semantic tokenization, but it doesn't.

Calinou commented 9 months ago

Wait a second, are triple single quotes valid in Godot 4? IIRC they're illegal in Godot 3 and I have them marked as such.

Triple single quotes for multiline strings have always been allowed, even in Godot 1.0.

DaelonSuzuka commented 9 months ago

Wait a second, are triple single quotes valid in Godot 4? IIRC they're illegal in Godot 3 and I have them marked as such.

Triple single quotes for multiline strings have always been allowed, even in Godot 1.0.

For some reason, 2 years ago I thought it wasn't. Maybe I wrote a python-style docstring, got an error, and assumed, who knows?

Either way I've fixed it now.