Wednesday, 16 May 2018

Working with Qlik script in VSCode

I'm a big fan of Microsoft's free code editor Visual Studio Code (VSCode). For some time now I've been using it for various non-Qlik projects including Arduino based ones. Recently I decided to make the leap to working with Qlik script files in VSCode rather than Notepad++ (NPP) which had been my go-to editor for many years.

Although Notepad++ is a perfectly capable text and code editor, there has been a large increase in competition in recent years and NPP has gotten left a little behind. One very relevant example is NPP's syntax highlighting engine which only supports very basic highlighting whilst the majority of the competition have moved to RegEx based engines that can provide much more accurate highlighting.

Having been using VSCode for several months now, I thought I'd share some of the extensions and tools I have begun to find very valuable when working with Qlik script files.

VScode Qlik Extension

The VSCode Qlik extension was originally created by Xavier Hahn and provides syntax highlighting support for Qlik script. I have recently been collaborating with Xavier to add some of the knowledge and tools I have from working on the various syntax highlighting tools I've created. Expect future updates to improve the highlighting further.

You can download and install the extension from the VSCode Marketplace.


One of the big benefits of VSCode over NPP is the "Explorer" window that lets you browse a file system directly in the editor and load files from it. This can be a great time saver when working with a lots of Qlik Script files as well as being able to browse related files also. Having icons displayed next to the files can be a real help in quickly identifying them. There are 2 options to achieve this for Qlik files as follows.

The VSCode Icons Theme has a Qlik logo built in and so will display a little Qlik Q-icon next to all QVW, QVD and QVS files. Simply download the theme from the VSCode market place and enable it.

Another option I've had a quick play with is the Material Icons Theme. This extension doesn't have a Qlik logo built in but there is a method to implement custom icons and so in theory you would be able to have different icons for each Qlik file type. When I find time to knock some icons together I'll give it a proper try and report back.

GitHub Support

VSCode has inbuilt source control features including support for Git. If like me you use GitHub a lot then having the ability to commit, push and pull changes to your repositories directly in the editor whilst you're working is a huge timesaver!

Git support is available in VSCode with no need to install an extension.

ToDo Tree Extension

I've been using this extension for ages in my non-Qlik code projects and I couldn't believe I'd not considered how valuable it would be for Qlik script files also.

Back when I was an apprentice software engineer working on embedded firmware, it was drilled into me by the senior guys that it was critical to put all my notes into the code itself as comments. We had a very simple system of beginning the comment with an appropriate keyword such as "TODO", "FIXME", "NOTE", "BUG" or "HACK". The many millions of lines of code could then be scraped for all appropriate comments and lists formed to help the development managers keep track of everything.

ToDo Tree does exactly the same job and makes it simple to find and navigate to all your flagged comments across all files in a VSCode project. With a little tweaking it can be customised to work with Qlik script comments and include the additional keywords listed above. After installing the extension from the VSCode Marketplace, simply add the follow lines to your VSCode User Settings file:
"todo-tree.regex": "(/\\*|//|REM|#|<!--|;)\\s*(TODO|FIXME|NOTE|BUG|HACK)",
"todo-tree.iconColours": { "TODO":"green", "HACK":"yellow", "BUG":"red", "FIXME":"red", "NOTE":"grey"},
You can then browse all the comments starting with one of the keywords such as:
// FIXME: This works OK for now but should be improved
Clicking on any of the "ToDos" will open the file and take you to the relevant line. All Qlik script comment styles are supported ("//...", "/*...*/" and REM...).

If you've any other tricks of extensions you've found to be helpful, leave them in a comment below!


  1. I have converted my entire shop to using vscode for our entire Qliksense code base so we can do version control etc. In addition to the above extensions I also use 'line count' to get total lines of code in a full workspace.

    The git integration though is amazing, being able to see my changes inline in a file is very powerful. It also makes working with another developer on the same model much, much easier.

    1. Thanks for the suggestion Steve. I'll take a look.

    2. Additionally I use Tree View Todo, I think that's the name. It gives you a tree view accordion on the left panel to show all TODO: marked comments in your code.