-
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
Move lsp detail into autocomplete annotation #1569
Conversation
References #1549
There is no need to have a duplicate text in the "detail" field (at the bottom of the popup). The logic should probably be to flip those values. |
So the |
I think having the lsp_label in the st_details slot should be sufficient. Try this? diff --git a/plugin/core/views.py b/plugin/core/views.py
index ac54b66..de70476 100644
--- a/plugin/core/views.py
+++ b/plugin/core/views.py
@@ -662,21 +662,19 @@ def format_completion(
lsp_label = item["label"]
lsp_filter_text = item.get("filterText")
- lsp_detail = html.escape(item.get("detail") or "").replace('\n', ' ')
-
- if lsp_filter_text and lsp_filter_text != lsp_label:
- st_trigger = lsp_filter_text
- else:
- st_trigger = lsp_label
-
- st_annotation = item.get("detail") or ""
+ st_annotation = (item.get("detail") or "").replace('\n', ' ')
st_details = ""
if can_resolve_completion_items or item.get("documentation"):
st_details += make_command_link("lsp_resolve_docs", "More", {"index": index})
- st_details += " | " if lsp_detail else ""
- st_details += "<p>{}</p>".format(lsp_detail)
+ if lsp_filter_text and lsp_filter_text != lsp_label:
+ st_trigger = lsp_filter_text
+ if st_details:
+ st_details += " | "
+ st_details += "<p>{}</p>".format(html.escape(lsp_label))
+ else:
+ st_trigger = lsp_label
# NOTE: Some servers return "textEdit": null. We have to check if it's truthy.
if item.get("textEdit") or item.get("additionalTextEdits") or item.get("command"): |
Sorry I didn't have time on hand yet to try this. I'll be getting back to this on the weekend |
Keep in mind that
Which means that there are probably servers that will return the |
I applied the patch from rwols and wanted to test this a bit. I noticed that on tyescript/javascript the support is still lacking a good bit behind vscode, but that's probably unrelated to this because the information is neither in label nor detail @rwols for clangd, how is the support with the latest patch that you provided? |
I totally missed that you wrote a reply, sorry for the delay.
It looks okay. I think we should move to putting the lsp_label in the st_detail slot anyway, because we can use minihtml in the st_detail slot. That means that we can add coloring for #1570.
True. But the lsp_details are then shown with the "More" button. |
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.
Let's try this out. It's a tiny diff so it's easy to blame/revert anyway.
Move
item.get("detail")
into st_annotation to effectively inline typehintsTested so far only with Golang
References #1549