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 #763
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 we want are below. Feel free to change the naming of the example types.
Confirmed reference (i.e. passes semantic checking): e.g. Type.ConfirmedReference
Not a reference (i.e. has the same name, but fails semantic checking -- these non-references might be desired in some cases), e.g. e.g. Type.NotAReference
Reference in a comment, e.g. e.g. Type.CommentReference
Reference in a string, e.g. Type.StringReference
Reference in an inactive (preprocessor) region, e.g. Type.InactiveReference (Note: Comment/String references take precedence, so this only applies to identifiers).
Confirmation in progress, e.g. Type.PendingReference
Cannot confirm reference (due to some bug or "by design" limitation), e.g. Type.UnknownReference
It's possible other reference types might be desirable as well for other languages or scenarios.
This is the screenshot from VS:
Our current "workaround" is to either send back multiple "types" merged together (ambiguously) or allow users to filter out types via a setting or a progress UI button, e.g. "show confirmed references", "show unconfirmed references" (i.e. 6 and 7).
We also want a similar "type" to be returnable with textDocument/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:
I have a similar use case where there are some things that are not direct references but would be useful to include in results. For example, when using a Builder pattern:
export interface User {
name: string; // Do find references on `name` here
}
const builder = new UserBuilder();
builder.name = "Danny"; // This is not a direct reference
const user = builder.build();
If the user does Find References on User.name they're likely looking for places that read or set that field. But since writes to it are done via a builder, none of them would show up (only the implementation in the builder that produces the User).
Activity
sean-mcmanus commentedon May 29, 2019
We also want a similar "type" to be returnable with textDocument/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:

DanTup commentedon Mar 10, 2022
I have a similar use case where there are some things that are not direct references but would be useful to include in results. For example, when using a Builder pattern:
If the user does Find References on
User.namethey're likely looking for places that read or set that field. But since writes to it are done via a builder, none of them would show up (only the implementation in the builder that produces the User).(See microsoft/vscode#144699).