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

Experimental paste handling blocks pasting while project loading #2924

Closed
rgrunber opened this issue Feb 7, 2023 · 2 comments · Fixed by #2925
Closed

Experimental paste handling blocks pasting while project loading #2924

rgrunber opened this issue Feb 7, 2023 · 2 comments · Fixed by #2925

Comments

@rgrunber
Copy link
Member

rgrunber commented Feb 7, 2023

slow-paste-handler

[Trace - 11:43:42] Sending request 'workspace/executeCommand - (3)'.
Params: {
    "command": "java.edit.handlePasteEvent",
    "arguments": [
        "{\"location\":{\"range\":{\"start\":{\"line\":83,\"character\":0},\"end\":{\"line\":83,\"character\":0}},\"uri\":\"file:///home/rgrunber/git/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLLanguageServer.java\"},\"text\":\"XMLLanguageServer\",\"formattingOptions\":{\"insertSpaces\":false,\"tabSize\":4}}"
    ]
}
...
...
[Trace - 11:43:56] Received response 'workspace/executeCommand - (3)' in 13986ms.
No result returned.

I tried inserting a breakpoint into the delegate to see if some part of the command was being blocked, but it seems like there's a good chunk of time where the language server hasn't received the request, yet the client is clearly waiting, so maybe this is the language client delaying the request until the server is ready.

CC @datho7561 , @CsCherrYY

Update: Note that regular pasting does work if done before the language server starts up, which is probably prior to onReady. That would at least seem to imply that onReady is not enough, and we need a stronger condition when registering the paste provider. Maybe ServiceReady or Started ?

@rgrunber rgrunber added the bug label Feb 7, 2023
@CsCherrYY
Copy link
Contributor

and we need a stronger condition when registering the paste provider. Maybe ServiceReady or Started ?

Agree. and I guess the cause here is that the DelegateCommandHandler (paste handler in here) will be ready after a specific status (maybe ServiceReady).

@datho7561
Copy link
Contributor

I tried doing

apiManager.getApiInstance().serverReady().then((_ignore) => {
  registerPasteEventHandler(context, this.languageClient);
});

and that seems to fix it. I can put this is into a PR one second...

datho7561 added a commit to datho7561/vscode-java that referenced this issue Feb 8, 2023
Fixes redhat-developer#2924

Signed-off-by: David Thompson <davthomp@redhat.com>
@rgrunber rgrunber added this to the Mid February 2023 milestone Feb 8, 2023
datho7561 added a commit to datho7561/vscode-java that referenced this issue Feb 9, 2023
Fixes redhat-developer#2924

Signed-off-by: David Thompson <davthomp@redhat.com>
rgrunber pushed a commit that referenced this issue Feb 9, 2023
Fixes #2924

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants