Open matthughes opened 5 months ago
Thanks for reporting! There is actually an existing completion, but it seems to be hidden now more than before
Screencast from 24.06.2024 14:51:05.webm
I am not sure how to make it visible, but maybe we could make it a code action instead? Or optionally as suggested, show it more prominent when it's a lot of arguments :thinking:
And it will try to input the values, so might not be perfect for your use case
omg that's awesome! So you just type the word auto? Is this documented somewhere? Definitely +100 for making it a code action or something cause I never would have discovered this.
I don't think that was ever properly documented, but also we weren't sure of the UX here, so we need to fix that.
https://scalameta.org/metals/blog/2019/09/12/thorium/#add-auto-fill-option-to-case-classes <- that's from release notes
Is your feature request related to a problem? Please describe.
When calling a method with a large number of arguments, it's sometimes hard to remember the names, types, and order of the arguments. Code completion works up to a point but 1) if you introduce a small error, you lose it and 2) the autocomplete tends to slow things down as it has to work after each argument.
Consider the following case class:
Describe the solution you'd like
If I invoke a method or case class with more than N arguments, I want a smart completion option ("complete with named arguments) that inserts this (using example from above):
This gets me compiling code (in most cases) directly at the call site that I can now edit and fill in the holes as I'm ready to. For large methods like this, I often use the "use named arguments" function anyway but only after I've successfully gathered all the arguments.
Describe alternatives you've considered
I often will pull up a split pane in VsCode with the method I'm calling so I can see the arguments required without auto-complete coming up and disappearing.
Another option would be something like "show function in split pane". I guess the problem is the way auto-complete pop-overs work in VsCode. Because they are not sticky it's hard to see your place in a sea of more than a few method arguments.
Additional context
No response
Search terms
autocomplete arguments