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

Add an option not to insert arguments on completion #2903

Closed
felixaszx opened this issue Jan 26, 2023 · 12 comments · Fixed by #3143
Closed

Add an option not to insert arguments on completion #2903

felixaszx opened this issue Jan 26, 2023 · 12 comments · Fixed by #3143

Comments

@felixaszx
Copy link

[provide a description of the issue]

Environment
  • Operating System: Windows
  • JDK version: openjdk 17.0.5 2022-10-18 LTS
  • Visual Studio Code version: 1.74.3
  • Java extension version: N/A
Steps To Reproduce
  1. Create any method that has arguments
  2. Type that method and use autocomplete
  3. You can see that the name of argument is also fill in, which is unexpected
Current Result

Screenshot 2023-01-26 152024

Expected Result

Screenshot 2023-01-26 152048

Additional Informations

If this is a feature, can I turn of this?

@snjeza
Copy link
Contributor

snjeza commented Jan 26, 2023

@felixxing You can try

"java.completion.guessMethodArguments": false

@felixaszx
Copy link
Author

@felixxing You can try

"java.completion.guessMethodArguments": false

That does not work.

@jdneo
Copy link
Collaborator

jdneo commented Jan 30, 2023

It's currently by design that the method arguments will be filled according to the selected method's signature.

Looks like we need to expose this setting from JDT
image

I remember it's not exposed now in VS Code Java, @snjeza is it correct?

@felixaszx
Copy link
Author

It's currently by design that the method arguments will be filled according to the selected method's signature.

Looks like we need to expose this setting from JDT image

I remember it's not exposed now in VS Code Java, @snjeza is it correct?

Yes, I've never seen setings like that in VsCode.

@snjeza
Copy link
Contributor

snjeza commented Jan 30, 2023

I remember it's not exposed now in VS Code Java, @snjeza is it correct?

Yes, it is correct.

@thgcode
Copy link

thgcode commented May 9, 2023

I'm not sure if the images display the same issue, but it would be nice to have the option to not include the argument names on method calls. I use a screen reader (NVDA) / keyboard and deleting all the arguments when selecting a method call everytime makes using this feature a bit annoying, especially if the method has more than 2 arguments. It would be nice if we could have the option to select between the three modes, one for completely turning it off, one for argument names and other for guessing the method arguments.

I don't know much about the LSP protocol, but it seems the feature is hardcoded on the source code of jdt.ls.

@jdneo
Copy link
Collaborator

jdneo commented May 10, 2023

Hi @thgcode, the image pasted above in this thread is a screenshot from Eclipse configuration page. It shows that Eclipse has the capability to control the behavior and that can be a reference for the implementation in VS Code Java extension.

@thgcode
Copy link

thgcode commented May 10, 2023

@jdneo Thanks for the image description!

I tested with Eclipse and the feature can be used correctly on it. Then I was thinking why it worked on Eclipse and not on VSCode and found some information that can help to implement the feature. It seems the feature is implemented directly on the UI. The JavaCompletionProposalComputer reads the preference and sets the completion collector. It seems this the reason it works on Eclipse.

@jdneo
Copy link
Collaborator

jdneo commented May 11, 2023

@thgcode Thank you for the information. If it's implemented in UI, then we have to do it separately in JDT.LS. But I guess it won't be too complicated(hopefully). I can take a look at this sometime in next month.

@jdneo jdneo self-assigned this May 11, 2023
@jdneo jdneo changed the title Autocomplete fill the argument names Add an option not to insert arguments on completion Jun 2, 2023
@jdneo
Copy link
Collaborator

jdneo commented Jun 16, 2023

@thgcode, you can now set java.completion.guessMethodArguments to off stop filling anything on completion. The feature should be available in pre-release version v1.20.2023061504 or higher now.

@thgcode
Copy link

thgcode commented Jun 17, 2023

I tested it and it's working perfectly, thank you! This feature will save a lot of time for me.

@jdneo
Copy link
Collaborator

jdneo commented Jun 19, 2023

@thgcode Thanks for the feedback!

@rgrunber rgrunber added this to the End June 2023 milestone Jun 28, 2023
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.

5 participants