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

Fix perf issue by preventing unnecessary building when open workspace. #756

Merged
merged 4 commits into from
Aug 31, 2018

Conversation

yaohaizh
Copy link
Contributor

@gorkem @fbricon

The force build on initialized will block the LSP protocol to wait for its response. And this action is not necessary to triggered every time when the auto build is true.
Restore the auto building value will make building as a worker thread and response to the client quickly.

With this change, eclipse.jdt.ls will match the performance of eclipse on import/reopen scenario.

Copy link
Contributor

@fbricon fbricon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1: diagnostics are no longer reported after reopening a existing project

@yaohaizh
Copy link
Contributor Author

yaohaizh commented Aug 20, 2018

Diagnostic will be triggered by auto build in the back ground. This change is remove the force build in the foreground.

@fbricon
Copy link
Contributor

fbricon commented Aug 20, 2018

No longer publishing diagnostics is a regression we can't allow. Background thread or not. They are absolutely not reported after opening the folder. I'm seeing that regression with this PR

@yaohaizh
Copy link
Contributor Author

yaohaizh commented Aug 21, 2018

The diagnostic information is published after this change for auto build scenario.

The diagnostic information is NOT published if disable auto build. I can enable the force build for disable auto build scenario, but it is weird behavior.

@fbricon
Copy link
Contributor

fbricon commented Aug 21, 2018

try opening https://github.com/spring-projects/spring-amqp in vscode with this PR
You can even set "java.autobuild.enabled": true just to be sure.

  • 1st time the project opens, all diagnostics are published
  • restart vscode, no diagnostics are published. None.

I tried with the an empty workspaceStorage in vscode insiders

@yaohaizh
Copy link
Contributor Author

yaohaizh commented Aug 21, 2018

This is an interesting thing. I originally used https://github.com/elastic/elasticsearch for testing gradle which is a large scale project, which makes diagnostic information published when reload.

Given these information, I think this should be the cause for the difference: #758

Given these, I will firstly make the force build as a worker thread to publish diagnostics.

@yaohaizh
Copy link
Contributor Author

@fbricon Updated the PR to handle diagnostic situation.

@@ -128,6 +143,66 @@ else if (projectsManager.isBuildFile(file)) {
return false;
}

public List<IMarker> publichDiagnostic(IProgressMonitor monitor) throws CoreException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publishDiagnostics

for (IProject project : projects) {
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore default project, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out this is the problem markers, but it will be ignored by publish diagnostics, which is the same behavior as the current design.

@yaohaizh
Copy link
Contributor Author

yaohaizh commented Aug 30, 2018

@fbricon Fixed the issues.

@yaohaizh
Copy link
Contributor Author

test this please

@yaohaizh
Copy link
Contributor Author

@fbricon What happened with Jenkins?

@fbricon
Copy link
Contributor

fbricon commented Aug 30, 2018

The PR fails to compile:

03:32:19 [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.eclipse.jdt.ls.tests: Compilation failure: Compilation failure: 
03:32:19 [ERROR] /jobs/genie.ls/jdt-ls-pr/workspace/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/WorkspaceDiagnosticsHandlerTest.java:[249] 
03:32:19 [ERROR] 	initHandler.addWorkspaceDiagnosticsHandler();
03:32:19 [ERROR] 	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
03:32:19 [ERROR] The method addWorkspaceDiagnosticsHandler() is undefined for the type InitHandler
03:32:19 [ERROR] 1 problem (1 error)

@@ -62,7 +62,7 @@ public BuildWorkspaceStatus buildWorkspace(boolean forceReBuild, IProgressMonito
}
}
ResourcesPlugin.getWorkspace().build(forceReBuild ? IncrementalProjectBuilder.FULL_BUILD : IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
List<IMarker> problemMarkers = workspaceDiagnosticsHandler.publichDiagnostic(monitor);
List<IMarker> problemMarkers = workspaceDiagnosticsHandler.publichDiagnostics(monitor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's publishDiagnostics with sh, not ch

@fbricon
Copy link
Contributor

fbricon commented Aug 31, 2018

test this please

Signed-off-by: Yaohai Zheng <yaozheng@microsoft.com>
@yaohaizh
Copy link
Contributor Author

@fbricon Updated PR

@fbricon fbricon added this to the End August 2018 milestone Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants