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

Imports for Java packages #3757

Closed
pfuetzma opened this issue Aug 30, 2024 · 8 comments
Closed

Imports for Java packages #3757

pfuetzma opened this issue Aug 30, 2024 · 8 comments

Comments

@pfuetzma
Copy link

Imports for Java packages such as java.util.* or java.time.* are no longer suggested or added in the Code Editor.

Environment
  • Operating System: Win10Pro
  • JDK version: 21
  • Visual Studio Code version: 1.92.2
  • Java extension version: Extension Pack for Java v0.29.0
Steps To Reproduce
  1. open *.java file
  2. type LocalDateTime

Only imports from third-party libraries are offered, e.g com.fasterxml... or com.springframework...

@rgrunber
Copy link
Member

rgrunber commented Sep 3, 2024

Do you see any other errors in the problems view, or just the ones about those imports not being found ? Seems like a misconfigured JDK might cause this, given that you're still seeing import suggestions from other 3rd party libraries.

@andywarren86
Copy link

andywarren86 commented Sep 4, 2024

I've been having this problem on & off while now. When it happens I run the "Clean Java Language Server Workspace" command which sorts it out. Nothing obvious in the Problem / Output panels.

Environment

  • Operating System: Windows 11 Pro
  • JDK version: 17
  • Visual Studio Code version: 1.92.2
  • Java extension version: Extension Pack for Java v0.29.0 (Language support v1.34.0)

Ill have a play around to see if I can figure out what is triggering the issue.

@andywarren86
Copy link

Duplicate of #3715

@pfuetzma
Copy link
Author

pfuetzma commented Sep 4, 2024

I almost expected the reaction to be a misconfigured JDK. But that is not the case. The projects work and can be compiled and executed.
I can't find anything about this in the problems view.

@github-actions github-actions bot removed the need info label Sep 4, 2024
@rgrunber
Copy link
Member

rgrunber commented Sep 4, 2024

Yeah it definitely seems like #3715 . I've run into it once or twice before, and also found it went away when I cleaned the workspace. I saved my client/server logs from around when this happened and can clearly see the imports not being sent back during that period of time. However there isn't anything odd in terms of errors. Just that the server completely left out the code actions regarding imports but did include others (so it wasn't an outright failure).

@yinweixx
Copy link

I also have this issue where the java.util.* package is not being suggested, which is quite frustrating. It happens from time to time, and I have to restart VSCode or clear the cache. When will this issue be fixed?
Environment
Operating System: macOS 14.6.1
JDK version: 21
Visual Studio Code version: 1.93.0
Java extension version: Extension Pack for Java v0.29.0

@rgrunber
Copy link
Member

I would try the vscode-java pre-release build tomorrow. There's a good chance this has been fixed now.

@rgrunber
Copy link
Member

rgrunber commented Nov 5, 2024

Marking as closed as I really think this was fixed in #3797 (or even #3715 , there were many duplicates of the same problem).

@rgrunber rgrunber closed this as completed Nov 5, 2024
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

4 participants