-
Notifications
You must be signed in to change notification settings - Fork 196
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
Improve UX on autocomplete and signature info #251
Comments
Wow, there's a bunch of great suggestions here!
I think this these suggestions are great. I was a little hesitant about swapping the summary and the
I think changing the initially displayed panel makes sense given the very small width of the autocomplete window (although I wish it would be improved, and there is an upstream issue for that microsoft/vscode#29757). I'm not convinced on the specific format that you've chosen (in particular the I think my ideal would be to display I think we should further discuss the specific changes for this in a new issue
I am definitely agreed on removing any optional arguments from being inserted, but I'm not as sure about non-optional arguments. Part of the reason for that is that not all clients will have as nice signature info help as VSCode, perhaps this could be made configurable via #226 (which I almost have a PR ready for).
Pretty much agreed, although I'd want to play with it before removing them completely. From the list I'm pretty sure that I'd want to keep |
Re:
https://hexdocs.pm/ex_doc/changelog.html#v0-22-0-2020-05-11
|
Great work! For reference, I still think atom-elixir’s autocomplete is the best I’ve used (thank you too). Not sure if reproducible in VS Code. Here’s why it works for me,
Horizontal boxes seem to be one CSS property away. microsoft/vscode#29757 (comment) |
Atom used to allow that but VS code, unfortunately, doesn't. As far as I know, It will automatically add whatever comes first only when the side box is not showing. That's why I placed that info at the beginning. Regarding the It would be perfect if the format was more like the Elixir docs: Unfortunately, it's not. Open for suggestions here.
We can create a configuration then. We could even have 3 options if you like:
|
@jayjun yeah, that's gorgeous! I'm really proud to have achieved that in Atom. Unfortunately, VS Code is a pain when it comes to customizing its styles. Currently, we cannot do anything about the size of the windows, the colours nor the font sizes. BTW, is that Atom plugin still working? I haven't done any improvement since I moved to VS Code. Has anyone forked and kept it alive? |
Great work @msaraiva. Here's my small comments
👍
It may be not possible/easy if the spec is taken from the docs. For erlang modules the spec is going to be in erlang. It's worth checking how ex_doc handles it.
👍
It's already happening for 0-arity functions
I'm totally in favour. It also was on my TODO list
I'm not sure about that. I find |
@msaraiva I’m the guy who ported it to JavaScript if you remember 😄 msaraiva/atom-elixir#73. I did publish a fork but Atom wasn’t too happy it was the “same” package. Regardless, I moved to VS Code shortly after. |
Hi @lukaszsamson! Thanks for the feedback.
Nice reminder! I believe we can solve this by checking the type of the module (erlang vs elixir) where the function was originally defined. We already send that information from ElixirSense.
Personally, aside from the @keywords %{
"end" => "end",
"do" => "do\n\t$0\nend",
"true" => "true",
"false" => "false",
"nil" => "nil",
"when" => "when",
"else" => "else\n\t$0",
"rescue" => "rescue\n\t$0",
"catch" => "catch\n\t$0",
"after" => "after\n\t$0"
} which is always added to the suggestions list except when you already have a non-matching prefix. As you can see, they don't do anything special like showing docs or specs. Besides, what's the point in auto-completing such basic short keywords like As for So my suggestion would be to keep only The suggested changes are the first batch of many others that I have in mind to make the list of suggestions more useful to the user. The other, much more important change I'm working on right now, is refactoring |
@axelson @lukaszsamson while developing elixir-lsp/elixir_sense#99, I had the opportunity to play with the auto-complete behaviour in VS Code and could confirm that the |
* Remove keywords from completions They were being returned regardless of context which made them very noisy. Related: * elixir-lsp/elixir_sense#99 * #251 * Add changelog entry * Return isIncomplete = true for completions * Fix tests and add a couple.
This was addressed in #259. Any further improvements can be discussed in a new issue. |
Following #241, I've been working on some other improvements regarding UX. Most of them have been in my TODO list since I've moved from Atom to VS Code. Before I send a PR, I'd like to get some feedback in order to avoid wasting my time in something that might not please everyone. So here it goes.
1. Improve readability of signature info
Currently, the documentation summary and the spec showed are not recognized as markdown and elixir code respectively. Example:
Suggestion:
Example:
2. Improve readability of auto-complete info
Currently, the information showed for auto-complete is too noisy. Example:
The most important thing to see should be the signature. But most of them are clipped so we need to look at the spec, which is much more verbose, to figure out the arguments. Also, having the signature in the list makes it harder to read the function name.
Suggestion:
Example:
Here's another example with a larger spec:
Before:
After:
Although the user might eventually need to scroll down to see the formatted spec, the information will be much more readable as we can see here:
3. Do not add arguments to the snippet when auto-completing
One of the main reasons I implemented the signature help feature in ElixirSense was to be able to get rid of this behaviour as 99% of the time we need to delete all the arguments suggested since the suggestions are just the name of the arguments, not the name of the variables you have in the scope.
Example:
As you can see, there's no variable
enumerable
and I might not even need the second argument. So I'll have to delete both of them. That's just extra unnecessary work.Suggestion:
Here's an example from a Java extension:
And here is VS Code showing our signature info after completion:
4. Remove keyword completion
I think we need to start thinking about removing some of the suggestions as they mostly just add noise to the list. One example is the keyword completions. As the comment in the source code states, this is really not useful and it interferes with the auto-indentation for some cases.
@axelson and @lukaszsamson I'd love to hear your thoughts about those suggestions.
Cheers.
The text was updated successfully, but these errors were encountered: