godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

autocomplete missing closing parenthesis #454

Closed doman412 closed 5 days ago

doman412 commented 1 year ago

Godot version

v4.0.rc1.official [8843d9ad3]

VS Code version

1.75.0

Godot Tools VS Code extension version

1.3.1

System information

macOS 13.2 (22D49)

Issue description

When using autocomplete to complete methods on objects, only 1 parenthesis is created. It should either create none (the preferred action) or both with the cursor in the middle. The default behavior for JS in vscode is to not create parenthesis, just simply complete the function name. Perhaps a config can be used to allow users to do one or the other, but only inserting 1 open parenthesis without closing it is odd behavior.

Steps to reproduce

Start typing a method name after a . on an object variable, press enter to select the method you want completed.

https://user-images.githubusercontent.com/3157204/218285146-e8e848df-f7c0-414f-876c-d90181593c21.mov

DaelonSuzuka commented 1 year ago

This needs a lot more testing, but I just finished a proof-of-concept of intercepting and modifying the messages received from the language server.

This attempts to be context aware by checking the next character after the cursor and using that to decide whether it should add a closing paren or remove the trailing open paren.

Code_TvuwDudtAY

Goldenlion5648 commented 4 months ago

@DaelonSuzuka did you happen to get around to testing more? It would be great if your fix could be merged. This bug really slows me down since the hint popup doesn't show until I delete the single auto typed parenthesis and type it again.

I'm willing to test your change if needed

DaelonSuzuka commented 4 months ago

Unfortunately that idea was a dead end. I agree this is a very annoying issue.

I'll try to remember to take another look at this when I have the time.

MichaelGame-Dev commented 4 weeks ago

Experiencing this as well on Linux. i thought it may be related to vim mode, but I guess not.

DaelonSuzuka commented 5 days ago

Closing this due to age + the fact that the problem is in Godot's Language Server, not this extension.