System Syntax
A VS Code extension that provides syntax highlighting for Linux system configuration files, including SSH client configuration, iptables rules, network interfaces configuration, fstab files, and APT sources lists.
Features
- SSH Config Support: Full syntax highlighting for
~/.ssh/config
files
- iptables Rules Support: Syntax highlighting for
rules.v4
and rules.v6
files
- Network Interfaces Support: Syntax highlighting for
/etc/network/interfaces
and interfaces.d/*
files
- Fstab Support: Syntax highlighting for
/etc/fstab
files with mount options and filesystem types
- APT Sources Support: Syntax highlighting for
/etc/apt/sources.list
and APT repository files
- Universal Theme Compatibility: Works with all VS Code and Cursor IDE themes
- Hover Information: Contextual help for SSH directives, iptables targets, network interface options, mount options, and APT sources
- Extensible Architecture: Easy to add support for additional system configuration files
Supported File Types
SSH Configuration
- File:
.ssh/config
- Language ID:
ssh-config
- Features:
- Host block highlighting
- Directive recognition
- Comment support
- String and boolean value highlighting
- Hover information for common directives
iptables Rules
- Files:
rules.v4
, rules.v6
- Language ID:
iptables-rules
- Features:
- Table and chain definition highlighting
- Rule syntax recognition
- Protocol, source, destination highlighting
- Target and policy highlighting
- Hover information for targets and protocols
Network Interfaces
- Files:
interfaces
, files in interfaces.d/
- Language ID:
network-interfaces
- Features:
- Interface definition highlighting (auto, allow-hotplug, iface)
- Address family recognition (inet, inet6, loopback, ppp, ipx)
- Configuration method highlighting (static, dhcp, manual)
- Network options highlighting (address, netmask, gateway, dns-nameservers)
- Script hooks highlighting (pre-up, up, post-up, pre-down, down, post-down)
- Source directive support for modular configuration
- Mapping stanza support
- Hover information for directives and options
Installation
From VSIX Package
- Download the latest
.vsix
file from the releases page
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Click the "..." menu and select "Install from VSIX..."
- Select the downloaded
.vsix
file
From Source
- Clone this repository
- Install dependencies:
npm install
- Compile TypeScript:
npm run compile
- Package the extension:
vsce package
- Install the generated
.vsix
file
Usage
SSH Configuration
Open any .ssh/config
file and the extension will automatically provide syntax highlighting. Hover over SSH directives to see helpful information.
Example SSH config:
# SSH Client Configuration
Host myserver
HostName 192.168.1.100
User admin
Port 22
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
Compression yes
ServerAliveInterval 60
ServerAliveCountMax 3
iptables Rules
Open any rules.v4
or rules.v6
file for syntax highlighting. Hover over targets and protocols for contextual help.
Example iptables rules:
# iptables rules
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Allow SSH
-A INPUT -p tcp --dport 22 -j ACCEPT
# Allow HTTP and HTTPS
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Drop everything else
-A INPUT -j DROP
COMMIT
Network Interfaces
Open any interfaces
file or files in interfaces.d/
for syntax highlighting. Hover over directives and options for contextual help.
Example network interfaces configuration:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
# Wireless interface with DHCP
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "MyNetwork"
wpa-psk "MyPassword"
# Source additional configuration files
source /etc/network/interfaces.d/*.cfg
Fstab Files
- Files:
fstab
, /etc/fstab
- Language ID:
fstab
- Features:
- Device type highlighting (UUID, LABEL, PARTUUID, PARTLABEL, block devices)
- Mount point highlighting
- Filesystem type recognition (ext4, xfs, btrfs, swap, vfat, ntfs, tmpfs, etc.)
- Mount options highlighting with key-value differentiation
- Dump and fsck order flags
- Hover information for device types, filesystem types, and mount options
APT Sources Lists
- Files:
sources.list
, /etc/apt/sources.list
, /etc/apt/sources.list.d/*.list
- Language ID:
apt-sources
- Features:
- Archive type highlighting (deb, deb-src)
- Repository URL highlighting (http, https, ftp, file, cdrom, etc.)
- Distribution name recognition (Ubuntu releases, Debian releases)
- Component highlighting (main, contrib, non-free, universe, etc.)
- APT options highlighting (arch, trusted, signed-by, etc.)
- Hover information for distributions, components, and repository URLs
Hosts file
Example hosts file
# /etc/hosts - Host file example
# This file contains a mapping of IP addresses to hostnames
# Each entry should be kept on an individual line
# IPv4 loopback address
127.0.0.1 localhost
# IPv6 loopback address
::1 localhost ip6-localhost ip6-loopback
# Common local network entries
192.168.1.1 router.local
192.168.1.100 server.local
10.0.0.1 gateway.local
# Development servers
127.0.0.1 localhost.localdomain
127.0.0.1 myapp.local
127.0.0.1 api.local
Fstab Files
Example fstab file:
# /etc/fstab: static file system information
UUID=12345678-1234-1234-1234-123456789abc / ext4 errors=remount-ro 0 1
UUID=87654321-4321-4321-4321-cba987654321 /boot/efi vfat umask=0077 0 1
UUID=11111111-2222-3333-4444-555555555555 none swap sw 0 0
LABEL=Data /mnt/data ext4 defaults,noatime 0 2
/dev/sdb1 /mnt/external ntfs defaults,uid=1000,gid=1000,umask=0022 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
APT Sources Lists
Example sources.list file:
# Ubuntu repositories
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# Additional repositories
deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable
~~Themes~~ (Removed)
~~The extension includes two optimized themes:~~
~~- System Syntax Light: Optimized for light VS Code themes~~
~~- System Syntax Dark: Optimized for dark VS Code themes~~
Custom themes have been removed to focus on supporting IDE default themes. The extension now uses standard TextMate grammar scopes that are compatible with all VS Code and Cursor IDE themes, ensuring consistent syntax highlighting regardless of the user's preferred theme.
Extending the Extension
The extension is designed to be easily extensible. To add support for additional system configuration files:
- Create a new grammar file in
syntaxes/
- Create a language configuration in
language-configurations/
- Add the language definition to
package.json
- Add hover providers in
src/modules/
- Register the hover provider in
src/modules/index.ts
Example: Adding support for Apache config
- Create
syntaxes/apache-config.tmLanguage.json
- Create
language-configurations/apache-config.json
- Add to
package.json
:
{
"id": "apache-config",
"aliases": ["Apache Config"],
"extensions": [".conf", "httpd.conf"],
"configuration": "./language-configurations/apache-config.json"
}
Development
Prerequisites
- Node.js (v14 or later)
- npm
- VS Code Extension Development Host
Setup
npm install
npm run compile
Testing
- Press F5 to open a new Extension Development Host window
- Open test files to verify syntax highlighting
- Test hover functionality
Building
npm run compile
vsce package
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Changelog
- See separate CHANGELOG.md file
Roadmap
- You tell me, add an issue or pull request. But no promises.