-
Notifications
You must be signed in to change notification settings - Fork 659
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
Feature request: Offer declaration name as autocompletion when writing GoDoc comment #454
Comments
FTR: Ctrl-N in Vim. |
Gocode actually tries to perform autocompletion even if you are in a comment section. But many editors block autocompletion request in this scenario. If that's what you want, I can't help you, ask editor plugin authors. If you want some additional logic for entity comment specifically, not sure about that. |
VSCode does show completions, but it doesn't show the right completion. For example, if I have this: type Something struct {}
type SomethingElse struct {}
// S<caret>
type SomethingElseEntirely struct {} It would be greatly appreciated if the first completion offered is Even when I am more specific, the order is not helpful: |
Sorry I won't implement it. It's up to user what he puts in the comment. Having autocompletion like that would encourage stub comments (it's so easy to just press ctrl+space or whatever the key is). I think some of the go linters insist on comments like these - very bad idea. Also what I see in your screenshots is generic plain text autocompletion by vscode, I assume it falls back to text autocompletion when you're in a comment. I think it's an okay idea to do so. But again, if you were using gocode here it would only suggest the actual language entites (types, vars, funcs, etc). Gocode is not responsible for all autocompletion in your editor, it only does Go code analysis, but often text editors mix in different completion providers like in this case. Autocompletion suggestions are marked with "abc" logo for a reason, it's a sign of plain text autocompletion. Gocode simply cannot do text-based autocompletions, there is no code which would lead to that kind of result. |
Sounds like VSCode should specifically have an autocompleter heuristic that looks if you're at the start of a GoDoc declaration comment, and if so, look for the next declaration. I don't know enough about VSCode's internals, nor about gocode, to say where the missing functionality needs to go.
I don't see why. The only point is to allow me to quickly complete the name of the thing I'm writing a comment for; the whole point of autocompletion is to automate work. It's my own responsibility to write a good comment. |
Consider that you're writing this in some editor:
The autocompletion at this point should offer
Something
as the top choice, since you're writing a GoDoc comment about this particular declaration. This ought to be the behaviour for any GoDoc comment.The text was updated successfully, but these errors were encountered: