Skip to content

Provide client-side snippet until language server is ready #2240

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

Merged
merged 2 commits into from
Mar 25, 2022

Conversation

jdneo
Copy link
Collaborator

@jdneo jdneo commented Dec 3, 2021

This PR fix #684

  • postpone the client side snippet provider dispose time when the server is ready.
  • dispose the provider to make sure the items will be removed in the completion list when disposing happens.

Signed-off-by: Sheng Chen[email protected]

@testforstephen
Copy link
Collaborator

Tried it and this PR didn't solve the problem completely. There is another factor that causes the code snippet not to work.

On the jdt.ls server side, it registers capability for "textDocumement/completion" after initialized, which would cause both the client and server side to declare the completion provider before the server was full ready, and the server side would block the entire completion from working.

From the perspective of LSP, initialized means JLS is ready to accept request, and it will send completion request to JLS even though it's not really ready. And if multiple Java completion providers exist at the same time, VS Code will wait for all of them to be finished before returning the results. The slower one will determine the completion performance.

@jdneo
Copy link
Collaborator Author

jdneo commented Dec 14, 2021

This is a great finding! Currently we register the capabilities earlier than the server is able to dealing with those request. During this time window, if user starts to typing or doing other operations, a lot of requests sending from client to server and queued there, which makes the import time becomes 'longer'. Server needs to treat with those queued request but most of them are out-of-date.

@testforstephen
Copy link
Collaborator

There is a feature request microsoft/vscode#107343 about showing results from different completion providers incrementally, but it's still under discussion.

if we want to mitigate the issue for now, we need to delay registering completion capability on the server side until the language server is actually ready.

@testforstephen
Copy link
Collaborator

It's possible to show duplicated snippet in completion list when lightweight server is up but standard server is still loading. both lightweight server and client-side snippet provide same snippets.

image

Copy link
Collaborator

@testforstephen testforstephen left a comment

Choose a reason for hiding this comment

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

It works fine with the latest commit. Feel free to merge this PR once eclipse-jdtls/eclipse.jdt.ls#1979 is merged.

@testforstephen testforstephen merged commit 43d7669 into redhat-developer:master Mar 25, 2022
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.

Code snippet should be working before LS done resolving Maven dependencies
2 participants