Where is the documentation on Visual Studio's decorators? - visual-studio

Note: This is not for Visual Studio Code, but for the full version of Visual Studio.
When developing extensions for Visual Studio Code, there is something called Decorators, which can add icons next to each line of code.
I'd like to do the same, but for Visual Studio instead. However, I can't find anything by the name "Decorators" in the documentation. Is it even called that within the full Visual Studio?
Can anyone point me in the right direction?
More specifically, I am interested in making an extension that can produce the icons seen here, and I am unsure what these icons are called in the scope of Visual Studio:

Vertical part where icons are shown is called "glyph margin" and icons in it are called "margin glyphs". Provided link will lead you to a MSDN walkthrough to create your own glyph for a line that has a "todo" text in a comment.

I found a sample that describes it pretty well:
https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/Todo_Classification

Related

Code color code and highlighting for unity

I have just starting learning how to make games in Unity, using Visual Studio as the Script Editor, I see other people have their Code colour coded and it also has auto completion.
I've followed some tutorials online but nothing has worked for me.
what do I have to install to get it working?
To add auto-completion you have to add the unity visual studio package. To add this package please type in your windows search field: "Visual Studio Installer" and then click at the visual studio version the button "change". After that, a new window opens in this window click the field with the unity package and then install this package. Now you have auto-completion in Visual Studio.
To add colors look this video: https://www.youtube.com/watch?v=_g1TyAGk6Lk& I really recommend this color theme.
The Color Coding of Code can be found on the Tools>Options>Environment>Fonts and Colors. For example, you want to change the color for the Operators (+, -, /, *, etc.), you would need to find it in the Display items List and edit (found on the Right Side of the Display Items) the color of the foreground (the text itself), it's background or whether it is displayed in bold or not.
I believe that auto completion or IntelliSense is on by default as for what I have Experienced in switching from MonoDevelop to Visual Studio 2017.
Actually, i think you're looking at a popular visual studio plugin called Resharper;
https://www.jetbrains.com/resharper/
It also has a Unity3D plugin (for resharper) which adds full support. That's were the coloring and extra intellisense comes from.
You can see some sample pictures here; https://github.com/JetBrains/resharper-unity

Changing text of editor for Visual Studio 2017

I'm trying to create a cool extension where I want to do something like below.
Once you have my extension installed, It will get the current line code of visual studio editor when you press some shortcut and then add something at the end of a current line of code.
P.S. I'm not building any analyzer I'm creating a productivity extension which will help people increase their productivity.
I have already gone through the MSDN documentation available for that but I'm really confused which one I should use. See the below link.
https://msdn.microsoft.com/en-us/library/dd885474.aspx
Can anybody who has created an extension guide me.

Refactor menu missing from Visual Studio 2015

I am having trouble finding the right-click context menu in Visual Studio 2015. I know that nothing is wrong with my project or the file I am working. I can find the right-click context refactor menu in Visual Studio 2013. However, in Visual Studio 2015 there isn't a refactor context menu in the right-click context menu.
Where did it go? How do I get it back?
Your suggestion cannot include menu Edit → Refactor.
I have tried to reset my Visual Studio settings back to default using menu Tools → Import and Export Settings and that didn't bring the menu back either.
Some of the refactoring tools have been relocated or are at least accessible in a different manner than they were previously.
Using the extract method refactor as an example, you can still use this function; it is just not done the same as before:
Right click
Quick actions
Click extract Method
I think they've changed it to feel more "ReSharper"ey. All of the functionality should still be there however.
Here's more information on refactoring in Visual Studio 2015 - hopefully this helps! Refactoring (C#)
You no longer need to access the refactoring using the mouse right click.
It is recommended that you use the keyboard shortcut keys within Visual Studio.
For all possible shortcut keys, see Default Keyboard Shortcuts in Visual Studio, Refactor.
You might need to build the project to get it to work.
See Code Editing ASP.NET Web Forms in Visual Studio 2013 | Microsoft Docs. (If it is missing then the point is that I am using an example provided by Microsoft.). In Refactoring and Renaming see To extract a method in a C# page. When I follow the instructions I cannot find the feature to extract the code to a method. When I tried the Edit menu it said I did not have valid code. Then I built the project and the feature to extract the code was available and worked.
If you change the name of the object you are refactoring, the light bulb then appears to the left which asks if you wish to change the name of the object (i.e. refactor) or generate a new constructor for the new named object.
Ctrl + . is the shortcut key for extracting a method in Visual Studio 2015 and onward.
Ctrl+M, R does not work anymore in new versions.

How do I get access to existing icons from other components from a VS package?

I have a Visual Studio package, and I want to display the VS snippets icon - how can I get it?
I found that I needed to use IGlyphService passing in StandardGlyphGroup.GlyphCSharpExpansion and StandardGlyphItem.GlyphItemPublic. This gets me back the standard "scissors" icon for snippets.
You can get the Visual Studio icons from the Visual Studio Image Library. Simply search for snippet to find the snippet icons (sometimes it is quite hard to find a specific icon).
This icons can be freely used AFAIK. The only restriction is, that the have to be used the way they are intended to be used (don't use a delete icon for a menu item that triggers a create operation etc.)

Highlight all references to X?

The Eclipse IDE has a neat little feature that I really miss in Visual Studio.
If I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope.
I can't seem to find an option to turn on similar behaviour in VS2008 or Resharper 4. I know VS has a Find Usages function, but I'd like to do it automatically on the fly.
Does anyone know of a free addin which will add this functionality?
If you're using ReSharper, you can highlight the usages in the file with Shift-Alt-F11. Place your cursor on the variable you want to find usages of, and press the Shift-Alt-F11 combination.
There is an add-in for Visual Studio that will do something similar called RockScroll.
When you double click on something, it will highlight all occurrences of the item you double clicked. It also changes the vertical scrollbar to a "syntax highlighted thumbnail view" showing an overview of where the item occurs in the file.
I know you mentioned ReSharper, but CodeRush has a nice references window that you can dock and let it search for things on-the-fly or on demand. As a bonus, you can select each usage and it will show you the context surrounding the usage. It also works for methods.
I mentioned CodeRush since they have an express edition, which looks like it includes that feature, but I haven't tried that edition.
Visual Studio 2010 has sorta implemented this, but the feature is somewhat lacking. There is a non-configurable delay between placing the cursor and highlighting.
The RockScroll Addin is not available for Visual Studio 2010 and above.
As a replacement, the free "Highlight all occurrences of selected word" plugin will highlight all occurences of the selected string after a doubleclick. There is no delay as with the native vs2010 highlighter.
It is string-based, which means it works inside comments and string literals.
Microsoft published a tool that sort of does what you want.
Some of my favourite features:
Enhanced Scrollbar
Auto Brace Completion
Ctrl + Click Go To Definition
Open Containing Folder
and the list goes on.
For Visual Studio 2010 and for Visual Studio 2012

Resources