Visual Studio Code, SourceTree and terminal/ command line integration

downloadOver the past couple of weeks, Visual Studio Code has become my favorite editor. It has some great features, is fast and relatively easy to use. Of course I’m still learning how to use it most effectively. Here’s what I learned today.

Starting Visual Studio Code from the terminal

Visual Studio Code has a built-in function to add a shortcut to it in your OS X environment. That allows you to start it from a terminal. The procedure is described here and comes down to:

  • Open Visual Studio Code
  • Bring up the Command Palette ( Cmd – Ctrl – P ) and type “shell command”
  • Execute the ‘Shell Command: Install ‘code’ command in PATH’ command

When you’ve done that, you can simply type ‘code‘ in your terminal to start Visual Studio Code. If you want to open a specific file with Code, type ‘code <filename>’.

Note: Windows users get this feature automatically when installing Code.

Open a file directly from a repo in SourceTree

SourceTree has a function that allows you to define ‘Custom Actions’ that can be started from files in any repo. If you’ve added the ‘code’ command from the previous step, you can create a Custom Action to open any selected file with Visual Studio Code:

  • Bring up the SourceTree preferences (Cmd + comma)
  • Go to the Custom Actions tab and configure it like this (OS X users):

Screenshot 2016-04-21 10.03.58

Note that Windows users need to configure the custom action with the full path to the Code executable:


If you now select a file in your repo, you can right click > Custom Actions > Edit in Visual Studio Code to immediately open a file with Code.

Happy coding!

Getting your Git projects back in Domino Designer

Since a while now I’m using source control in Domino Designer and I love it! I’m using eGit because I like that it’s integrated directly into Designer.

I recently needed to re-install Designer and found out that all on-disk projects needed to be re-added to Designer too. In this post I’ll share a way on how you can restore those and restore the connection with the NSF´s.

First thing you need to do after installing Designer is to re-install the eGit plugin. By default, eGit stores the GIT repositories on Windows in a directory called “git” in the users’ home folder (c:users<your name>)*. An uninstall of Designer will not remove that folder, so my on-disk projects were still there. Note: add this folder to your backups!

import_gitNext add your databases to Designer and organize them using working sets. You then need to get the Git projects back in Designer: go to the Package Explorer, right click somewhere in it and choose “Import”. Enter “git” in the search dialog and select the “Projects from Git” option. Select the Git repository (folder) that contains your project (or click “Add” to select the location of the repository on the file system). In the next screen, leave the “Import existing projects” option enabled and select the “Working Directory” folder. Click “Next” and Designer will show you the on-disk projects it contains. Select the ones you would like to import. I would suggest to select the working set you chose for your database, but for some reason I wasn’t able to select it, so I added the Git project to the working set afterwards using the method described here . Click “Finish”.

You’re now ready to restore the link from your databases/ applications with the on-disk project: right-click on a database and select Team Development > Associate with Existing On-Disk Project. In my situation I have the latest design sitting in my database, so I choose the “Export from database.nsf to selected on-disk project” option. If you want the on-disk project to be leading, choose the “Import …” option. Select the on-disk project you just imported and hit Finish. Done. Now back to work!

By the way: it looks like there’s a bug the eGit version used in Designer that causes eGit’s repository views to sometimes be completely blank. No fear: click the menu icon next to the view and select “Refresh”.

* Side-note: if you create an on-disk project for a database, all files are stored (by default) in <notes data>workspace<project name>. If you then add that local on-disk project to eGit using Team > Share project, the entire folder is moved to the default eGit folder at c:users<your name>git<new repo name>.