Visual Studio - I want “Go To Definition” to open Object Browser, not “metadata”

后端 未结 4 743
后悔当初
后悔当初 2021-02-04 05:05

In Visual Studio version 2002 and 2003 \"Go To Definition\" would find the selected type or member in the Object Browser. In 2005 onwards it opens a source window \"generated fr

相关标签:
4条回答
  • 2021-02-04 05:22

    I believe what re-sharper is doing is doing some hooks on that click event with the Visual Studio SDK I do not think there is any simple menu or location that can change that setting.


    Instructions (pulled from CODE Magazine) edited down a bit to the part that pertainst to making the right click menus.

    Creating a VSPackage

    ...The VS SDK installs a few more project templates in Visual Studio, one of them being the Visual Studio Integration Package (Figure 1), located under Other Project Types > Extensibility on the New Project dialog box.

    After this standard dialog box, the Visual Studio Integration Package Wizard guides you through creating the new package project:

    1. Select a programming language. The wizard currently supports Visual C++ and Visual C#. You can create or pick a key file to sign the new package.
    2. Supply basic VSPackage information. The wizard prompts you for details such as the company name, VSPackage name, version, icon, detailed information, and minimum Visual Studio edition (such as Professional or Enterprise) that the package is designed to at this step. This information goes into the Visual Studio splash screen and About dialog box and is also used to request a PLK for the package (covered later).
    3. Select VSPackage options. A package may add three types of functionality: Menu Command, Tool Window, and Custom Editor.

    A menu command is a command added either to the menu at the top of Visual Studio or to a context menu (right-click).

    When the wizard finishes its job, the VS SDK adds core elements to the solution to support the new package. For instance, if you selected Tool Window as part of the functionality for the package, the project contains a user control where you should place the visual controls for the window. The project also contains files for .NET code to handle the functionality that you will add to the package.

    A CtcComponents folder contains pseudo-C++ files (ctc files) where you define things like menu, groups, buttons, etc. Fortunately, Microsoft is phasing out CTC files and replacing them with a friendlier, XML-based VSCT file format (which will ship in the SDK for Visual Studio 2008).

    The wizard creates a few other files with .NET code required for the plumbing of the package within Visual Studio. Some of these files contain classes that map the C++ constants to .NET constants and other files contain configuration information for the package when it’s installed.

    0 讨论(0)
  • 2021-02-04 05:33

    Place the mouse cursor on the object you want to access on the object browser. Then, use the keyboard shortcut ctrl + alt + j, which will take you directly to the Object Browser window.

    0 讨论(0)
  • 2021-02-04 05:37

    I know it has been a long time, but it appears, at least in newer versions of Visual Studio for the VB (Basic) language, to be an setting in the options. Text Editor > Basic > Advanced Under "Go to Definition".

    I don't know why they don't have that for other languages...

    0 讨论(0)
  • 2021-02-04 05:39

    As workaround you can create the following macro:

    Sub GoToDefinitionUsingObjectBrowser()
        DTE.ExecuteCommand("Edit.SelectCurrentWord")
        DTE.ExecuteCommand("View.ObjectBrowser")
        DTE.ExecuteCommand("View.ObjectBrowserSearch", DTE.ActiveDocument.Selection.Text)
    End Sub
    

    Then go to Tools/Options/Keyboard and assign hot key for this macro.

    Tested in Visual Studio 2010.

    0 讨论(0)
提交回复
热议问题