Syntax highlighting for cam-script in VSC

Cheers!

I am usually editing my forms in Visual Studio Code - the problem with that is, that I don’t have any syntax highlighting for the code blocks due to the type of the script being text/form-script. Did anyone manage to get the syntax highlighting for JS to work within VSC? I know that removing the type or switching it to text/javascript would work, but that’s something which I wouldn’t consider convenient at all.

I might have some time to dig into this a little bit deeper soon, so if noone has a solution, I may put some more time in it :wink:

So, I just got this to run. I doubt that a pull request on textmate’s repository would be successful because the amount of users needing this is rather low and it’s specific to Camunda. So if you need syntax highlighting in VSC, you have to do the following:

  1. Locate your VSC folder an go into resources\app\extensions\html\syntaxes
  2. Open the file html.tmLanguage.json
  3. Search for the expression jscript
  4. Just add | form-script | after it
  5. Reload VSC and you’re done

The line should look like […] |jscript\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t | form-script | livescript\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t | […]

The actual file is also available here - so if you don’t to work in the minified version or something has changed, get the file from here: https://github.com/textmate/html.tmbundle/blob/master/Syntaxes/HTML.plist

and just search for Text mime-types and add it there.

For your convenience, you can get a patched file via pastebin: https://pastebin.com/mGbsXLVR

4 Likes