Skip to content
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

Consider the auto-completion model used in elixir_ls #772

Closed
alanz opened this issue Jun 29, 2020 · 8 comments · Fixed by #1263
Closed

Consider the auto-completion model used in elixir_ls #772

alanz opened this issue Jun 29, 2020 · 8 comments · Fixed by #1263

Comments

@alanz
Copy link
Contributor

alanz commented Jun 29, 2020

See the description here

@maxnordlund
Copy link

Yes please. I always delete the arguments, because for some reason autocomplete doesn't trigger. But that might be a bug in VS Code, and I prefer to choose arity on the fly (if I want to add some options for example).

@robertoaloi
Copy link
Member

Hi @alanz since the description points to the whole changelog, may I ask you to formalize in this ticket the exact requirements?

@alanz
Copy link
Contributor Author

alanz commented Sep 28, 2020

@robertoaloi I agree. IIRC one of my colleagues suggested that we look at this, without anything specific.

I am happy to close it if no-one else has anything concrete to put in here.

@maxnordlund
Copy link

maxnordlund commented Sep 28, 2020

Instead of auto-completing with a snippet where the arguments are prefilled, leave empty places and let the user rely on auto-complete for the arguments. Also, always go for the highest arity since it easy to remove extra arguments, and at least I kinda forget which functions have an optional options argument.

Better?

@robertoaloi
Copy link
Member

Hi @maxnordlund , during auto-completion, if multiple arities are available for the same function name, all of them are proposed to the user. Arguments get expanded only after a specific arity is selected. I can see why the part about the function arguments can be annoying, I will check what I can do.

@robertoaloi
Copy link
Member

robertoaloi commented Dec 30, 2020

Actually, I double checked and the completions already use the snippet format. This means that the arguments can be navigated via TAB and the user can just type over, so no need to remove them. They are just placeholders.

@robertoaloi
Copy link
Member

I will close this for now as a won't do from my side, but please feel free to contribute if you'd like to change how the auto-completion model works.

@maxnordlund
Copy link

At least for me auto-completion doesn't trigger when overwriting snippet placeholders. Only if I exit the snippet mode (marked with an grey background for me) it starts working. That's why I would prefer to avoid using snippets if possible.

About suggesting multiple arities, the problem is that tabbing, in VS Code at least, selects the first alternative and switches to the snippet placeholders. Thus I can't actually select some other arity with tab, and must use arrow keys. Since lower arity goes first, I don't get the version with optional arguments.

By listing all arities one by one, it fills up/clutters the auto-complete list. I would prefer it to list each function name once, and indicate which arities are available, and prefer the highest arity when pressing tab.

If there were an option for disabling snippets, or perhaps not have placeholder names, just empty spaces foo(, , ,), that would be swell.

I've tried to read through the source, but it's all a bit too much for me. Otherwise I would have made a PR 🙂

the-mikedavis added a commit to the-mikedavis/erlang_ls that referenced this issue Apr 9, 2022
This commit prevents the completion provider from providing arguments
for functions/macros when an editor does not enable snippets. With
snippet support, arguments are useful because they can be tabbed between,
but for an editor which does not implement snippets, the generated
arguments are mostly a hassle: you have to move back to replace the
arguments.
robertoaloi pushed a commit that referenced this issue Apr 28, 2022
This commit prevents the completion provider from providing arguments
for functions/macros when an editor does not enable snippets. With
snippet support, arguments are useful because they can be tabbed between,
but for an editor which does not implement snippets, the generated
arguments are mostly a hassle: you have to move back to replace the
arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants