ifdef-loader Syntax Highlighting

Syntax highlighting for ifdef-loader conditional compilation comments.
- ✅ Supports built-ins:
#if , #else , #elif , #endif
- ✅ Supports
#code uncomment prefix blocks (and custom prefixes)
- 🟡 Not supported:
"ifdef-triple-slash": false
Recommended: Enable block highlighting
Configure block-level highlights - e.g. using the Highlight extension:
// .vscode/settings.json
{
"highlight.regexes": {
"( *\/\/\/ #if.*)((?:.|\n)*?\n)( *\/\/\/ #endif)": {
"filterFileRegex": ".*\\.(?:jsx?|tsx?)$",
"regexFlags": "gm",
"decorations": [
{},
{
"isWholeLine": true,
"dark": { "backgroundColor": "#ffa81d28" },
"light": { "backgroundColor": "#ffa81d10" }
},
{}
]
},
"( *\/\/\/ )(#(?:if|elif|else|endif))": {
"filterFileRegex": ".*\\.(?:jsx?|tsx?)$",
"decorations": [
{
"isWholeLine": true,
"dark": { "backgroundColor": "#ffa81d26" },
"light": { "backgroundColor": "#ffa81d20" }
},
{
"fontWeight": "600"
}
]
}
}
}
Build
npx vsce package
Test
git checkout git@github.com:reececomo/ifdef-loader-syntax-highlighting
cd ifdef-loader-syntax-highlighting
code --install-extension ./ifdef-loader-syntax-highlighting-0.1.0.vsix
| |