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

ignore signature results for other buffers #233

Merged
merged 1 commit into from
Nov 20, 2022
Merged

ignore signature results for other buffers #233

merged 1 commit into from
Nov 20, 2022

Conversation

Gelio
Copy link
Contributor

@Gelio Gelio commented Nov 19, 2022

Language servers can be slow to respond to the
textDocument/signatureHelp request. During that time, the user could have moved to another buffer. The signature would be shown for the current buffer even though it was meant for some other buffer.

In this reproduction, I modify some code to make tsserver busy, quickly ask for signatureHelp and then quickly open Telescope:

Peek.2022-11-19.12-52.signature.not.ignored.causes.an.erorr.mp4

Let's only show the signature if it is for the current buffer.

The same Telescope bug reproduction with the fix from this PR (it no longer causes an error because the signature is ignored):

Peek.2022-11-19.12-53.mp4

This bugfix is cherry-picked from the Neovim core signature_help LSP handler.

Language servers can be slow to respond to the
`textDocument/signatureHelp` request. During that time, the user could
have moved to another buffer. The signature would be shown for the
current buffer even though it was meant for some other buffer.

Let's only show the signature if it is for the current buffer.

This bugfix is cherry-picked from the Neovim core `signature_help` LSP
handler [0].

[0]: neovim/neovim#21121
Copy link
Owner

@ray-x ray-x left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM.
But also a note that the delay might also be caused by lsp-signature timer setup.

@ray-x ray-x merged commit 8c1ed60 into ray-x:master Nov 20, 2022
@Gelio
Copy link
Contributor Author

Gelio commented Nov 21, 2022

Thanks for merging the PR!

Yeah, the delay may also be from there, but in my case, it is definitely tsserver choking on the size of the project. I have the same delays for diagnostics, hover information, autocomplete, etc 😅

@Gelio Gelio deleted the only-show-signature-for-correct-buffers branch November 21, 2022 07:52
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.

None yet

2 participants