Sourcegraph CEO here. There are indeed some glitches in syntax highlighting, on other languages as well. I hope it doesn't significantly detract from the product value, but I understand it is not good.
Here's why it's happening:
We're using TextMate syntax bundles, which require the Oniguruma regexp engine, which only has partial pure-JavaScript implementations that can run in the browser. We use https://github.com/bcoe/onigurumajs, which is great. We think something in this stack is producing different results than using C-based Oniguruma, and we'll work on it.
The good news is that we'll open-source whatever improvements we do make, so other folks building web-based syntax highlighting components will benefit.
We use Atom's syntax highlighter for syntax highlighting on npmjs.com -- I originally wrote onigurumajs, because I was seeing if we could viably remove the website's only compiled dependency (oniguruma) ... I wrote it over vacation, and then had to put the work down.
I would love help to see the library over the finish line; on a grammar by grammar basis it would be great to figure out what the JavaScript regex engine is missing, and try to shim the logic.
why???
The great thing about using oniguruma, is that it lets you leverage the huge collection of grammars available for TextMate -- unfortunately JavaScript's regex engine doesn't support quite a few rules that are present in TextMate grammars.
Oniguruma was a big roadblock for me on Chromebooks too.
Ideally, I'd have liked to have a version of VS Code that could be released to the Chrome Web Store, but regex is so labyrinthine in its edge cases that dropping in any other implementation was just inciting hatred from the editor.
Ultimately I looked at cross-compiling Oniguruma to WebAssembly to see how far I could get with this, and if that didn't work, NaCl.
I didn't get too far down this road as it was taking me away from the core goal of the project, and there's one of me.
VS Code uses the Monaco editor [1], which in turn uses Monarch [2] to provide syntax definitions. the Monarch github page [3] has a FAQ which also explains why they don't support TextMate grammars, citing exactly that Oniguruma regexes != Javascript regexes.
VS Code offers pretty decent Monarch syntax definitions in the monaco-languages at [4]; you're probably better off just using those instead.
Here's why it's happening:
We're using TextMate syntax bundles, which require the Oniguruma regexp engine, which only has partial pure-JavaScript implementations that can run in the browser. We use https://github.com/bcoe/onigurumajs, which is great. We think something in this stack is producing different results than using C-based Oniguruma, and we'll work on it.
The good news is that we'll open-source whatever improvements we do make, so other folks building web-based syntax highlighting components will benefit.