Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Nix Embedded LanguagesNew to Visual Studio Code? Get it now.
Nix Embedded Languages

Nix Embedded Languages

Cooper Maruyama

|
1 install
| (0) | Free
Syntax highlighting for embedded languages in Nix multi-line strings.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nix Embedded Languages

GitHub License

Features

Syntax highlighting for embedded languages inside Nix multi-line strings ('' ... '').

Usage

Pattern 1: Short form (inside string)

Place # lang on its own line inside the string:

script = ''
  # shell
  echo "Hello, world!"
  ls -la
'';

Pattern 2: Explicit form with # syntax: (inside string)

For clarity, use # syntax: lang:

script = ''
  # syntax: python
  def greet(name):
      print(f"Hello, {name}!")
  greet("World")
'';

Pattern 3: Typescript / C-style comment // syntax: (inside string)

For languages where // is a comment:

code = ''
  // syntax: javascript
  const greeting = "Hello!";
  console.log(greeting);
'';

Pattern 4: Comment before string (for JSON, etc.)

For languages without comments (like JSON), place the marker BEFORE the string as a Nix comment:

# syntax: json
configData = ''
  {
    "name": "example",
    "version": "1.0.0"
  }
'';

Built-In Languages

Language Identifiers
Shell shell, bash, sh
Python python, py
JavaScript javascript, js
TypeScript typescript, ts
JSON json
YAML yaml, yml
SQL sql
Lua lua
Ruby ruby, rb
Rust rust, rs
Go go, golang
HTML html
CSS css
Nix nix

Extension Settings

Name Description
nix-embedded-languages.include Add custom languages. Key is the identifier (supports regex), value is either the TextMate scope name or an object with name and scopeName (required) properties.

Example Configuration

{
  "nix-embedded-languages.include": {
    "hcl|terraform": {
      "name": "HCL/Terraform",
      "scopeName": "source.hcl"
    }
  }
}

Requirements

  • The Nix IDE extension (or another extension providing source.nix grammar)

Contributing

  1. Install devenv
  2. Load development environment:
     $ devenv shell
    
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft