I always wondered what is supplying func as a completion suggestion after typing func
which I rarely end up selecting. Looking at golang/vscode-go#3144,
I finally bothered to check it, and obviously, it was gopls.
[Trace - 16:54:46.674 PM] Received response 'textDocument/completion - (260)' in 81ms.
Result: {"isIncomplete":true,"items":[
{"label":"func","kind":14,"documentation":{"kind":"markdown","value":""},"preselect":true,"sortText":"00000","filterText":"func","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":0},"end":{"line":16,"character":4}},"newText":"func"}},
{"label":"functional","kind":9,"detail":"\"github.com/vmware/govmomi/test/functional\"","documentation":{"kind":"markdown","value":""},"sortText":"00001","filterText":"functional","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":0},"end":{"line":16,"character":4}},"newText":"functional"},"additionalTextEdits":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"newText":"(\n\t"} ...
If clients can handle snippets, and gopls is relatively sure that the user is about to type func F() {} (e.g. there is no following character in the same line, etc), is it better to provide longer snippets?
Similarly, I type c, gopls suggests const as the first candidate. If that's what I really intended, couldn't gopls even go further and place a space and move my cursor to define a const var rather than just stopping at const and letting me type space after accepting the keyword?
I always wondered what is supplying
funcas a completion suggestion after typing funcwhich I rarely end up selecting. Looking at golang/vscode-go#3144,
I finally bothered to check it, and obviously, it was
gopls.If clients can handle snippets, and gopls is relatively sure that the user is about to type
func F() {}(e.g. there is no following character in the same line, etc), is it better to provide longer snippets?Similarly, I type
c, gopls suggestsconstas the first candidate. If that's what I really intended, couldn't gopls even go further and place a space and move my cursor to define a const var rather than just stopping atconstand letting me type space after accepting the keyword?