Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add automatic value completions on named arguments #827
I talked around in the office and someone said it would be useful to have something that autofills named parameters. After tinkering a bit with possibilities I come up with:
What does anyone think? I was pretty easy to implement, but not sure about the ideal functionality. I am not sure about default arguments.
All suggestions are welcome.
I think that picking the variable "by name" from current scope is an awesome step in making the user experience much better.
As to the defaults, I think we would benefit from using the
Thank you @tgodzik for taking the initiative to implement this cool idea!
I am concerned about false positives. While this feature is useful in the scenarios where the guessed values are correct, the benefits of this feature may be outweighed by the frequent situation where the guessed values are incorrect and the user needs to manually edit the guessed values.
I am also concerned that users will blindly use guessed values like
At the price of a few additional keystrokes, the current behavior where users incrementally add one argument at a time offers a more flexible workflow where users don't have to spend mental energy wondering whether the "autofill" completion will work correctly at each call-site.
It's not clear to me what the expected behavior is in some scenarios:
I'm curious to know what other people expect the behavior to be like.
Do you think implementing the "Use named argument for current and subsequent arguments" inspection in IntelliJ could reduce the need for this feature?
I think we could drop the default literals and replace them with
I think we should most likely use the default value, but not sure if we have access to it. So we could skip all those that have default values if there is no applicable value in scope.
We might change that all to ???, since all literal values would be guessing. I agree
I don't think we need that since the option to autofil will be last, so people should know what they are doing if scrolling down the list.