You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add "type" to textDocument/references results (icon, filtering) #74237
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
Not a reference (i.e. has the same name, but fails semantic checking): cancel icon
Reference in a comment: comment icon
Reference in a string: string icon
Reference in an inactive (preprocessor) region: ? icon (or a better one, since it conflicts with 7)
Possible reference (Confirmation in progress): progress icon?
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).
Cannot confirm reference (due to some bug or "by design" limitation): ? icon
This is the screenshot from VS:
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 .
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
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.
changed the title [-]Add "type" to textDocument/reference results (icon, filtering)[/-][+]Add "type" to textDocument/references results (icon, filtering)[/+]on May 28, 2019
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:
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.
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.
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.
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.
Activity
dbaeumer commentedon May 24, 2019
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?
sean-mcmanus commentedon May 24, 2019
Dirk Bäumer (@dbaeumer) Yes -- I wasn't sure if I should file a separate issue on the LSP site or not.
dbaeumer commentedon May 27, 2019
Sean McManus (@sean-mcmanus) yes, please file a separate issue on the LSP side since this might be tackled independently from VS Code.
jrieken commentedon May 27, 2019
This is funny. Searching for references returns references which are not references?
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
sean-mcmanus commentedon May 28, 2019
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.
[-]Add "type" to textDocument/reference results (icon, filtering)[/-][+]Add "type" to textDocument/references results (icon, filtering)[/+]sean-mcmanus commentedon May 28, 2019
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:

jrieken commentedon May 29, 2019
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.
jrieken commentedon May 29, 2019
How do you imagine that to work? API-wise?
sean-mcmanus commentedon May 29, 2019
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.
sean-mcmanus commentedon May 29, 2019
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.
sean-mcmanus commentedon May 31, 2019
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.
sean-mcmanus commentedon Aug 28, 2019
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.