-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
fix(lsp): Don't show clients with empty content in hover #33692
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
base: master
Are you sure you want to change the base?
fix(lsp): Don't show clients with empty content in hover #33692
Conversation
9943e58
to
2f47401
Compare
8d06d0e
to
abb3ee5
Compare
abb3ee5
to
e5cfea9
Compare
e5cfea9
to
eabf40c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about this. It feels wrong for a server to return an empty hover response when it could return null
instead. I think that if a server decides to return empty content, we should display it.
runtime/lua/vim/lsp/buf.lua
Outdated
results1[client_id] = result | ||
local contents = result.contents | ||
-- Ensure that there is some content to display | ||
if type(contents) == 'string' or contents.kind or contents.language or contents[1] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment explaining that this corresponds to checking that contents
is a MarkedString | MarkedString[] | MarkupContent
would be appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified the check to just make sure #contents > 0
(i.e. it is not an empty table or an empty string)
good point. is this actually common, or is it a server quirk ? |
eabf40c
to
313e543
Compare
I'm not sure if it's common, but anecdotally, both |
*Problem*: LSP clients that produced no diagnostic results are being shown in the diagnostics hover (e.g. the client name is shown with no results). *Solution*: This PR hides clients with no diagnostic content in the hover summary.
313e543
to
dc897b0
Compare
Problem:
LSP clients that produced no content are being shown in the hover summary (e.g. the client name is shown with no results).
Example of the problem - Typescript with multiple clients (
vtsls
andgraphql
) with empty section forgraphql
:Another example where both servers have empty results:
Solution:
This PR hides clients with no content in the hover summary.