Search code examples
visual-studiovisual-studio-extensionsgo-to-definition

Implement "Navigate To Definition" (Ctrl+Click) in Visual Studio extension


I am writing a Visual Studio extension and I want to implement the Ctrl + Click command for my own file type. This is similar to the C#/C++ editor whereby Ctrl + clicking on a type name will take user to the definition of that type (aka. Go To Definition command.)

Is there any sample on how to achieve this? I searched on Microsoft Docs website but I couldn't find anything that I want.


Solution

  • Ctrl+Click Go To Definition example from VS Productivity Power Tools may get you started.

    Description https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.CtrlClickGoToDefinition

    Source code https://github.com/microsoft/VS-PPT/tree/master/src/GoToDef