[NTG-context] Use Visual studio code

Hans Hagen j.hagen at xs4all.nl
Wed Aug 21 22:28:16 CEST 2019

On 8/21/2019 9:44 PM, Julian Gompper wrote:
> Hello,
> I too use vscode as my editor, and recently wanted to use it for ConTeXt
> as well.
> Patrick Gundlach created a tmLanguage file for ConTeXt:
> https://github.com/pgundlach/context.tmbundle/blob/master/Syntaxes/ConTeXt.tmLanguage
> I just finished packaging and publishing said file in a vscode extension.
> You can find it on GitHub:
> https://github.com/JulianGmp/vscode-context-syntax
> Or on the vscode marketplace:
> https://marketplace.visualstudio.com/items?itemName=JulianGmp.context-syntax
> As the name suggests, the extension only provides syntax highlighting. I
> might add snippets or build macros in the future, though I would
> probably implement these things in a seperate extension.

I wrote (reasonable advanced) lexers for all the languages that matter 
for context (tex, mp, lua, etc), also with support for embedded lexing 
as well as highlighting of categories of keywords (updates when new 
betas are pushed). These lexers are mostly compatible with my reference 
lexers for scite. So that should work anyway. They are poart of the 
distribution and activated when one starts vscode from the command line 
with the right switches or when one puts thexe lexers someplace known.

So, I didn't make some 'installable package' (also because i actually 
want to use a different color scheme and less clutter in the editor) so 
the idea is to have a independent start up without interference with an 
existing install.

But it works ok here (apart from adbaced suffix based runners, but i can 
run tex; ok, i could make mtxrun more clever and cheat but it would be a 

(The problem that I have with editors is that they keep adding stuff and 
become more complex over time while in practice I only need avery few 

> Also, if you want to build the document with a keybinding, you could
> define a build task in your tasks.json:
> https://gist.github.com/JulianGmp/a2b38212878c23d71de3d977214f2bf7
The problem is not to have key bindings (I can do that) but to have 
different ones per filetype (i want to run lua files with mtxrun 
--script for instance) and also because there can be multiple nindings 
per suffix. As far as I can see this is not yet possible (when i looked 
into it and searched abit i got the impression that this was a general 
known shortcoming but also that it was on some agenda to deal with it) 
and I don't want to ship/maintain a lot of fragile/moving target 
javascript (and node js) code.

Anyway, the files are in the distribuition to play with. And 
occasionally I see when it becomes more useable for me. It's currently 
mostly a fallback for when scite stops working (unfortunately the lua 
lexer support is is not build into scite and the (small) lib is 
unmaintained ... ok, i could do that when needed).


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list