In Visual Studio, is it possible to create hyperlinks inside source files that jump to a specific line of a file? I want to create a link to a specific line, like this:
// [[#DoStuff|Clicking here will take you to the method "doStuff."]]
//
//
//
//
// #DoStuff
//clicking the hyperlink should jump to the line above.
function doStuff(){
}
Is there any way to create hyperlinks in the comments that will jump to a specific method?
It looks like there's a Visual Studio plugin called HyperAddin that can do this. Unfortunately, it looks like it's only available for Visual Studio 2005 and Visual Studio 2008.
Related
I want to extract comments from code files in a Visual Studio extension. Is there a way to do it using Visual Studio Automation without having to parse code text myself?
PS: Roslyn is not a choice, because I'm not restricted to C# and VB.NET only.
Various code elements like CodeClass and CodeFunction have the Comment property that return the header comment, accessible using Visual Studio code model.
And if a document is opened in VS editor, you can check SnapshotSpan classifications for PredefinedClassificationTypeNames.Comment.
Is there a way to create custom shorthand's in Visual Studio 2017.
Just like ctor or prop?
I would like to create a shorthand for unit-tests, to just type in for instance test and then having a predefined function to edit like:
public void Method_Condition_Expected()
{
// Arrange
// Act
// Assert
}
As #Peter B has suggested for Visual Studio itself you can do it with Snippet Designer (Tools->Code Snippets Manager).
I found out right now, that my installed Tool ReSharper (2016.3) has an option to create so-called Live-Template's.
With that, I can create a Template like this:
public void $Method$_$Condition$_$Expected$()
{
// Arrange
// Act
// Assert
}
The nice part is now, that i can tab through Method,Condition and Expected and overwrite the values.
How to use: Mark a Code-Area such like the code Above in Visual Studio then click on Resharper->Tools->Create Live Template from Selection->Create and Edit.
Now wrap code-areas for tabing through with $ for instance like $Method$ and give a shortcut name such like test.
I hope this helps somebody else as well.
For a closer Comparision between Visual Studio Snippet Manager and Resharper Live Templates see Difference between Live Template and Visual Studio Snippet
There is this nice program that enable you to easily create code snippets. I already managed to create snippets but it will be nice if the snippet where to show up in visual studio's intellisense.
For example visual studio already has several built in code snippets such as the one for creating the constructor of a class:
note that it was really easy and fast to use it.
On the other hand when I create my custom snippet with the program that I provided on the first link, these are the steps that I have to do in order to use it:
on step 3 I have to select the folder where the snippet that I created is located then on step 4 locate it.
It will be nice if I could use the code snippet that I created just like the ones that visual studio provides like the constructor one that I showed on the first image. Maybe if I place the snippet that I just created and place it where visual studio store the built in onces it works.
I had to add a shortcut to the snippet.
after adding the shortcut it appears on the intellisense without having to navigate to the folder where it was located by pressing ctrl+k and ctrl+x
I can simply insert code snippet for the Console.WriteLine(); by just using the cw with Tab + Tab. But I'm not able to find the same option for the Debug.WriteLine();.
I want to know how can we customize the code snippet template in Visual Studio for Windows Phone?
In Visual Studio 2010 (and assuming other versions as well), there is not a snippet for Debug.WriteLine(). In that case, you'll need to create a custom snippet. Fortunately, it isn't that hard with the available resources:
MSDN: Creating and Using IntelliSense Code Snippets
The Snippet Editor
Snippet Designer (Visual Studio Extension) and the related CodePlex Site
If you're using ReSharper, then Code Templates and specifically Live Templates are a quick and easy option.
Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
I assume you'd like to modify the class file templates. They're in:
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
More specific details here
I found a better solution than modifying the template file directly. This utility allows you to create and save header/footer templates and apply them to entire source trees.
C# Header Designer from MSDN Code Gallery