Available in the Visual Studio marketplace
See it in action (click image to open YouTube)
Create links between any files. Useful if your project or solution contains code in multiple languages or you wish to link to documentation files also in the solution.
- Open the file.
- Open the file and go to a specific line.
- Open the file and go to specific text.
- Open any file (as specified by absolute path or using macros in file paths).
- Run arbitrary commands.
When a comment contains the text link:
followed by a file name, a green button will be added that when clicked will open that file.
There are lots of ways to customize the linking experience.
You can open the file at a specific line by putting #L
and the line number (e.g. #L25
) immediately after the file name.
// link:mapManager.js#L25
You can open the file at a place where specific text is found by placing :
immediately after the file name and then the text to search for.
For compatibility with text fragment anchors you can also use #:~:text=
after the file name to specify text.
The following two links have the same behavior.
// link:mapManager.js:UpdateLocalData
// link:mapManager.js#:~:text=UpdateLocalData
Searching starts from the top of the file and goes down line by line.
Any words after the file name or search term should be automatically ignored. If you find that something isn't being detected correctly you can escape the name (and, optionally, search terms) by enclosing them in quotes. This is also how you support search terms that include spaces.
// Go to link:"include/mapManager.js" and see ...
Files will be found anywhere in the solution, even in other projects. If you have more than one file with the same name, you can specify the directory name the file is in too.
// link:include/mapManager.js
The following macros are supported in file paths:
$(ItemPath)
- The full path of the current file.$(ItemDir)
- The directory containing the current file.$(ProjectDir)
- The directory containing the project file the current file is part of.$(SolutionDir)
- The directory containing the solution file the current file is part of.
These macros can be used in combination with file names and search terms or line numbers.
// link:$(ProjectDir)\docs\readme.md#L10
Open any file from disk by specifying the full path.
// See the log file at link:C:\Temp\logs\analysis-report.log
Open a file anywhere in the file structure above the current file.
For example, the following will search for, and open, a file called README.md
in any directory in the current path.
// link:...\README.md
Run arbitrary commands to open files or invoke applications by including run>
after link:
and before the command to execute.
// Change personalization settings to see the full effect link:run>ms-settings:personalization
// Open a command window - link:run>cmd.exe
// Pass arguments to an application:- link:run>"cmd.exe /?"
// Open a file (in the default app) - link:run>C:\path\to\document.pdf
It is possible to navigate within the same file by specifying the name of the file. When navigating within a file specified by name, any search term will be looked for when opening another file, but will not match the line containing the link that was clicked.
There are also shortcuts for navigating within the same file to a specified search term.
You can prompt to search above the line with the link by specifying ^
instead of the file name.
// Link:^:"some text"
When using a link like the one above, it will start on the line above the link and search up towards the top of the file. If the search text is not found, the focused line will not change.
You can prompt to search below the line with the link by specifying v
instead of the file name.
// link:v:Something
When using a link like the one above, it will start on the line below the link and search down towards the bottom of the file. If the search text is not found, the focused line will not change.
Creating links is easy. Right-click where you want the target of a link, or select the text to search for and easily copy the link to the clipboard so you can paste it where you need it.
Functionality has increased over time in response to feedback. Change Log
Please raise an issue if you have feature requests.