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

Run long-spanning tasks cancellably on background in the (Java) LSP server. #7708

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Aug 29, 2024

@jtulach reported the code completion inside VS Code is sometimes slow for him. I was thinking of that, and experimenting, and I think at least part of the problem is that tasks that should be background tasks are not properly cancellable in the VS Code (Java) server.

I was doing experiments on:
https://github.com/openjdk/jdk/blob/master/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

and it seemed there were two (current) particular pain points:

  • diagnostics (especially hints) computation, which can take a fairly long time to compute
  • semantic coloring computation, which can also take some time to compute

Neither of these can be cancelled when the request to compute code completion. This draft is attempting to improve that, and run diagnostics and semantic coloring in a cancellable way.

It only properly cancels for Java sources at this time, for other sources runs only the CompletableFuture cancel will work. Some work on Schedulers will be needed to fully enable this for non-Java sources, but I suspect this can wait

I also have a separate PR that adds additional logging for code completion:
#7815

…Java) LSP server.

Only properly cancels for Java sources at this time, for other sources runs only the CompletableFuture cancel will work.
@lahodaj
Copy link
Contributor Author

lahodaj commented Oct 9, 2024

I think we need to make progress on this.

@lahodaj lahodaj marked this pull request as ready for review October 9, 2024 13:55
@lahodaj lahodaj added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests labels Oct 9, 2024
@lahodaj lahodaj added this to the NB24 milestone Oct 9, 2024
@apache apache locked and limited conversation to collaborators Oct 9, 2024
@apache apache unlocked this conversation Oct 9, 2024
@lahodaj lahodaj changed the title Prototype: run long-spanning tasks cancellably on background in the (Java) LSP server. Run long-spanning tasks cancellably on background in the (Java) LSP server. Oct 9, 2024
@lahodaj lahodaj requested review from dbalek and sdedic October 9, 2024 14:15
@ebarboni ebarboni modified the milestones: NB24, NB25 Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants