An open API service indexing awesome lists of open source software.

https://github.com/reececomo/ifdef-loader-syntax-highlighting

Syntax highlighting for ifdef-loader conditional compilation comments in TypeScript and JavaScript files.
https://github.com/reececomo/ifdef-loader-syntax-highlighting

Last synced: 4 months ago
JSON representation

Syntax highlighting for ifdef-loader conditional compilation comments in TypeScript and JavaScript files.

Awesome Lists containing this project

README

          

# ifdef-loader Syntax Highlighting

[![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/v/reececomo.ifdef-loader-syntax-highlighting.svg)](https://marketplace.visualstudio.com/items?itemName=reececomo.ifdef-loader-syntax-highlighting)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

Syntax highlighting for [**ifdef-loader**](https://www.npmjs.com/package/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`

Example usage

### Recommended: Enable block highlighting

Configure block highlights - e.g. using the [**Highlight extension**](https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-highlight):

#### .vscode/settings.json:

```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 & install

```sh
git clone git@github.com:reececomo/ifdef-loader-syntax-highlighting
cd ifdef-loader-syntax-highlighting

npm run build

npm run install-extension
```