|
|
|
|
|
by sqs
3339 days ago
|
|
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.