redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 439 forks source link

Is it possible to have java.util.List on favorite? #3414

Open RMCampos opened 11 months ago

RMCampos commented 11 months ago

When trying to import List from java.util (java.util.List) this option is way down in the list of possible packages. Is there any option to make it go up, something like a default or favorite option? (I'm aware of the java.completion.favoriteStaticMembers, that's why I'm asking). Thanks in advance.

Environment
Steps To Reproduce
  1. Create a blank Java project
  2. Start typing "List"
  3. One can see lots of List packages but no java.util.List.

[Please attach a sample project reproducing the error] No sample project required (IMO).

Please attach logs No errors to show.

Current Result

It's required to scroll down and look for this package.

Expected Result

Since this is a quite common package, I'd like to see it on top.

Additional Informations

None.

rgrunber commented 10 months ago

You mean in a case like this ?

import-java-util-list

I don't think this is possible yet, but it's very similar to part of https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/1423, and https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/2484 . In fact the exact same issue (java.util.List being low) is brough up in https://github.com/redhat-developer/vscode-java/discussions/3341#discussioncomment-7341115 ! However, these wouldn't help in a completely empty project as they'd only prioritize imports that have already been used frequently.

testforstephen commented 10 months ago

This certainly worths optimization. In a typical Spring Boot project (spring-petclinic), numerous List classes from various dependencies are included. However, when typing ‘List’, the suggestion for “java.util.List” does not appear as a top priority, which makes it hard to find the "java.util.List" from intelliSense.

image

meiliangdeng commented 4 months ago

I have the same problem.

meiliangdeng commented 4 months ago

I have the same problem.

  • Extension Pack for Java: v0.27.2024060717
  • vscode: 1.90.0 It's strange that it can be imported normally again without upgrading
dailytabs commented 4 months ago

Using Ctrl+. on the "List" brings up java.util.List, correctly. It is very annoying to have to use a different keystroke to get intelligent completion just for this one class. A solution is needed.