Skip to content

Consider showing completion item detail if available for all list items #39441

Closed

Description

@bmewburn

Take the following completion list.

screenshot from 2017-12-02 09-22-52

Each Client item belongs to a different namespace. If the completion item detail was shown immediately for each item then users could, at a glance, easily identify the relevant item out of a list of similarly labeled items. I suppose the argument against is that this can be done by modifying the label to include this, but then what is the role of the detail property?

Activity

  1. bmewburn commented on Feb 7, 2018

    @bmewburn
    Author

    Furthermore, if an extension author does try and add detail to the label to work around this limitation, then it can end up with incorrect highlighting as shown below.

    screenshot from 2018-02-07 20-07-35

  2. olafurpg commented on Feb 13, 2019

    @olafurpg

    Any pointers on how to contribute a fix displaying the "detail" field if it's available? This seems like a low-hanging fruit that would greatly improve the user experience in cases like below

    2019-02-13 11 37 35

  3. gabro commented on Feb 13, 2019

    @gabro

    As an extra data point, the Java LS works around this by including the package in the "label":

    image

  4. bmewburn commented on Apr 30, 2019

    @bmewburn
    Author

    Gabriele Petronella (@gabro) , when using the label do you find it can cause incorrect highlighting as in the example above, though?

  5. olafurpg commented on Apr 30, 2019

    @olafurpg

    Ben Mewburn (@bmewburn) the highlighting works out ok in my experience if you update the filter text to not include the appended namespace.

  6. jrieken commented on Dec 11, 2019

    @jrieken
    Contributor

    fyi - I plan on implementing this for the next (Jan 2020) release and that "label + detail" workarounds will then look bad. Because of that we might start with having this behind a setting

  7. jrieken commented on Jan 3, 2020

    @jrieken
    Contributor

    This should also help with Java which often presents a very busy IntelliSense box, where too much is rendered as label. cc Rome Li (@akaroml)

    Screenshot 2020-01-03 at 12 40 08

  8. 65 remaining items

  9. jrieken commented on Jun 21, 2021

    @jrieken
    Contributor

    I've been putting (...) on the end of the method which was perhaps because putting the whole sig there was really noisy when it wasn't faded

    This is how a fake sample would look today. The rendering and fading level can certainly be tweaked. If we go with signature and drop type we could also make qualifier rendering different.

    Screen Shot 2021-06-21 at 17 44 38

    It doesn't look good when combined with qualifier. There is some alignment and spacing issues...

    Screen Shot 2021-06-21 at 17 55 52

  10. jrieken commented on Jun 21, 2021

    @jrieken
    Contributor

    As for the parameters vs. signature question, I’m in favor of matching what LSP does, which is currently proposed to be parameters. I’m a bit surprised that LSP is choosing to encode so much semantic meaning into what seems to me like

    LSP proposals are usually a clone of VS Code API proposals. Until a week ago it was still parameters in VS Code but we decided to change that and LSP apparently didn't catch-up. The question about encoding semantics isn't answered tbh - completion does use program'ish lingo in some places, like its kinds . The use of name, signature, qualifier is more for a lack of good alternatives and to provide minimal guidance. I am open for suggestions, but I believe the usual triple of label, description, and detail won't work well...

    What we’re hoping for is an API that would let us set label details for every item visible in the UI, plus a (potentially quite large) overscroll amount.

    The problem is that scrolling doesn't happen in the usual linear fashion. Users "type to select" which means they are very likely to see a mix of resolved and unresolved items until they have typed "enough" to only see few, resolved items. Like, ts returns 10000 items with top100 resolved. Now, the user types and with that removes/filters say 3000 items which means from the top100 only every third item is resolved, or none, or only one... Now you have a happy mix of resolved and unresolved items and ts would be busy catching up with the typing-speed of its user.

    I do agree that the ts challenge is separate from the shape of this API (cough, cough #88757) and I don't want to block other extensions any longer because of that. I am not yet convinced that lazy resolving is the answer because I don't believe the UI will feel good but I am happy to try. Indeed, I did start a prototype which operates with incomplete completion lists and resolves in batches. I just couldn't parse the detail-information into a usable format and I do acknowledge that the incomplete result approach is very complex. Maybe ts can divide this into smaller problems, like have complex labels for member completion or something else low hanging. I also don't quite understand why this is so expensive for auto-imports. The full path is already there, we make it relative to the workspace and wouldn't making it relative to the project instead be all?

    computing signatures and qualifiers is a lot of work for a potentially unbounded number of global completions, and we don’t feel like we have any room to slow down

    On a related note: we do have requests to allow extensions to differentiate between automatic and explicit requests for completions. Users that have pressed ctrl+space are likely more willing to wait than those that use completions as you type. This has been raised explicitly for global completions (by Java) and I do believe it's an issue independent of complex labels or not. Yes, complex labels have the potential to slow down this unpredictably complex operation but they are not the root cause.

  11. andrewbranch commented on Jun 21, 2021

    @andrewbranch
    Member

    Users "type to select" which means they are very likely to see a mix of resolved and unresolved items until they have typed "enough" to only see few, resolved items. Like, ts returns 10000 items with top100 resolved. Now, the user types and with that removes/filters say 3000 items which means from the top100 only every third item is resolved, or none, or only one... Now you have a happy mix of resolved and unresolved items and ts would be busy catching up with the typing-speed of its user.

    The thing I’m confused about is, this is already essentially what’s happening with isIncomplete. I’ve added a bunch of optimizations that make our incomplete-triggered requests really fast (15–30ms), but if I add some delay in there, I can see that the completion list UI is totally static while waiting on the response. I don’t see how that’s different from what I’m suggesting, except that my suggestion can also apply to a linear scroll while not typing.

  12. jrieken commented on Jun 22, 2021

    @jrieken
    Contributor

    Todays thinking behind isIncomplete is incomplete wrt the number of items returned, not wrt to the depth of items. However, it does allow for such an experiement. I also do agree that the UI lacks a "loading more" indication. This is a little tricky because often we are dealing with complete and incomplete results at the same time and we don't want to block the whole UI. By now we have an optional suggest status bar and that could show some kind of loading indication.

  13. jrieken commented on Jun 22, 2021

    @jrieken
    Contributor

    On the UI and API - the current thinking is to reduce this to: label, signature, and qualifier. There needs to be a better name for "signature" because it is meant to be arguments and return type, or type annotation etc... So, maybe avoid programming lingo and use detail. Also two rendering styles: (1) all in one row (with spacing and opacity tweaks) or (2) right align the qualifier portion

    Screen Shot 2021-06-22 at 11 48 29

    Screen Shot 2021-06-22 at 11 45 47

  14. DanTup commented on Jun 22, 2021

    @DanTup
    Contributor

    There needs to be a better name for "signature" because it is meant to be arguments and return type, or type annotation etc... So, maybe avoid programming lingo and use detail

    I was just coming to suggest detail or description (both used elsewhere). Although it may be a little confusing there there's detail directly on the CompletionItem and now also on the name.

    Of the screenshots I prefer the second one - the first one makes it difficult to scan the filenames (which might be important if you're trying to pick something based on that because there are duplicate identifiers).

    What will be shown in the case where the extra information popup is visible? Will any of this information disappear and/or be shown there? (given that it may be truncated here, it seems like it'd be useful to show in the other popup too, but it's not clear if VS Code would do that or we should make it part of the documentation).

  15. jrieken commented on Jun 22, 2021

    @jrieken
    Contributor

    I was just coming to suggest detail or description (both used elsewhere). Although it may be a little confusing there there's detail directly on the CompletionItem and now also on the name.

    Some thoughts over here. Tendency to go with the triple of label, detail and description

    What will be shown in the case where the extra information popup is visible? Will any of this information disappear and/or be shown there?

    No changes for the details widgets planned. It should show items details and doc as it always does.

  16. jrieken commented on Jun 28, 2021

    @jrieken
    Contributor

    This is what has been finalized. Those that can, please give it a try and report back with concerns and issues.

    vscode/src/vs/vscode.d.ts

    Lines 3978 to 4001 in 24f9000

    /**
    * Represents a structured label for completion items.
    */
    export interface CompletionItemLabel {
    /**
    * The label of this completion item. By default
    * this is also the text that is inserted when selecting
    * this completion.
    */
    label: string;
    /**
    * An optional string which is rendered less prominent and directly after {@link CompletionItemLabel.label name},
    * without any spacing. Should be used for function signatures or type annotations.
    */
    detail?: string;
    /**
    * An optional string which is rendered less prominent and after {@link CompletionItemLabel.detail}. Should be used
    * for fully qualified names or file path.
    */
    description?: string;
    }

  17. locked and limited conversation to collaborators on Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api-finalizationfeature-requestRequest for new features or functionalityon-release-notesIssue/pull request mentioned in release noteson-testplansuggestIntelliSense, Auto CompleteuxUser experience issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions