-
Notifications
You must be signed in to change notification settings - Fork 185
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
Improve label detail support in completions #2212
Conversation
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.
Will need to be manually tested with various servers to ensure that it doesn't result in worse behavior in some cases.
I will do my share of testing, hopefully others will do theirs. :)
@@ -69,7 +69,7 @@ def format_completion( | |||
annotation = lsp_label_description or lsp_detail | |||
elif lsp_label.startswith(lsp_filter_text): | |||
trigger = lsp_label | |||
annotation = lsp_detail | |||
annotation = lsp_label_description or lsp_detail |
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.
@jwortmann can you have a look since you were involved with related changes? |
So if we prefer I think it depends on the server whether it is better or worse than using the |
For this specific case I think it's much more preferred to see the name of the file/package in the completion list rather than just "auto-import" because, if you know the server a little bit, you know that seeing the name equals auto-import and so you still know that the auto-import will happen and at the same time you have much more information up-front. |
Applied same logic to the else branch and also consolidated those two blocks. It's probably not easy to review. |
check( | ||
resolve_support=False, | ||
expected_regex=r"^f\(X& x\) \| does things$", | ||
expected_regex=r"^f\(X& x\)$", | ||
label="f", | ||
label_details={"detail": "(X& x)", "description": "does things"} | ||
) |
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.
Those test are poor-mans version of the new ones so it would possibly be OK to remove those and convert to the new ones, if those test anything extra.
I say "poor-mans" version because those ignore "annotation" for example.
Yeah okay, I kind of agree, but this is only a valid assumption if this LSP server is the only source of completions which use the |
Yes, but that's intentional since we can't implement things the way spec intended due to ST limitations so we have to use heuristics or optimize for specific cases. |
* main: Clear pull diagnostics on file closed (#2224) html-escape diagnostic-related strings (#2228) Allow style overrides for inlay_hints.css (#2232) Fix exception for null response id (#2233) Add "outline" as an option for "document_highlight_style" (#2234) remove accidentally committed files Improve label detail support in completions (#2212) Update clojure-lsp docs (#2226) Add support for pull diagnostics (#2221) update test MockManager after API change add a client option for hiding non-project diagnostics (#2218) Fix some features might not work with dynamical registration (#2222)
Before:
After: