godot-vscode-plugin
godot-vscode-plugin copied to clipboard
Dollar-sign shorthand for get_node() inserts extra set of quote marks
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.
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.
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.
Thank you for the clarification - I will try to do that later today! :)
Good luck, I would love to see this issue get fixed!
Basically all completions involving quotes are messed up. Signal names, NodePaths, etc.
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!
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
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.
Still experiencing this bug on V2.0.0 of the VSCode extension, with Godot v4.2.2 on Windows.
Is there any update or progress about these issues ?
I'm experiencing it with the latest version (V2.0.0) of the extension and Godot 4.2.1 on Windows.
It's actually up when I use the event.is_action_pressed() function, the parameter must be a string but when use ", select the action name, I end up with this event.is_action_pressed(""actionName"" double " for no apparent reasons.
It's also weird that none of the functions add a closing brackets automatically, I only have an opening one. It makes the documentation bubbles have strange behavior like popping on my working line, or just pop when I close the bracket (so when I don't need it anymore).
Hope someone could find a solution about these issues.
Is there any update or progress about these issues ?
https://github.com/godotengine/godot/pull/87508 should fix this issue. Can you test it locally?
Just tested this fix with VS Code and unfortunately it doesn't appear to have fixed my original issue, at least.
https://github.com/user-attachments/assets/71ce5fb1-623a-4966-a31e-e688f72d76c1
If you'd like me to I can certainly add this comment to the PR itself, but based off of the previous messages it sounded to me like the bug might be more on the VS Code plugin side, rather than the Godot side (since this issue didn't happen in Godot's script editor), so I thought it would make more sense to have here.
I've tested, it works for Godot 4.3 (the latest master branch) in local but I can't build the 4.2 branch in local for testing, I don't know why. Hope your fix will be added in a stable version of the 4.2 to help me (I need the C# support that the 4.3 can't do).