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

Autocomplete ordering lists longest overloads first #3327

Closed
oliviercailloux opened this issue Sep 30, 2023 · 1 comment
Closed

Autocomplete ordering lists longest overloads first #3327

oliviercailloux opened this issue Sep 30, 2023 · 1 comment

Comments

@oliviercailloux
Copy link

When triggering autocomplete on methods that have many overloads, VSCode lists the longest ones first. It is usually the shortest ones that I (and, I suspect, most developers) need. I’d like to see it first.

Example: Preconditions#checkArgument has 25 overloads. I usually need the simple checkArgument(boolean), and occasionally checkArgument​(boolean expression, Object errorMessage), but VSCode lists checkArgument(boolean expression, String errorMessageTemplate, Object p1, Object p2, Object p3, Object p4) first, and the two ones that are most needed as 24th and 25th suggestions.

Same with the 93 overloads of Assertions#assertEquals: one usually needs the simple two arguments version, but VSCode suggests all variants of the four arguments overloads first.

Note that the Javadoc displays the overloads shortest first, which seems quite natural to me. Note also that selecting a shorter method then adding arguments is less tedious than selecting a longest one then deleting arguments.

Is this how VSCode normally behaves, or have I misconfigured something? If it is its usual behavior, can it be changed?

Environment
  • Operating System: Linux
  • JDK version: 17
  • Visual Studio Code version: 1.82.2
  • Java extension version: 1.23.0
Steps To Reproduce
  1. In a project with Guava added as a dependency, type Preconditions.checkAr
  2. Trigger autocompletion
@rgrunber
Copy link
Member

rgrunber commented Oct 4, 2023

I think we fixed this in the language server in eclipse-jdtls/eclipse.jdt.ls#2874 so it should be in the pre-releases, and make the next release of vscode-java (end of October). We now sort by number of parameters. It should also be possible to filter by the signature data also.

completion-filter-text

This was a regression from the time we introduced labelDetails. It made the completion list nicer, but affected ordering/filtering. We're currently going through some of these issues and addressing them.

I would mark this as a duplicate of #3206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants