-
Notifications
You must be signed in to change notification settings - Fork 645
Autocompletion in declaration comment should suggest nearest declaration before others #1005
Comments
@atombender What you see being suggested in the comments is word based completion (coming from VS Code core and not the Go extension) that has no knowledge of the language semantics. What you are saying can be achieved if the Go extension itself figures out the right completion. Since the Go extension uses This will also be easy to implement by a language server, which makes me think I should have a new label called "language-server-candidate" :) |
When we do have a stable language server to use and which implements code completion, we can add this feature to then. |
Thanks, I created an issue. |
If anybody wants to give this a try from the Go extension's side, here are a few pointers
|
I am getting familiar with the if (lineText.match(/^\s*\/\//)) {
let nextLine = document.lineAt(position.line + 1).text;
let part0 = nextLine.split(" ");
if (!part0[1].match(/^[A-Z]/)) {
return resolve([]);
}
}
Questions:
|
No
Pointer to existing test for completion that you can use as reference: https://github.com/Microsoft/vscode-go/blob/0.6.78/test/go.test.ts#L747 You can add another test file to https://github.com/Microsoft/vscode-go/tree/0.6.78/test/fixtures/completions for your case and test it
When splitting text, keep in mind that there can be multiple spaces before the first word and between subsequent words |
Thank you! |
This feature is now out in the latest update to the Go extension (0.6.81) |
If I'm writing a comment for a declaration, I expect the struct to be the first thing suggested (and I swear this used to be the case, too):
I would expect autocompletion here to offer
HTTPResponseError
as the first option if I started typing. But I'm getting other suggestions at the top of the list:The text was updated successfully, but these errors were encountered: