An already existing Clang-Format Installation outside of Visual Studio is not sufficient; Visual Studio still needs the Extension.
An already existing Clang-Format Installation outside of Visual Studio is not sufficient; Visual Studio still needs the Extension.
***Step 2**
## **Step 2**
Visual Commander allows the user to create Extensions for Visual Studio. Go to the new VCmd tab in Visual Studio and select Extensions. Select **Add** in the Extensions area and **Edit** on the newly created extension. You can give the Extension a name like "clang_on_save", but what's important is making sure the language is set to C#. Copy the following code into the extension:
Visual Commander allows the user to create Extensions for Visual Studio.
* Go to the new VCmd tab in Visual Studio and select Extensions.
* Select **Add** in the Extensions area and **Edit** on the newly created extension.
* You can give the Extension a name like "clang_on_save", but what's important is making sure the language is set to C#.
* Copy the following code into the extension:
```
```
using EnvDTE;
using EnvDTE;
...
@@ -36,8 +40,9 @@ public class E : VisualCommanderExt.IExtension
...
@@ -36,8 +40,9 @@ public class E : VisualCommanderExt.IExtension
private EnvDTE.DocumentEvents documentEvents;
private EnvDTE.DocumentEvents documentEvents;
}
}
```
```
* Then hit Save, Compile and Install.
Then hit Save, Compile and Install. Visual Studio should now apply Clang Format to any C and C++ documents upon saving them. You can also manually run Clang Format without saving by hitting Ctrl+R then Ctrl+D.
Visual Studio should now apply Clang Format to any C and C++ documents upon saving them. You can also manually run Clang Format without saving by hitting Ctrl+R then Ctrl+D.
Below is a picture guide to make finding everything easier.
Below is a picture guide to make finding everything easier.