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

Completion item details #9891

Closed
wants to merge 3 commits into from

Conversation

kjeremy
Copy link
Contributor

@kjeremy kjeremy commented Aug 14, 2021

Implement basic CompletionItemLabelDetails support.

Fixes #7565

image

@kjeremy
Copy link
Contributor Author

kjeremy commented Aug 14, 2021

Currently depends on my fork of lsp-types. The above screen shot shows the type being used as the description field but it should really be used as details. However this doesn't look as good. We can play around with it.

@kjeremy
Copy link
Contributor Author

kjeremy commented Aug 14, 2021

It may be cool to do something like remove the fn signature from the label and put it into the details field so you get something like the second image in microsoft/vscode#39441 (comment)

@@ -15,4 +15,5 @@ pub struct CompletionConfig {
pub add_call_argument_snippets: bool,
pub snippet_cap: Option<SnippetCap>,
pub insert_use: InsertUseConfig,
pub label_details: bool,
Copy link
Member

Choose a reason for hiding this comment

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

It feels like this is strictly LSP-specific, and affects only how we convert ide::CompletionItem to lsp_types::CompletionItem. So, this setting should only exist in the rust-analyzer crate.

Copy link
Contributor Author

@kjeremy kjeremy Aug 14, 2021

Choose a reason for hiding this comment

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

I'm not so sure. For instance: if the client supports label details and we have on the fly imports enabled it may make sense to move the (use import::path) out of the label and render it as part of the CompletionItemLabelDetails. We would do something similar for (as Trait)

@matklad
Copy link
Member

matklad commented Aug 30, 2021

triage: this could switch to the upstream lsp-types.

@kjeremy
Copy link
Contributor Author

kjeremy commented Aug 30, 2021

Yes. I haven't had a chance to finish this yet.

@Milo123459
Copy link
Contributor

Are there any updates on this?

bors added a commit that referenced this pull request Jul 18, 2022
Add simple support for completion item details

Supercedes #9891

This doesn't yet really implement anything new, it just adds the scaffolding for the protocol conversion
@Veykril
Copy link
Member

Veykril commented Jul 18, 2022

In order to clean up stale PRs I updated the basic parts of this and opened #12807 with that

@Veykril Veykril closed this Jul 18, 2022
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.

Support CompletionItemLabel
4 participants