Skip to content

Add "type" to textDocument/references results (icon, filtering) #74237

Open

Description

The C/C++ extension wants to be able to send back references of different types that users can determine what "type" of reference it is and filter out unwanted types -- in order to provide functionality equivalent to Visual Studio 2019. The types are

  1. Confirmed reference (i.e. passes semantic checking): reference icon
  2. Not a reference (i.e. has the same name, but fails semantic checking): cancel icon
  3. Reference in a comment: comment icon
  4. Reference in a string: string icon
  5. Reference in an inactive (preprocessor) region: ? icon (or a better one, since it conflicts with 7)
  6. Possible reference (Confirmation in progress): progress icon?
  7. Possible reference (Confirmation canceled): ? icon (or a better one, since it conflicts with 5 and 7) -- this "type" doesn't exist in VS, but it seems like it should (at least for us).
  8. Cannot confirm reference (due to some bug or "by design" limitation): ? icon

This is the screenshot from VS:

image

Our current "workaround" is to only send back Confirmed References (number 1), although we also plan to have some progress UI with a button that allows users to view the Confirmation in progress (number 6 items, merged in with number 1 items). We're currently implementing this for June: microsoft/vscode-cpptools#15 .

The relevant LSP that would need to be changed is at
https://microsoft.github.io/language-server-protocol/specification#textDocument_references

Activity

  1. dbaeumer commented on May 24, 2019

    @dbaeumer
    Member

    Sean McManus (@sean-mcmanus) just to clarify: you are asking for a change of the LSP request and an implementation of the UI in VS Code?

  2. sean-mcmanus commented on May 24, 2019

    @sean-mcmanus
    ContributorAuthor

    Dirk Bäumer (@dbaeumer) Yes -- I wasn't sure if I should file a separate issue on the LSP site or not.

  3. dbaeumer commented on May 27, 2019

    @dbaeumer
    Member

    Sean McManus (@sean-mcmanus) yes, please file a separate issue on the LSP side since this might be tackled independently from VS Code.

  4. jrieken commented on May 27, 2019

    @jrieken
    Contributor

    Not a reference (i.e. has the same name, but fails semantic checking): cancel icon

    This is funny. Searching for references returns references which are not references?

    Confirmation in progress: progress icon?

    How should that work? Will the result update when confirmation is done or does the user re-run reference search? The former doesn't fit nice into our provide-and-forget model, the latter isn't IMO the best UX

  5. sean-mcmanus commented on May 28, 2019

    @sean-mcmanus
    ContributorAuthor

    Yes -- the "Not a reference" means the name is the same, but the IntelliSense type check failed. There are scenarios where users may want to still see what non-references got filtered out.

    Our pending implementation for C++ Find All References is able to quickly get a list of "unconfirmed references" that match lexically, but semantic checking requires that every file with a reference needs to get compiled by our IntelliSense process, which could take a long time, so due to the inability of VS Code to allow streaming references (#20010), we're planning to show a popup progress dialog that shows the confirmation progress with buttons to allow users to show the "confirmed references" and/or "confirmation in progress" references (i.e. "unconfirmed" references), while we continue to continue to confirm the references, but the lack of "types"/icons means either the results will be ambiguously merged or only 1 "type" at a time will be shown. The user is not expected to have to re-run the references command, because our plan is to re-run it ourselves -- to enable us to return the more complete results later on. So when confirmation is 100% done (or canceled) the results will update and the progress dialog will disappear. If you have a better UX design, please let us know. I think we had an email thread on this streaming references issue a few months ago.

  6. changed the title [-]Add "type" to textDocument/reference results (icon, filtering)[/-] [+]Add "type" to textDocument/references results (icon, filtering)[/+] on May 28, 2019
  7. sean-mcmanus commented on May 28, 2019

    @sean-mcmanus
    ContributorAuthor

    We also want a similar "type" to be usable in rename to allow users to filter out the rename results by type (I could file a separate issue if you want), but we don't plan to add Rename till July:
    image

  8. jrieken commented on May 29, 2019

    @jrieken
    Contributor

    users to filter out the rename results by type (I could file a separate issue if you want), but we don't plan to add Rename till July

    This is definitely a different issue. The rename UX/flow is not based on confirmations/uncertain data but assumes a language service with full knowledge. What you show looks more like find and replace.

  9. jrieken commented on May 29, 2019

    @jrieken
    Contributor

    So when confirmation is 100% done (or canceled) the results will update and the progress dialog will disappear.

    How do you imagine that to work? API-wise?

  10. sean-mcmanus commented on May 29, 2019

    @sean-mcmanus
    ContributorAuthor

    Johannes Rieken (@jrieken) The API for sending the the final results back is just the response message for textDocument/references, and the progress dialog was going to be a vscode.window.withProgress, but it looks like there's no option to add buttons to the progress UI for users to indicate a "show partial results"...so that is a problem :(

    We'll need to come up with some alternative way. The implementation of this might not start till a week or so.

  11. sean-mcmanus commented on May 29, 2019

    @sean-mcmanus
    ContributorAuthor

    Our current (revised) plan is to use some "Find All References..." status bar item (with hover showing the progress %) and clicking on the status bar icon gives a list of usable commands to control the Find All References behavior, i.e. show current confirmed and/or pending unconfirmed references and/or cancel. Let us know if you have a better UX idea.

  12. sean-mcmanus commented on May 31, 2019

    @sean-mcmanus
    ContributorAuthor

    I'm exploring using a "C/C++ References" Output window pane to show all the non-confirmed type of references. Example output:

    String reference: const char *s = "myFunc";
    <file>:line:column [link]

    Comment reference: // fix myFunc
    <file>:line:column [link]

    Inactive reference: int myFunc() {} // inactive definition with Windows builds
    <file>:line:column [link]

    Cannot confirm reference: int i = myFunc(); // type info not available here
    <file>:line:column [link]

    Not a reference: int myFunc; // a var
    <file>:line:column [link]

    Possible reference (confirmation in progress): int myFunc()
    <file>:line:column [link]

    Not sure yet how to best update "possible references" to another type.

    A TreeView might be better, but I'm not sure if the default References tree view would interfere.

  13. sean-mcmanus commented on Aug 28, 2019

    @sean-mcmanus
    ContributorAuthor

    For V1 we used the Output window, but we're working on V2 that adds a C++ References tree view with the other types (microsoft/vscode-cpptools#4079). So this issue could be closed unless other languages extensions want to have a similar experience built-in, e.g. if TypeScript wanted to have comment references and have a shared UI in the same tree view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apieditor-symbolsdefinitions, declarations, referencesfeature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions