LSPEclipseUtils.findMostNested now returns the most nested project #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I will try to be the most precise possible.
The issue exhibited here only happens when the eclipse workspace contains a file accessible from more than one project which is a common case when working on maven multi modules projects (i think gradle multi modules projects are also impacted but i did not check)
Eclipse workspace with 2 projects : parent_project, nested_project
Where nested_project is contained in parent_project
With this kind of workspace, we have two cases:
The bug in LSPEclipseUtils.findMostNested was realy simple like you can see in the code.
The function was returning the first processed IFile instead of the most nested which may leads to return an incorrect IResource from LSPEclipseUtils.findResourceFor(uri)
I think this pull request solves the issues #32, #112
Why?
Because while editing a file and temporary errors pop up then a non empty diagnostic is returned by the language server.
Provided we have a multi modules workspace like described earlier then:
java.io.IOException: Stream closed
This pull request may solve issues related to multi modules workspace but only for users using the "Hierarchycal" project presentation. For those using the "Flat" project presentation, i created the issue #258 but i think it won't be a trivial one as LSP4E does not seem to currently support multiple editors for the same file opened from multiple projects.