Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SCALANCE Config Highlighting (Unofficial)New to Visual Studio Code? Get it now.
SCALANCE Config Highlighting (Unofficial)

SCALANCE Config Highlighting (Unofficial)

Axel Sigmar Lien

| (0) | Free
Unofficial community extension: syntax highlighting for Siemens SCALANCE switch/router CLI configuration files (XC/XB/XP/XR series). Not affiliated with Siemens AG.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SCALANCE Config Highlighting (Unofficial)

Syntax highlighting for Siemens SCALANCE switch/router CLI configuration files (XC-200, XB-200, XP-200, XR-300/500 series and similar), e.g. saved show running-config output.

About this project

Full honesty: this was built by a network person, not a software developer. I had never made a VS Code extension before and largely didn't know what I was doing — I just got tired of staring at wall-of-white-text switch configs. If something in here makes an actual developer wince, that's why. It works on my machine and my switches; bug reports, corrections and missing keywords are very welcome.

Disclaimer

  • Unofficial. This is a community project. It is not affiliated with, endorsed by, or supported by Siemens AG in any way.
  • Trademarks. SCALANCE, SIMATIC, SINEC and Siemens are trademarks of Siemens AG. They are used here only to describe compatibility. All other trademarks belong to their respective owners.
  • No warranty. Provided "as is", without warranty of any kind (see LICENSE). Syntax highlighting is cosmetic — it does not validate your configuration. A keyword lighting up in a pretty color does not mean the command is correct, supported by your firmware, or safe to deploy. Always verify configs against the official SCALANCE documentation before loading them onto production industrial networks.
  • Keyword coverage is best-effort, based on the classic SCALANCE CLI. Devices running SINEC OS use different syntax and are not (yet) covered.

Features

  • Comments (! and # lines)
  • Block keywords (interface, vlan, mrp-instance, spanning-tree, ...)
  • Distinct highlighting of the no negation prefix
  • Protocol/service names (SNMP, LLDP, PROFINET, MRP, NTP, ...)
  • IPv4 (with CIDR), IPv6 and MAC addresses
  • Interface identifiers (fastethernet 0/1, vlan 1, ...)
  • Strings, numbers and state constants (enabled, up, permit, ...)
  • Code folding for interface/vlan blocks
  • Snippets: int, vlan, mrp, mgmtip

File extensions

.scfg, .scalance, .cfg, .conf are recognized automatically.

.txt files are opt-in: run SCALANCE: Toggle .txt Highlighting from the Command Palette, or tick Settings → Extensions → SCALANCE Config → Txt Highlighting. This manages a *.txt entry in your global files.associations — toggling it off removes the entry cleanly (your own custom associations are never touched). For highlighting only in specific folders, skip the toggle and add a scoped pattern yourself, e.g. "files.associations": { "**/switch-configs/**/*.txt": "scalance" }. You can also always set the language per file via the language picker (Ctrl+K M).

Tip: if .cfg/.conf conflict with other extensions you use, remove them from contributes.languages[0].extensions in package.json.

Install

From the .vsix

code --install-extension scalance-config-0.1.0.vsix

or in VS Code: Extensions panel → ... menu → Install from VSIX...

For development

  1. Open this folder in VS Code
  2. Press F5 (Run Extension) — a new window opens with the extension loaded
  3. Open a .scfg file and test

Color scheme

Three options:

1. "SCALANCE: Customize Colors" panel (easiest)

Open the Command Palette (Ctrl+Shift+P) → SCALANCE: Customize Colors. You get color pickers and bold/italic toggles for every token type, with a live preview. Apply writes the choices into your global editor.tokenColorCustomizations (layered on top of your current theme); Remove customizations cleanly reverts to pure theme colors. Your choices are also stored under Settings → Extensions → SCALANCE Config, so they sync with Settings Sync.

2. Built-in "SCALANCE Dark" theme

Ctrl+K Ctrl+T → select SCALANCE Dark.

3. Manual settings.json

You can restyle individual token types in your settings.json — this works with whatever theme you already use:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": "keyword.operator.negation.scalance",
      "settings": { "foreground": "#ff5555", "fontStyle": "bold underline" }
    },
    {
      "scope": "constant.numeric.ipv4-cidr.scalance",
      "settings": { "foreground": "#ffaa00" }
    },
    {
      "scope": "entity.name.type.interface.scalance",
      "settings": { "foreground": "#50fa7b" }
    }
  ]
}

Available scopes: comment.line.exclamation.scalance, keyword.control.section.scalance, keyword.operator.negation.scalance, keyword.other.config.scalance, support.function.service.scalance, keyword.control.action.scalance, entity.name.type.interface.scalance, constant.numeric.ipv4-cidr.scalance, constant.numeric.ipv6.scalance, constant.numeric.mac.scalance, string.quoted.double.scalance, constant.numeric.scalance, constant.language.state.scalance.

Extending the grammar

The grammar lives in syntaxes/scalance.tmLanguage.json. Each rule maps a regex to a TextMate scope (e.g. keyword.control, constant.numeric), which your color theme then styles. Use the command Developer: Inspect Editor Tokens and Scopes in VS Code to debug which rule matched a token.

Note: SCALANCE devices running SINEC OS use a different CLI syntax — you can add a second grammar + language id for that in the same extension.

Contributing

Missing keywords are the most likely bug. If a command in your config isn't highlighted (or a plain word is highlighted that shouldn't be), please open an issue with the line in question and your device/firmware version.

License

MIT — see the LICENSE file included with this extension.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft