godotengine / godotengine/godot-vscode-plugin

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

Open
#644 11 comments 2 reactions 0 assignees View on GitHub
bug confirmed language server
Dominant language
TypeScript
Stars
2.1k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

### 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](https://github.com/godotengine/godot-vscode-plugin/assets/9957987/a0e39915-81b8-4da4-bc1b-a2becddbac89)

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.