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

Allow CompletionItem.detail to show syntax coloring #34188

Closed
mjbvz opened this issue Sep 12, 2017 · 8 comments
Closed

Allow CompletionItem.detail to show syntax coloring #34188

mjbvz opened this issue Sep 12, 2017 · 8 comments
Assignees
Labels
api feature-request Request for new features or functionality suggest IntelliSense, Auto Complete
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 12, 2017

Feature request

Provide an api for syntax coloring the .detail section in a CompletionItem. For example, in:

screen shot 2017-09-11 at 7 27 40 pm

The function alert(message?: any): void text would be colorized as typescript code.

Two possible ideas on how this could be implemented:

Proposal 1

Allow detail to be a MarkdownString

export class CompletionItem {
     ...
    detail?: string | MarkdownString;
    ...
}

Pros

  • Support other text markup such as bolding text

Cons

  • Perhaps too flexible since the detail text should always be a single line and should not contain things like images or bullet points

Proposal 2

Add a new language field for the detail string:

export class CompletionItem {
    ...
    detail?: string;
    detailLanguage?: string;
    ...
}

Pros

  • Standardized API that makes it very clear what the intended use case is

Cons

  • Less flexibility

I'm more in favor of something along the lines of the second proposal

@mjbvz mjbvz added the api label Sep 12, 2017
@mjbvz mjbvz self-assigned this Sep 12, 2017
@mjbvz
Copy link
Collaborator Author

mjbvz commented Sep 18, 2017

@jrieken Can you please take a look at these proposals and let me know if you have any feedback or another idea of how this could be implemented

@jrieken jrieken added the feature-request Request for new features or functionality label Sep 19, 2017
@jrieken jrieken added this to the October 2017 milestone Sep 19, 2017
@KamasamaK
Copy link

I'm not sure if this should be a separate issue, but what about applying the same solution to SignatureInformation.label?

@jrieken
Copy link
Member

jrieken commented Oct 9, 2017

@KamasamaK The UI that shows labels is really minimal and the idea of the label is to be not much more than a single word. What is your use-case?

@KamasamaK
Copy link

@jrieken Are you referring to the UI for CompletionItem.label? It appears to me like the UI for SignatureInformation.label is largely the same as CompletionItem.detail and would be as long as the full signature which can be many words. Perhaps this is just an issue of inconsistent naming.

Here are examples from VS Code's TypeScript extension:

Completion
typescript-completion-lastindexof

Signature
typescript-signature-lastindexof

@mjbvz
Copy link
Collaborator Author

mjbvz commented Oct 28, 2017

Moving out of October as this needs some more thought.

@jrieken brought up some concerns:

@jrieken
Copy link
Member

jrieken commented Oct 26, 2020

(from #106862 (comment))

I actually don't think that we want this. Today, details show inline with the item label or atop the documentation. We cannot render markdown as inline label which would mean no-details for markdown-style-details which then would make then just like documentation. So, the low hanging thing is to use the documentation property which does support markdown and then either leave out details or have some plain text in there.

Also, we have plans for richer labels that allow to show things like label, signature, qualifier, and type (#39441). With that details would only be shown in the details panels and when omitted it isn't shown.

@jrieken jrieken closed this as completed Oct 26, 2020
@kjeremy
Copy link

kjeremy commented Oct 26, 2020

@jrieken Is that actually planned out for a release?

@jrieken
Copy link
Member

jrieken commented Oct 27, 2020

@kjeremy Do you mean #39441? The work is kinda done tbh. There is some API finalisation mostly around the question if we should name those label parts with "programming terms" like signature, qualifier, and type or if we should use generic terms like description, detail etc. What has hold us back is TS being unable to implement this and therefore us being unable to selfhost/verify this

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality suggest IntelliSense, Auto Complete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants