-
Notifications
You must be signed in to change notification settings - Fork 403
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
Cannot import maven project from workspace #2999
Conversation
0d82fcd
to
978b93e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to fix the issue for me. Just a few small things to fix.
Is it the case that JDTLS filesystem does not currently exclude any resources when performing operations ?
....ls.filesystem/src/org/eclipse/jdt/ls/core/internal/filesystem/JDTLSFilesystemActivator.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
private void configureResourceFilters() { | ||
IEclipsePreferences eclipsePreferences = InstanceScope.INSTANCE.getNode(JAVA_LS_PLUGIN_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just something to be aware of :
Although I'd have preferred making jdt.ls.filesystem
directly depend on jdt.ls.core
I'll allow this copying because in the long term , we have #2658, so we should avoid any link between this bundle and jdt.ls.core).
....ls.filesystem/src/org/eclipse/jdt/ls/core/internal/filesystem/JDTLSFilesystemActivator.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/PreferenceManager.java
Outdated
Show resolved
Hide resolved
Yes, it is. |
@rgrunber I have updated the PR. |
I completely agree. All those My question was more about why we need to manually exclude files (based on filters) when we configure filters at initialization. I would have hoped the filesystem API would do it for us. Line 690 in 2b7857b
The javadoc says :
I haven't looked too deeply, so maybe the API doesn't work that way. Update: Maybe the resource model is independent of the filesystem model and manual filtering is the right approach. |
The issue happens only when we import a project into a new workspace. In this case, getProjectNameIfLocationIsProjectRoot is called before we configure the project (and its filters) |
You're right 😐 Lines 260 to 261 in 2b7857b
|
The project filters already work that way Line 668 in 2b7857b
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. I would just rename the commit message to make it clear we're basically re-implementing resource filtering in the filesystem implementation beause resource filtering isn't yet in place. Something like
JDT LS Filesystem should respect resource filtering
- Resource model filtering is set up after projects are imported, but
some import operations (eg. Maven projects) could benefit from this
Once done, feel free to merge.
import java.util.Objects; | ||
import java.util.regex.Pattern; | ||
|
||
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have some unused imports here. IEclipsePreferences
and InstanceScope
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
protected void setResourcePatterns() { | ||
resourcePatterns = new ArrayList<>(); | ||
for (String element: resourceFilters.split("::")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave a space between element
and :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
for (String segment: path.segments()) { | ||
for (Pattern pattern: JDTLSFilesystemActivator.getResourcePatterns()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Space between the element and the :
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
- Resource model filtering is set up after projects are imported, but some import operations (eg. Maven projects) could benefit from this
Fixed |
Fixes redhat-developer/vscode-java#2972
Steps to Reproduce:
See redhat-developer/vscode-java#2972 (comment)
Test vsix - VS Code 1.27.3