Skip to content

Add an option not to insert arguments on completion #2903

Closed

Description

@felixaszx

[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?

Activity

  1. snjeza commented on Jan 26, 2023

    @snjeza
    Collaborator

    @felixxing You can try

    "java.completion.guessMethodArguments": false
    
  2. felixaszx commented on Jan 26, 2023

    @felixaszx
    Author

    @felixxing You can try

    "java.completion.guessMethodArguments": false
    

    That does not work.

  3. jdneo commented on Jan 30, 2023

    @jdneo
    Collaborator

    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?

  4. felixaszx commented on Jan 30, 2023

    @felixaszx
    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.

  5. snjeza commented on Jan 30, 2023

    @snjeza
    Collaborator

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

    Yes, it is correct.

  6. thgcode commented on May 9, 2023

    @thgcode

    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.

  7. jdneo commented on May 10, 2023

    @jdneo
    Collaborator

    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.

  8. thgcode commented on May 10, 2023

    @thgcode

    @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.

  9. jdneo commented on May 11, 2023

    @jdneo
    Collaborator

    @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.

  10. self-assigned this
    on May 11, 2023
  11. changed the title [-]Autocomplete fill the argument names[/-] [+]Add an option not to insert arguments on completion[/+] on Jun 2, 2023
  12. jdneo commented on Jun 16, 2023

    @jdneo
    Collaborator

    @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.

  13. thgcode commented on Jun 17, 2023

    @thgcode

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

  14. jdneo commented on Jun 19, 2023

    @jdneo
    Collaborator

    @thgcode Thanks for the feedback!

  15. added this to the End June 2023 milestone on Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions