Skip to content
Contact Us

VS Code Setup

Visual Studio Code is an excellent choice for working with MirthSync projects. This guide helps you optimize VS Code for editing Mirth Connect channels, code templates, and configurations.

Install these extensions to enhance your MirthSync development experience:

XML Tools

  • Extension ID: DotJoshJohnson.xml
  • Provides: XML formatting, validation, and tree view
  • Use: Format channel.xml files, validate XML structure

JavaScript (ES6) Code Snippets

  • Extension ID: xabikos.JavaScriptSnippets
  • Provides: JavaScript code snippets and shortcuts
  • Use: Quick insertion of common JavaScript patterns in transformers

GitLens

  • Extension ID: eamodio.gitlens
  • Provides: Enhanced Git capabilities and history
  • Use: View commit history, blame annotations, compare changes

Prettier

  • Extension ID: esbenp.prettier-vscode
  • Provides: Code formatting
  • Use: Auto-format JavaScript code in transformers

Error Lens

  • Extension ID: usernamehw.errorlens
  • Provides: Inline error highlighting
  • Use: See XML and JavaScript errors immediately

Path Intellisense

  • Extension ID: christian-kohler.path-intellisense
  • Provides: Autocomplete for file paths
  • Use: Quick navigation to related files

Create or update .vscode/settings.json in your MirthSync project:

{
// File associations
"files.associations": {
"channel.xml": "xml",
"*.xml": "xml"
},
// Editor settings
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.insertSpaces": true,
// XML formatting
"xml.format.enabled": true,
"xml.format.splitAttributes": false,
// JavaScript settings
"javascript.format.enable": true,
"javascript.suggest.autoImports": false,
// File exclusions (optional)
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true
},
// Search exclusions
"search.exclude": {
"**/node_modules": true,
"**/.git": true
}
}

For team consistency, commit .vscode/settings.json to your repository. This ensures all team members use the same editor settings.

  • Ctrl+P (Windows/Linux) or Cmd+P (Mac) - Quick file open
  • Ctrl+Shift+F - Search across all files
  • Ctrl+B - Toggle sidebar
  • Ctrl+ ` - Toggle terminal
  • Alt+Up/Down - Move line up/down
  • Shift+Alt+Up/Down - Copy line up/down
  • Ctrl+D - Select next occurrence
  • Ctrl+Shift+L - Select all occurrences
  • Ctrl+/ - Toggle comment
  • Ctrl+Shift+G - Open Source Control
  • Ctrl+Enter - Commit staged changes
  • Ctrl+Shift+P then “Git: View History” - View commit history

The VS Code file explorer makes it easy to navigate your MirthSync project structure:

  • Expand folders to see channels and code templates
  • Right-click files for context menu options
  • Use Ctrl+Click to open files in new tabs

VS Code’s search is powerful for bulk changes:

  • Ctrl+Shift+F opens search across all files
  • Use regex patterns for complex searches
  • Preview changes before replacing

Compare channels or view multiple files:

  • Right-click a file tab > “Split Right”
  • Drag tabs to create custom layouts
  • Useful for comparing channel configurations

VS Code’s integrated terminal lets you run MirthSync commands:

  • Ctrl+` opens terminal
  • Run ./mirthsync.sh pull, ./mirthsync.sh push, etc.
  • See output directly in the editor

VS Code has excellent Git support:

  • View file changes with green/red indicators
  • Stage files with + button
  • Write commit messages in the editor
  • View diff side-by-side
  1. Open Project

    Terminal window
    code /path/to/mirthsync-project
  2. Pull Latest

    • Open terminal: Ctrl+`
    • Run: ./mirthsync.sh pull -s https://server:8443/api -u admin -t .
  3. Edit Files

    • Navigate to channel in Explorer
    • Open channel.xml
    • Edit JavaScript transformer
    • Save: Ctrl+S
  4. Review Changes

    • Click Source Control icon (or Ctrl+Shift+G)
    • Review diff for changed files
    • Stage files: Click + next to files
  5. Commit

    • Write commit message
    • Press Ctrl+Enter to commit
  6. Push to Mirth Connect

    • Open terminal
    • Run: ./mirthsync.sh push -s https://server:8443/api -u admin -t .

If XML files aren’t formatting:

  1. Install “XML Tools” extension
  2. Check xml.format.enabled in settings
  3. Right-click file > “Format Document”

If JavaScript in XML transformers isn’t highlighted:

  1. Ensure file is recognized as XML
  2. JavaScript within XML should highlight automatically
  3. Check files.associations in settings

If Git panel doesn’t show changes:

  1. Ensure folder is a Git repository (./mirthsync.sh -t . git init)
  2. Check .gitignore isn’t excluding files
  3. Reload window: Ctrl+Shift+P > “Reload Window”