Skip to content

An extension for Visual Studio 2013+ that enables the use of macros in the IDE. The extension can record most of the features in Visual Studio including text editing operations.

License

Notifications You must be signed in to change notification settings

microsoft/VS-Macros

Repository files navigation

[Not maintained]

This extension was originally created by a group of interns on the Visual Studio team. It is no longer maintained.

Macros for Visual Studio

An extension for Visual Studio that enables the use of macros to automate repetitive tasks in the IDE. The extension can record most of the commands in Visual Studio including text editing operations.

Features

  • Record and playback active document operations and Visual Studio IDE commands
  • Playback multiple times
  • Manage and persist macros with a Macro Explorer
  • Assign keyboard bindings to any macro
  • Macros recorded as JavaScript files that call VS DTE APIs
  • Macro editing in Visual Studio with DTE IntelliSense
  • Stop playback
  • Sample macros

Example

Suppose you wanted to convert the private variables in the following class to public fields.

class TestClass
{
    private string myString;
    private int someonesInt;
    private List<object> yourCollectionOfObjects;
    private bool macrosAreCool;
}

To do so efficiently, place your cursor before the "p" of the first private then start recording a macro (CTRL+M, R). Select the next word, type in "public" then go to the end of the line, go back two words, select the first letter, make it uppercase (CTRL+SHIFT+U). Finally, go to the next line and place the cursor at the beginning of the line and stop recording (CTRL+M, R again).

You can then playback the macro (CTRL+M, Enter) or play it back multiple times (CTRL+M, I).

Convert private variables to public fields