1.0.0 • Published 4 months ago

meld-vscode v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Meld Language Support for VSCode and Cursor

Visual Studio Code and Cursor extension for the Meld prompt scripting language that provides:

  • Hybrid syntax highlighting (Meld directives + Markdown for content)
  • Intelligent autocompletion for Meld directives, variables, and commands
  • Path validation according to Meld language rules
  • Markdown header autocompletion in embed directives
  • Hover documentation for directives
  • Integration with meld-ast 3.4.3 for accurate parsing and analysis
  • Support for latest Meld syntax features

Features

Hybrid Syntax Highlighting

Combines the best of both worlds:

  • Meld syntax for directives, variables, and commands
  • Markdown syntax for content portions
  • Properly handles single quotes, contractions, and @ symbols in text
  • Special highlighting for directive blocks

Advanced Variable Syntax

  • Modern double curly braces syntax: {{variable}}
  • Legacy dollar syntax: ${variable} (for backward compatibility)
  • Array access with dot notation: {{array.0}}
  • Array access with bracket notation: {{array[0]}}
  • Property access for nested objects: {{object.property}}
  • Mixed access patterns: {{users.0.name}} or {{users[0].name}}

Enhanced Directives

  • Direct variable embedding: @embed {{variable}}
  • Multiline content with double brackets: @embed [[...]]
  • Named imports with selective variables: @import [var1, var2] from [path.meld]
  • Named imports with aliases: @import [var1, var2 as alias2] from [path.meld]
  • Wildcard imports: @import [*] from [path.meld]
  • URL support: @import [https://example.com/file.meld] and @embed [https://example.com/content.md]
  • Double greater-than comments: >> This is a comment

Path Validation

  • Shows realtime diagnostics for invalid paths
  • Validates according to Meld's path rules
  • Supports URL paths in import and embed directives
  • Provides helpful error messages for fixing path issues

Intelligent Autocompletion

  • After typing @: Shows available directives
  • After typing ${ or {{: Shows available text variables
  • After typing #{: Shows available data variables
  • After typing $ (not followed by { or {{): Shows available path variables
  • Inside @run [: Shows common commands
  • Inside @import [: Shows variable and wildcard import suggestions
  • After @embed [filepath #: Shows markdown headers from the referenced file

Import Resolution

  • Autocompletes variables from imported files
  • Supports named imports and aliases
  • Shows source information in completions

Installation

Visual Studio Code

From Marketplace

Once published:

code --install-extension meld.meld-vscode

Or search for "Meld Language Support" in the Extensions view.

From VSIX

code --install-extension meld-vscode-1.0.0.vsix

Or: 1. Open VSCode 2. View → Extensions (or press Ctrl+Shift+X) 3. Click "..." at the top of the Extensions view 4. Select "Install from VSIX..." 5. Choose the downloaded VSIX file

Cursor

From VSIX

cursor --install-extension meld-vscode-1.0.0.vsix

Or: 1. Open Cursor 2. View → Extensions (or press Ctrl+Shift+X) 3. Click "..." at the top of the Extensions view 4. Select "Install from VSIX..." 5. Choose the downloaded VSIX file

Usage

The extension activates automatically for .meld, .meld.md, .mll, and .mll.md files.

Working with Meld Files

  • Variables use double curly braces: {{variable}} (preferred) or legacy format ${variable}
  • Access array elements with dot notation {{array.0}} or bracket notation {{array[0]}}
  • Use @embed {{variable}} for direct variable embedding
  • Use @embed [[...]] for multiline content
  • Use named imports to selectively import variables: @import [var1, var2] from [path.meld]
  • URLs are supported in import and embed directives: @import [https://example.com/file.meld]
  • Use $PROJECTPATH/ or $HOMEPATH/ for paths (not relative paths)
  • Follow Meld's path syntax for proper validation
  • Structure your document with Markdown for content portions

Development

Setup

git clone https://github.com/username/meld-vscode.git
cd meld-vscode
npm install

Build

npm run build

Package

npm run package

Testing

The src/test directory contains sample Meld files to test various features.

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT

1.0.0

4 months ago

0.1.0

5 months ago