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
x/tools/gopls: option to autocomplete function call without parentheses #41813
Comments
@HymanZHAN thanks for the feature request. This is about adding a new knob for gopls' autocompletion behavior, so I will transfer this to its issue tracker. (cc @stamblerre ) |
@hyangah Thanks! |
If you disable snippets in your editor then you won't get the parens anymore (but will lose other snippet dependent functionality). Why don't the other languages include parens when completing function calls? I can appreciate not being used to it, but it objectively saves keystrokes. |
@muirdm My personal experience actually speaks otherwise. Including parens (and the input inside parens) as snippets does save the keystroke of Also, it's way easier to mishit Tab and exit the snippet accidentally in the middle of typing, as I tend to hit Tab for autocompletion (even though it's not there). I also use an extension called TabOut, which lets you skip closing characters like BTW, my favorite snippet implementation is actually the one of Visual Studio, where you can use Tab to loop through all snippet input space holders, modify previous input, have automatically autocompletion and use Enter to finish the snippet. Sadly that's not how VS Code implements it. |
I have my editor set up where I do get automatic completions inside the snippet. After inserting a snippet, it automatically triggers a completion at the first placeholder. I can accept it right away (and overwrite the placeholder), or simply start typing to filter completions. I press TAB to choose the inner completion, then TAB again to advance to the next outer placeholder. I definitely agree that nested completion/snippets is finicky, but I think most of that is just editors not doing it well by default. |
I just encountered this for the first time (long-time non-gopls user who upgraded recently due to modules) and was also surprised that there's no option to turn it off. I don't like autocompletion of anything other than function names in general, and disable bracket completion whenever I have the chance. Like the original reporter, I find that bracket insertion usually increases my keystrokes. Thanks for the tip about disabling snippet insertion, I will try that as an interim fix and hope that it doesn't break anything else. |
(This is more of a question before it becomes a feature request. However, the original Slack invite link is no longer active.)
Is your feature request related to a problem? Please describe.
Is it possible to leave out the parentheses of a method when doing autocompletion? For example, when typing
time.No
and hit tab, instead of autocompleting withtime.Now()
is it possible to complete it astime.Now
?Describe the solution you'd like
Have an option for this, something like
gopls.includeParenthesesWhenAutocomplete
that can be set tofalse
.Describe alternatives you've considered
N/A
Additional context
I have been writing a mix of C++, Python, and JS/TS, and all these languages' autocompletion on VS Code are without the parentheses. It's muscle memory for me now to reach for
(
after completing the method and it's really counter-productive especially when I need to switch between languages.The text was updated successfully, but these errors were encountered: