Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio link to different areas of code

Tags:

just wondering is there any feature in visual studio 2010 that allows you to put a link in your comments that take you to another part of the solution. Kind of like the bookmark feature but you go to the bookmark by clicking on the link.

I just think it would be neat to put a link to the unit test for each of my methods.

like image 644
Diskdrive Avatar asked May 25 '11 01:05

Diskdrive


People also ask

How do I navigate code in Visual Studio?

Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it. Alternatively, you can use Ctrl+Alt+- and Ctrl+Shift+- to navigate between files and edit locations.

How do I link two HTML pages in Visual Studio Code?

Step 1: To link two pages in HTML, you might want to start by opening your template text file and navigate to file>save as. This will open up a dialogue box. Now, navigate to your HTML folder. Step 2: Save the new web page you've created in your desired folder.


2 Answers

If you're using Resharper then you can navigate to any valid symbol placed in a doc-comment with ctrl-click.

For example

/// <summary>
/// <see cref="AReferencedMethod"/>
/// </summary>

Just ctrl-click and you're there.

Unfortunately I'm not sure this would be useful for referencing unit tests since the assembly under test is usually referenced by the unit test assembly not the other way around.

like image 89
Phil Avatar answered Sep 17 '22 18:09

Phil


You can bake in a direct link to a file using the hypertext comment link like this:

//file://c:\users\project\myfile.cpp

However that opens the file in the built-in browser, not the code editor, which isn't much use. It also needs the full path as it doesn't seem to register project variables like $(SolutionDir).

However, if anyone on here is savvy at writing Visual Studio Plugins, I think an override of the hyperlink system would be a good place to start to get this working.

: D

like image 24
Danny Parker Avatar answered Sep 19 '22 18:09

Danny Parker