To integrate Jindent - Source Code Formatter as external tool into Visual Express or Visual Studio please follow the steps below.
(Please note the following description and screenshots base on the Visual Express C++ 2010 IDE.)
-
Download the Windows Jindent installer from our website:
http://www.jindent.com/downloads and install Jindent on your system.
In this example we assume the software package is installed at: C:\Program Files (x86)\Jindent\
.
We will need this path later for our external tool configuration in Visual Express/Studio.
-
Start Jindent Customizer on your deskop to create an initial Jindent settings file you would like to use in your Visual
Express/Studio integration. After starting the Customizer you can edit and configure your formatting style as you need and finally
save it to a fixed position on your hard disc, let's say to:
C:\JindentSettings\MySettings.xjs
. Remember this location,
we will need it later.
-
Start your Visual Express/Studio IDE and navigate in the main menu to
Tools
and select menu item
External tools...
.
-
Now add a new external tool command to format a single file with Jindent.
Click on button Add
and insert a new menu content entry as described on the screenshot. (Please be aware of all control
settings in the screenshot - even the checkbox settings!)
Please note: Our external tool entry is External Tool 4
. If you have already defined other external tool
configurations than number 4
can of course differ from our description. This is important because we will later refer to
this external tool number.
-
After defining the first command we add a second one to format a complete directory including all its subfolders with Jindent.
Click on button Add
and insert another new menu content entry as described on the screenshot.
Please note: Our external tool entry is External Tool 5
. If you have already defined other external tool
configurations than number 5
can of course differ from our description. This is important because we will later refer to
this external tool number.
Click on the OK
button to apply all new changes.
-
Now all necessary external tool commands are available in the system. The next step is to bind them to new context menu entries to be
able to access them directly from our IDE.
For this select main menu Tools
again and choose menu item Customize...
to open the Customize dialog.
There select tab Commands
and choose radio button Context menu
and select combo box entry
Editor Context Menu | Code Window
.
Now click on button Add Command...
and a new dialog pops up. There choose Tools
for
Categories
and then select External Command 4
for Commands
. This is the
'Format file with Jindent' command you would like to bind to the editor's context menu. Finally click button OK
.
-
To bind the second external tool command select
Project and Solutions Context Menus | Project
.
Now click on button Add Command...
and choose again Tools
for
Categories
and then select External Command 5
for Commands
. This is the
'Format directory with Jindent' command you would like to bind to the project context menu. Finally click button OK
.
-
Now all menu entries are declared and connected to our external tool commands so you can click on Close
button
to finally close the Customize...
dialog.
To verify open a sample C/C++ file in your text editor and right click in the editor panel to open the editor's context menu.
The very first entry should be now 'Format File with Jindent'.
Execute it and Jindent will start formatting the code editor's content. Jindent's output will be printed in a console window below.
After formatting the IDE will ask to reload the editor's content because it was modified from outside the IDE. Agree and the new
formatted content shows up in your editor window.
To finish your verification right click on the project node in the Solution Explorer
and here again the context menu
pops up and the first entry should be Format Folder with Jindent
. Invoke this new menu entry and Jindent will format all
C/C++ and header source files found in the selected project.
-
If your verification passed then Jindent is installed properly and you are done.