-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete in wrong format (extraneous quotes and parentheses added) #142
Comments
It looks like the language server is causing this by returning faulty [
// client request
{
"jsonrpc": "2.0",
"id": 61,
"method": "completionItem/resolve",
"params": {
"label": "\"ui_down\"",
"insertTextFormat": 1,
"kind": 2,
"data": {
"position": { "character": 30, "line": 27 },
"textDocument": {
"uri": "file:///c%3A/Users/Mick/Documents/Godot/Dodge%20the%20Creeps%20-%20TEST/Player.gd"
}
}
}
},
// server response
{
"id": 61,
"jsonrpc": "2.0",
"result": {
"command": { "command": "", "title": "" },
"data": {
"context": null,
"position": { "character": 30, "line": 27 },
"textDocument": {
"uri": "file:///c%3A/Users/Mick/Documents/Godot/Dodge%20the%20Creeps%20-%20TEST/Player.gd"
}
},
"deprecated": false,
"detail": "",
"documentation": { "kind": "markdown", "value": "" },
"filterText": "",
"insertText": "\"ui_down\"(", // <--- this has extra double quotes and opening parenthesis
"kind": 2,
"label": "\"ui_down\"",
"preselect": false,
"sortText": ""
}
}
] |
So far this fixes the `(` being inserted in godotengine/godot-vscode-plugin#142 and also the extra quotes, but only if completion is trigged by the quote key. It does not yet fix godotengine/godot-vscode-plugin#184 because the third param to `connect()` actually is a method. We need more context to be able to determine whether or not to add parentheses.
I spent a few hours last night and this morning trying to fix this and #184. I got it working partially, but only under some circumstances. Unfortunately I am out of my depth, having never used C++ or looked at the Godot source before. I hope somebody more familiar with both finds this info useful. To summarize, the issue originates in the language server module of Godot, not the vscode plugin, and the opening parenthesis and the extra quotes have two different causes (but potentially the same solution). The parameter of The extra quotes are caused by the completion item The commit mickdekkers/godot@9c91664 is as far as I got with fixing these issues, but for fixing the quotes especially I'm not sure it's the right approach. Ideally the completion code would look at the characters around the cursor position and use that context to determine whether or not to add parentheses or extra quotes. Unfortunately the source code is not available inside of the handler for I think in order to fix these issues "properly", they will need to be fixed in the What complicates things is that the handler for
I don't know enough about the project to judge what moving this code to the |
I am being affected by this and would like to fix it. Who should I get in touch with if I need help? (I haven't worked on a language server before) |
There is still this bug, so there is still no fix for this problem? |
This is actually a bug in the language server, not in the extension: #142 (comment) There's no definitive fix for this bug yet though. |
2022-04-29.11-08-46.mp4same here |
@Calinou is it reported in the main Godot repo? |
Therefore, this issue can be closed as it's not specific to this VS Code extension. |
The prompt shows like below.
But when i strike the Tab key, the autocompletion is wrong.
I am using Godot 3.2, Windows 10, vscode 1.42.1
The text was updated successfully, but these errors were encountered: