Runar Ovesen Hjerpbakk

Science-based software development

Scriptcs IntelliSense in Visual Studio Code

We’ve lately rewritten our build systems at work using scriptcs. Scripts with C# as the language with full access to the rest of .Net. Aka PowerShell as it should have been. This rewrite has been awesome for several reasons:


I write these scripts using Visual Studio Code. It utilises OmniSharp behind the scenes to give us awesome IntelliSense. However, for scriptcs this does not work out of the box:

Screen Shot 2016-02-05 at 07.52.51

Consider the screenshot above where I’ve opened a folder with a single scriptcs-file. I get autocomplete help, but only with the phrases I’ve previously written in this script. Not the full IntelliSense goodness.

To get IntelliSense working with scriptcs using Visual Studio Code, you need to create and empty project.json file to the folder containing the scriptcs scripts. An empty .json-file means only the brackets:

{ }

Then the magic happens: IntelliSense, CodeLens, CTRL(CMD)+click go to definition and more:

Screen Shot 2016-02-05 at 08.04.40

10 / 10, would rewrite in scriptcs again.

Running ScriptCS from Visual Studio Code

By installing an extension, you can run the whole or parts of the scripts directly from the editor: