Skip to content
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

Goto definition on indexer #70349

Closed
vsfeedback opened this issue Oct 12, 2023 · 8 comments
Closed

Goto definition on indexer #70349

vsfeedback opened this issue Oct 12, 2023 · 8 comments

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Goto definition is not working for indexing operators. Hovering over the square brackets shows the correct definition, but there F12 does not go to the definition.


Original Comments

Feedback Bot on 7/21/2023, 01:45 AM:

(private comment, text removed)

Feedback Bot on 7/24/2023, 06:42 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 7/24/2023, 07:25 PM:

(private comment, text removed)

Peter Svahn on 8/9/2023, 10:00 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 7/24/2023, 07:25 PM:

(private comment, text removed)

Feedback Bot on 8/2/2023, 00:00 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 8/15/2023, 10:24 PM:

(private comment, text removed)


Original Solutions

Nicole Hu [MSFT] solved on 8/30/2023, 11:47 PM, 0 votes:

We are unable to investigate this issue further without the additional information requested. If you are able to provide more information, you can request the issue being reactivate below. See our guidelines for further information about our process.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 12, 2023
@arunchndr arunchndr added Go To Definition Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 13, 2023
@arunchndr arunchndr added this to the 17.9 milestone Oct 13, 2023
@CyrusNajmabadi CyrusNajmabadi removed their assignment Oct 13, 2023
@SylwesterZarebski
Copy link

How to reproduce:

  • define code:
public class Indexer
{
    public bool this[int index] => index != 0;
}

public class Test
{
    public void Method()
    {
        var indexer = new Indexer();
        var value = indexer[0];
    }
}
  • set cursor on ; (between closing square bracket ] and ;) in indexer[0] line,
  • press F12 and get - Cannot navigate to the symbol under the caret.

It should be possible to go to this[int index] line in Indexer class.

@arunchndr arunchndr modified the milestones: 17.9, Backlog Oct 28, 2024
@CyrusNajmabadi
Copy link
Member

Closing out as no repro. Go-to-def before the [ takes you to the indexer.

@SylwesterZarebski
Copy link

Please reopen issue, because it looks like You did not understand bug. It is not about going to indexer variable var indexer..., but going to indexer property this[int index] => index != 0;.

@CyrusNajmabadi
Copy link
Member

@SylwesterZarebski

but going to indexer property this[int index] => index != 0;.

Yes. That's what happens.

@SylwesterZarebski
Copy link

SylwesterZarebski commented Jan 26, 2025

Just opened newest VS 2022 17.12.4 and pressed F12 on indexer[0] with cursor between r and [ and F12 moved cursor to var indexer.... What version are You using? Are You using Resharper, which add this capability?

@CyrusNajmabadi
Copy link
Member

CyrusNajmabadi commented Jan 26, 2025

@SylwesterZarebski:

Image

There is no resharper involved. This is vanilla VS.

@SylwesterZarebski
Copy link

SylwesterZarebski commented Jan 27, 2025

Thanks. I see that You are using preview version, not stable. Which version is it?
I've checked on latest stable = 17.12.4, which do not have mentioned behaviour.
I've also browsed through completed issues on https://developercommunity.visualstudio.com/fixes, but did not find any mention about this issue.

Could You check on stable version to confirm, that this is (or could be) a new version capability?

Edit: My behaviour:
https://github.com/user-attachments/assets/33dcb77a-dd6e-4184-9957-af3809f7262a

@CyrusNajmabadi
Copy link
Member

Preview versions can be installed side by side with normal releases. You can try out the preview version here: https://visualstudio.microsoft.com/vs/preview/

Cheers!

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

No branches or pull requests

4 participants