Articles tagged with: Visual Studio

30
December
2012

Jindent - Visual Studio/Express Integration

Read instructions how to install Jindent into the Visual Express/Studio IDE.

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.)
  1. 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.
  2. 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.
  3. Start your Visual Express/Studio IDE and navigate in the main menu to Tools and select menu item External tools....
  4. 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!)

    Add Jindent as an external tool to Visual Studio/Express

    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.

  5. 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.

    Create another Jindent command to Visual Studio/Express

    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.

  6. 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.

    Bind Jindent commands to Visual Studio/Express menus

    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.

    Bind Jindent commands to Visual Studio/Express menus

  7. To bind the second external tool command select Project and Solutions Context Menus | Project.

    Bind another Jindent command to a Visual Studio/Express menu

    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.

    Bind another Jindent command to a Visual Studio/Express menu

  8. 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'.

    Verify Jindent's Visual Studio/Express menu entry

    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.

    Verify Jindent's Visual Studio/Express menu entry

    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.

    Verify Jindent's Visual Studio/Express menu entry

  9. If your verification passed then Jindent is installed properly and you are done.

Categories: Jindent - Source Code Formatter