I'm attempting to create custom syntax styling with Visual Studio Code's theme settings via TextMate language grammars.
Specifically, I'm wanting to italicize all of JavaScript's reserved keywords. I've managed to get 98% of the way there with the settings below (comments included for what's left).
Unfortunately, there are a few rules I wasn't able to find:
storage
includes the fat arrow symbol, which I do not want to include. I tried to be more specific, as seen in the settings below, but was unable to find more specific settings forconstructor
andconst
. Additionally,"storage.type.function"
was the most explicit setting I could find for functions (needed for the function keyword, but it includes the fat arrow).keyword
includes characters such as logical operators, etc., which again, I do not want to include.keyword.operator
is necessary for the textual operators (e.g.in
,instanceof
), but includes the character operators.- I wasn't able to find rules for
eval
(disallowed in strict) orpackage
(unused future keyword).
Any ideas?
const settings = {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
// TODO: missing keywords: package, eval
// all comment types
"comment",
// true, false, null
"constant.language",
// import, from, export, default, return, if, for, break, continue, try, catch, finally,
// throw, default, yield, await
"keyword.control",
// TODO: remove operator symbols
// in, void, delete, instanceof
"keyword.operator",
// debugger
"keyword.other",
// new
"keyword.operator.new",
// enum
"storage.type.enum",
// super, this, arguments
"variable.language",
// attributes in html, jsx, etc.
"entity.other.attribute-name",
// TODO: remove storage.type after finding explicit for constructor, const, let, var
"storage.type",
// static, extends, async, private, public, implements
"storage.modifier",
// TODO: exclude fat arrow
// function
"storage.type.function",
// class
"storage.type.class",
// interface
"storage.type.interface",
],
"settings": {
"fontStyle": "italic"
}
},
]
},
};