godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.47k stars 148 forks source link

Dollar-sign shorthand for get_node() inserts extra set of quote marks #644

Open Meorge opened 2 months ago

Meorge commented 2 months ago

Godot version

v4.3.dev5.official [89f70e98d]

VS Code version

1.88.0

Godot Tools VS Code extension version

2.0.0

System information

macOS Sonoma 14.4.1

Issue description

When a node's name has a space in it, quote marks need to be used for the $ shorthand for the get_node() function. The autocomplete doesn't appear to recognize when the user has already added the quote marks, so when the user applies the autocomplete suggestion, they end up with two sets of quote marks.

In this example GIF, my node's name is "Damage Sound", and thus I want to type $"Damage Sound". I start by typing $"Dama, the autocomplete suggests "Damage Sound", so I confirm it, but then I end up with $""DamageSound"" which is invalid.

godot-tools bug - double quotes

Steps to reproduce

In Godot, create a node whose name has a space in it.

Create a script on the parent node, and open it in VS Code. In a function, type $" and then start typing the name of the node with the space. The autocomplete should suggest the node's full name in quotes. Accept the suggestion.

The name with a new set of quote marks should be placed in the cursor's position. The set of quotes added by the autocomplete do not replace the set added by the user, resulting in two pairs of quotes surrounding the node name.

DaelonSuzuka commented 2 months ago

This is not a problem with the extension. All the completions are provided by the language server, which is a component of the engine. The extension just displays/inserts the results it's given. You should open an issue on the Godot engine.

Meorge commented 2 months ago

Thank you for the clarification - I will try to do that later today! :)

DaelonSuzuka commented 2 months ago

Good luck, I would love to see this issue get fixed!

Basically all completions involving quotes are messed up. Signal names, NodePaths, etc.

Meorge commented 2 months ago

Looks like there's already an issue open for it: https://github.com/godotengine/godot/issues/86488

I'll add my info to that post - thanks again!

Meorge commented 2 months ago

Sounds like I am back here, unfortunately... In that issue, I asked about it and provided an example, and the response I got was

The suggestion of quote seems not provided by Godot LSP. Godot LSP not remember what you typed before. The quote one look like the VSCode's record.

Perhaps the language server returns the string Node With Spaces, and VS Code recognizes the string itself has spaces so it adds the quotes, making it "String With Spaces", before allowing the extension to handle it? I just tested it in Godot's built-in editor, and the issue does not occur there:

https://github.com/godotengine/godot-vscode-plugin/assets/9957987/bf25a43f-eacd-41c6-8ad5-9de1ec95d23c

DaelonSuzuka commented 2 months ago

Hey, thanks for bringing that info back here. I'll check the messages received from the LSP and try to see exactly what's happening.

ItsTeccs commented 4 weeks ago

Still experiencing this bug on V2.0.0 of the VSCode extension, with Godot v4.2.2 on Windows.