Command and extension examples for Visual Commander

Visual Commander is a freemium extension for Visual Studio 2012+ allowing you to automate repetitive tasks in the IDE.

v2.7 adds command and extension examples accessible from the main VCmd menu:

Click Edit to view command code, experiment with it and execute:

Note that changes in example code are not saved once you close Visual Studio. Click Save in the Command Examples window to copy the selected example to normal commands where you can persist changes and assign a keyboard shortcut to the command.

Download the installer.

Posted in Vlasov Studio tools | Tagged , , , , | Leave a comment

Changing Visual Studio 2017 private registry settings

Visual Studio traditionally includes several settings that can be set only in registry (HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\[version] key). For example, Find result format, UseSolutionNavigatorGraphProvider or EnableVSIPLogging.

Visual Studio 2015 registry settings

Visual Studio 2015 registry settings

Visual Studio 2017 continues to support these settings, but now uses the RegLoadAppKey function to store registry keys in a private binary file under %LOCALAPPDATA%\Microsoft\VisualStudio\15.0_ [id]\privateregistry.bin:

To edit this file in Registry Editor, first make sure Visual Studio is closed (plus it takes about 20 seconds for all Visual Studio background process to shutdown), then select HKEY_LOCAL_MACHINE or HKEY_USERS and then File – Load Hive…:

When the file is loaded, you can change registry settings as usual:

Don’t forget to unload the hive when finished, or you will get an unknown error loading Visual Studio:

You can automate hive loading and unloading with the following VS2017PrivateRegistry.cmd batch file (close target Visual Studio 2017 instances with the background processes and then run the file with administrator rights):

for /d %%f in (%LOCALAPPDATA%\Microsoft\VisualStudio\15.0_*) do reg load HKLM\_TMPVS_%%~nxf "%%f\privateregistry.bin"
regedit
for /d %%f in (%LOCALAPPDATA%\Microsoft\VisualStudio\15.0_*) do reg unload HKLM\_TMPVS_%%~nxf

It loads registry keys for all Visual Studio 2017 instances as HKLM\_TMPVS_[id], starts Registry Editor and unloads keys when you close Registry Editor:

If you do have multiple instances of VS 2017 installed (e.g. Community and Enterprise, or a general release and a preview) and want to find corresponding instance ids, you can use the Visual Studio Locator utility. Included with the installer as of Visual Studio 2017 version 15.2 and later at %ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe:

If you want to quickly set a registry setting to a specific value, there is a simpler approach. A running Visual Studio 2017 instance not only loads registry keys with the RegLoadAppKey function from the privateregistry.bin file, but also redirects all registry operations under the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\15.0 key to the private registry. Code running in the Visual Studio 2017 process can use standard registry API to set these settings:

var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\VisualStudio\15.0");
key.SetValue("UseSolutionNavigatorGraphProvider", 0);

Just execute the following commands once from Visual Studio (e.g. with the Visual Commander extension) to set corresponding settings: Change find result format to remove the full path, Hide class info in Solution Explorer, Show the GUID and ID of menu or command when Ctrl+Shift is pressed.

As you see, customizing Visual Studio 2017 with internal settings is still possible with a bit more work.

Posted in Visual Studio tips | Tagged | Leave a comment

New code navigation shortcuts in Visual Studio 2017

The new Go to All window in Visual Studio 2017 lets you navigate directly to any file or symbol by typing a search query:

You can open this window using keyboard shortcuts Ctrl+, or Ctrl+T assigned by default to the Edit.GoToAll command:

You can also open the Go to All window from the main Edit – Go To menu:

The main difference from the Navigate To window (existed since Visual Studio 2010) is that now you can easily limit search results to files, types, members or symbols clicking on the corresponding toolbar button. Alternatively, you can type the special character and space before the search query (e.g. f readme.txt):

Even better, instead of opening the Go to All window in the general mode, you can open it in a filter mode using following commands:

  • Edit.GoToFile (Ctrl+1, F or Ctrl+1, Ctrl+F),
  • Edit.GoToType (Ctrl+1, T or Ctrl+1, Ctrl+T),
  • Edit.GoToMember (Ctrl+1, M or Ctrl+1, Ctrl+M),
  • Edit.GoToSymbol (Ctrl+1, S or Ctrl+1, Ctrl+S).

