-
Notifications
You must be signed in to change notification settings - Fork 374
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
Recognize new maven, gradle, eclipse project(s) after first init #144
Comments
At the moment project initialization/import only occurs during language server (JLS) startup. So what you see is expected. However I don't consider that feature a priority item, compared to proper java support (intellisense, refactoring. ..). |
Thanks, so in order to implement this, would it be possible for me to add another method in the ProjectsManager to add a project post-startup? |
@svarlamov Yes method is needed. Also you need to have the logic in proper place that triggers the method. Feel free to send an early pull request to discuss. @fbricon and I can help you mature it. |
I've added a function in to handle this, however, it seems that as long as the data path is the same as the workspace root, then this is handled automatically. How is this happening behind the scenes? Feels like an Eclipse-handled process |
I'm not sure I understand that last comment. What is handled automatically? The only build related part that is handled automatically is updating the project configuration automatically, when a pom.xm or gradle file changes, if the |
So first of all, I'm using this outside of the vscode ext context, however, I'm currently setting the public IStatus addProject(final String projRootPath, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
try {
File userProjectRoot = new File(projRootPath);
IProjectImporter importer = getImporter(userProjectRoot, subMonitor.split(20));
if (importer != null) {
importer.importToWorkspace(subMonitor.split(70));
}
return Status.OK_STATUS;
} catch (CoreException e) {
JavaLanguageServerPlugin.logException("Problem importing to workspace", e);
return StatusFactory.newErrorStatus("Import failed: " + e.getMessage(), e);
} catch (InterruptedException e) {
JavaLanguageServerPlugin.logInfo("Import cancelled");
return Status.CANCEL_STATUS;
}
} I'm finding that the importer (maven) just passes over actually doing anything with the 'new' project, because the |
@snjeza can you please take a look at that one. This is needed by Che, among other clients. |
I think the title is a bit misleading: if we start recognizing new build files, it should include all build files we understand: maven, gradle, eclipse... |
Fixed with 6e09b58 |
I initialize the server with a top-level workspace directory, that may or may not have projects in it. This top-level directory does not contain a pom.xml, since it's just a workspace. After the langserver gets initialized, I create a project under this top-level workspace, and it contains my pom.xml, plus a full Eclipse-ready project. Once this new project is created, I also send a workspace/didChangeWatchedFiles notification to the langserver that contains the created FileEdit objects, followed by a java/projectConfigurationUpdate notification where the URI is set to the new pom.xml that I just created. Then, once I call textDocument/didOpen on a Java file in that project's Maven src directory, I get the "Classpath is incomplete" error. However, if I restart the server, and just open that same Java file, everything works -- I also get the importing Maven projects msg on init, etc. So I'm assuming that I must be missing some sort of call to the server to have it import this newly created Maven project. Please let me know how I should proceed, and if this functionality requires me to customize the langserver project. Thanks so much for the help!
The text was updated successfully, but these errors were encountered: