-
Notifications
You must be signed in to change notification settings - Fork 401
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
No need to run in workspace for didSave #2449
Conversation
We have a few places in the code where we do this ( @snjeza , what about https://github.com/eclipse/eclipse.jdt.ls/blob/40611dc3e419821aa76f58c54314a7d23e9a059a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java#L486-L487 ? Is this change safe with this operation ? |
The checkPackageDeclaration method can call the file.delete() method. See https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java#L531 |
OK, I'll try to refine some preconditions to determine whether the workspace run is actually necessary. For example, in case the resource is already up-to-date, the workspace run becomes a bottleneck for other operations, with a risk of deadlock. |
@snjeza , is there anywhere else we could move that If we could move that, that would leave |
We could try to move it to handleChanged. |
I think that's worth trying, if it improves the situation on other clients. I would verify how the behaviour changes when moving |
I don't mind having this live on as an issue that we can maybe look at. However, if you have a workaround, I think this should be lower priority now. |
Currently, I have more a fork than a workaround; but that's good enough to me at the moment. |
@rgrunber do you think this can be merged? |
I will try to create a test case that highlights the case when this workspace.run() is necessary. So it will verify this change doesn't cause a regression, and if it does, it will allow to make the proper fix. |
1be550e
to
8de91ee
Compare
In most cases, saving just saves the file and the worksapce runnable is useless (and even may be the source of deadlocks in some deployments). Only use a workspace runnable when there is a chance of save operation being more complex.
8de91ee
to
7bed1cc
Compare
I've updated this PR to narrow the cases where the |
@snjeza , can you verify whether we can make this change ? To me it seems like |
The only workspace operation is a potential refresh; no need to wrap it in a job that may become a blocker.