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

The project's package fragments are not update to date when adding a new one. #1137

Closed
jdneo opened this issue Aug 1, 2019 · 2 comments · Fixed by #1207
Closed

The project's package fragments are not update to date when adding a new one. #1137

jdneo opened this issue Aug 1, 2019 · 2 comments · Fixed by #1207
Labels

Comments

@jdneo
Copy link
Contributor

jdneo commented Aug 1, 2019

Repro steps:

  • Open a java project to let the Java Language Server start up
  • Create a new folder, the folder path is belong to one of the project's PackageFragmentRoot
  • Create a Java file in that folder
  • Then, when we get a IJavaProject instance in the Java side, and inspect the PackageFragment, there is no entry for the new created one. (You can call project.getPackageFragmentRoots() first, after find the right root, call getChildren() over it)

bug

This bug affects several scenario, like:

  • Cannot move a compilation unit to a newly created package (gif above)
  • Could not find or load main class xxx when debugging a main class in newly created package
  • Java dependency viewer cannot show the newly created package and its members in the explorer
  • Java Test explorer cannot show the newly created package and its members in the explorer
@jdneo
Copy link
Contributor Author

jdneo commented Oct 12, 2019

@snjeza @fbricon

I found a reason which may cause this bug. In https://github.com/eclipse/eclipse.jdt.ls/blob/ff78ddaf41417aec47cfdf1aa619a96f87462f61/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java#L894

We always refresh the parent with zero depth. After this operation, the parent of the newly created package is still not aware of the existence of its new member. Maybe we need to use DEPTH_ONE here?

@fbricon
Copy link
Contributor

fbricon commented Oct 12, 2019

If that's what it takes to work then ok

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

Successfully merging a pull request may close this issue.

3 participants