Additionally, you can search only in the current document by clicking the corresponding toolbar button or pressing Ctrl+Alt+C in the Go to All window. And you can include contents of external items (such as files in ‘External Dependencies’ folders) in search results by clicking the corresponding toolbar button or pressing Alt+X in the Go to All window.

Limiting search to the current document is a very common scenario when navigating to a member of the current class. On the other hand, when navigating to a file, the current document option should be deselected. Unfortunately, changing the current document option in the Go to All window clears the file/member filter mode, making the switch between the two scenarios a little cumbersome.

You can change the current document option programmatically before opening the Go to All window with the Visual Commander extension. For example, the Go to a member in the current document command sets SearchCurrentDocument option to true and then calls the built-in Edit.GoToMember command:

The Go to a file in the solution command sets SearchCurrentDocument option to false and then calls the built-in Edit.GoToFile command:

You can assign keyboard shortcuts to these Visual Commander commands and have search filters preconfigured exactly as needed. (Use the SearchExternalItems property instead of the SearchCurrentDocument property to set the external items option.)

Overall, with the new filtering capabilities and keyboard shortcuts, the Go to All window provides convenient navigation to a code fragment you need.

Posted in Visual Studio tips | Tagged | Leave a comment

Tabs Studio v4.3.0 adds super groups

Tabs Studio is a Visual Studio and SSMS extension empowering you to work comfortably with any number of open documents.

v4.3.0 adds the ability to visually separate super tab groups created by PriorityGroup, MvcGroup and Sorter add-ins. See the following sample screenshots.

3 super groups of tabs organized by project and separated with 20 pixels margin:

Super groups of tabs organized by project in vertical tabs layout:

Tabs grouped by project in separate rows:

Download the installer.

Posted in Vlasov Studio tools | Tagged | Leave a comment

Semantic C# code highlighting in Visual Studio 2017

A basic code colorizer highlights language keywords, comments and string. A semantic highlighter performs full language parsing which results in very accurate understanding of code and may, for example, give local variables a distinct color to improve the comprehensibility of code.

Out of the box Visual Studio 2017 supports only user types highlighting:

SemanticColorizer extension by Andreas Reischuck can highlight local variables, class fields, parameters, properties etc.:

Codinion extension by Martin Topfstedt can highlight many more code elements, make text italic and bold, underline and overline text, set distinct font:

Codinion can also change background for code areas such as method body, region and preprocessor block:

Intelligent semantic code highlighting adds valuable information not available just from program text on the screen. Try it for yourself!

Posted in Visual Studio tips | Tagged , | Leave a comment

Tabs Studio v4.2 adds support for SSMS 17

Tabs Studio is a Visual Studio and SSMS extension empowering you to work comfortably with any number of open documents.

v4.2 adds support for SQL Server Management Studio 17, adds VS theme support to the tab context menu,
changes Marker and Saver solution settings location to the .vs subfolder in VS 2015/2017:

Download the installer.

Posted in Vlasov Studio tools | Tagged , , , | Leave a comment

Read and understand code faster with programming ligatures in Fira Code font

A ligature occurs where two or more graphemes or letters are joined as a single glyph. For example, Fira Code font by Nikita Prokopov contains a set of ligatures for common programming multi-character combinations like ++, >= or != :

Fira Code font in Visual Studio 2017

Fira Code font in Visual Studio 2017

Default Consolas font in Visual Studio 2017

Default Consolas font in Visual Studio 2017

This is just a font rendering feature: underlying code stays the same and remains ASCII-compatible – only the representation changes. Not only can multi-character glyphs be rendered more vividly, other problematic things in monospaced fonts, such as spacing can be corrected. With standard fonts your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one. Programming ligatures help to read and understand code faster:

Fira Code supports modern web browsers and many popular editors such as Visual Studio Code, IntelliJ, Atom, PhpStorm and Xcode. To install it for Visual Studio, download and unzip fonts, right click on the ttf\FiraCode-Regular.ttf file and select Install, (restart Visual Studio) and select Fira Code in Visual Studio font options:

Happy reading!

Posted in Visual Studio tips | 5 Comments