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

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

Draft
wants to merge 1 commit 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 three particular pain points:

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.

This PR is primarily for experimentation/validation that it helps, but feedback is welcome nonetheless.

I also have a separate/independent commit that adds additional logging for code completion, namely:

  • logs time the CC took,
  • and if it takes more 1 second, it will print a thread dump, and start self sampler.

The self sampler ran out of heap for me when running without #7707, so I would suggest to either use this additional logging with LspElementUtils fixed, or disable the self sampler part.

The additional logging commit is:
lahodaj@e3d5b2f

…Java) LSP server.

Only properly cancels for Java sources at this time, for other sources runs only the CompletableFuture cancel will work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant