-
Notifications
You must be signed in to change notification settings - Fork 456
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
Dubious package detection for empty standalone files #750
Comments
@hjb912 What the type of your project? Could you provide a gif for reproducing this issue. |
@danjmillier can you reload vscode? |
@fbricon I've tried reloading and even restarting my laptop, still no dice. Oddly enough, if I make a "main2" folder and change "package main" to "package main2" it works and I'm not sure why.. |
So this is caused by jdt.ls's invisible project mechanism, that initializes it's source directory as "_/whatever/package", because the opened Java file was empty, so the initial package could not be inferred. |
I am also facing the same issue. |
@testforstephen Could you help investigate this issue? |
When the language server is activated by an empty standalone java file, a new idea is trying to search a non empty java file from the same directory. If found, use the non empty java file to resolve package name, otherwise, take the workspaceRoot as source root and then the relative path to workspaceRoot should be the package name. @fbricon any thoughts? |
yeah you can try that |
Issue Type: Bug
a.java empty file in package A, i write "package A", then notice me "The declared package "A" does not match the expected package ""Java(536871240)", however, i move this a.java to B directory, then move back to A directory, this notice disappear! why is it..
VS Code version: Code 1.30.0 (c6e592b, 2018-12-11T22:22:15.793Z)
OS version: Darwin x64 18.2.0
The text was updated successfully, but these errors were encountered: