-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
FindAllReferences and QuickInfo need a dual-view of tuples #20115
Comments
@dpoeschl @CyrusNajmabadi Do you have any tips on this?
One option would be to say that void M(int {|Definition:[|Alice|]|})
{
var tuple = ([|Al$$ice|], 2);
M(tuple.Alice);
M(tuple.Item1);
} void M(int Alice)
{
var tuple = ({|Definition:[|Ali$$ce|]|}: Alice, 2);
M(tuple.[|Alice|]);
M(tuple.[|Item1|]);
} I don't see a way to actually implement a dual view, as the following would be weird (involves two definitions): void M(int {|Definition:[|Alice|]|})
{
var tuple = ({|Definition:[|Al$$ice|]|}, 2);
M(tuple.[|Alice|]);
M(tuple.[|Item1|]);
} |
Why can't we change that to accept multiple symbols? :) |
I feel like i would prefer: void M(int {|Definition:[|Alice|]|})
{
var tuple = ([|Al$$ice|], 2);
M(tuple.[|Alice|]);
M(tuple.[|Item1|]);
} And i would also be ok with: void M(int {|Definition:[|Alice|]|})
{
var tuple = ({|Definition:[|Al$$ice|]|}, 2);
M(tuple.[|Alice|]);
M(tuple.[|Item1|]);
} Basically, these should all always be selected whenever you are on any one of them. Which are definitions vs references is less vital to me. For somethign that is both a reference and a definition, i think it's fine to thing of it as a reference for presentation purposes. |
Doesn't seem weird to me. It's just cascading. Which we do in many other places as well :) |
Can we handle this through cascading, where FindRefs on some symbol could 'cascade' to find-refs on a tuple-field? And vice versa? |
@CyrusNajmabadi I took at stab at this (still buggy and WIP) in #24363. So the key here is that when looking for symbols at a certain position, we may come back with two symbols instead of one. Then FAR can list the references to both symbols separately: |
To be pedantic: is that something that has been explicitly verified to be the desired behavior? in general, we haven't wanted the set of highlight-refs entities to be dependent on position. |
For the record, here are the design notes for tracking and renaming references to tuple elements: #14115 (comment) (it's just a summary, I'll try to dig up the more detailed meeting notes) |
Just found this issue in a developercommunity VS ticket. I wanted to see how many places would be affected by a change of type of a record property, and to my surprise, nothing was found. My case uses record deconstruction: record R(bool B, char C);
class C { public static R R; }
var (b, c) = C.R; //'C.R' not found as a reference to R.C |
If you select the declaration of local
a
, its usages get properly highlighted:But if you highlight the usage of
a
in a tuple, then its declaration is not properly highlighted:I think the root problem is that when you highlight a member of a tuple (including one on the left of a deconstruction), there are two views you could take: (1) you're pointing at the expression of that member, or (2) you're pointing at a member of the tuple.
Currently, QuickInfo takes the second view (see screenshots below).
There is a similar problem with anonymous types:
FYI @CyrusNajmabadi
Relates to #20116
The text was updated successfully, but these errors were encountered: