lantern-language-support
v0.2.0
Published
Syntax highlighting and language support for Lantern (.ltn) files
Downloads
5
Maintainers
Readme
Lantern Language Support for VSCode
This extension provides comprehensive language support for Lantern (.ltn) files in Visual Studio Code, including syntax highlighting, code completion, and various productivity features.
Features
🎨 Syntax Highlighting
Complete syntax support for all Lantern constructs:
- Modules, Components, Interfaces, Events, Handlers
- State machines with transitions
- Constraints and business rules
- Feature definitions (Gherkin-style)
- Properties with type annotations
- Import statements with module paths
Specialized highlighting for:
- Comments and documentation comments
- Data tables and doc strings
- Step parameters in scenarios (
<parameter>) - Type definitions and built-in types
- Arithmetic operators (
+,-,*,/) - Dependency declarations (
Depends:) - Use statements with module paths (
use module::component)
🎯 Code Completion
- Smart snippets for all major constructs
- Auto-completion for keywords and built-in types
- Context-aware suggestions based on current scope
🔧 Editor Features
- Bracket matching and auto-closing for
{},[],(), and quotes - Code folding for modules, components, and feature definitions
- Smart indentation based on Lantern syntax rules
- Comment toggling with
#for line comments
🎨 Color Themes
- Lantern Dark - Optimized dark theme with distinct colors for each construct type
- Lantern Light - Clean light theme with professional color scheme
📝 Code Snippets
Available snippets (type the prefix and press Tab):
| Prefix | Description |
|--------|-------------|
| module | Complete module definition with properties and dependencies |
| component | Component definition with properties |
| interface | Interface with method signatures |
| event | Event definition with data fields |
| handler | Event handler with Given/When/Then steps |
| state | State machine with transitions |
| constraint | Constraint definition with rules |
| feature | Feature definition with scenarios |
| scenario | Individual scenario with steps |
| outline | Scenario outline with examples table |
| template | Scenario template with examples table |
| depends | Dependencies section |
| property | Typed property definition |
| method | Method signature |
| use | Import/use statement |
| table | Data table |
| docjson | JSON doc string |
| generate | Code generation annotation |
Installation
From VSCode Marketplace
- Open VSCode
- Go to Extensions (Ctrl+Shift+X)
- Search for "Lantern Language Support"
- Click Install
Manual Installation
- Download the
.vsixfile from releases - Run
code --install-extension lantern-language-support-0.1.0.vsix
Development Installation
- Clone this repository
- Run
npm install - Press F5 to open a new Extension Development Host window
- Open a
.ltnfile to test the extension
Usage
Creating a New Lantern File
- Create a new file with
.ltnextension - Start typing any Lantern construct (e.g.,
module,component) - Use Tab to expand snippets and navigate through placeholders
- Enjoy syntax highlighting and auto-completion
Example File
use components::auth::AuthService
Module: UserService
"""
User management service with authentication
"""
Description: "Complete user management system"
Version: "1.0.0"
Author: "Development Team <[email protected]>"
Component: UserRepository
Description: "User data persistence"
Depends:
- AuthService
- DatabaseConnection
Component: UserCache
Description: "In-memory user cache"
Event: UserCreated
Data:
user_id: String
email: String
timestamp: DateTime
Handler: UserCreatedHandler
On Event: UserCreated
Given the user data is valid
Then send welcome email
And update user statistics
Feature: User Management
Scenario: Create new user
Given I have valid user data
When I create a new user
Then the user should be saved successfully
Scenario Template: User validation
Given I have a user with email "<email>"
When I validate the user data
Then I should get "<result>"
Examples:
| email | result |
| [email protected] | success |
| invalid-email | error |Configuration
Theme Selection
- Open Command Palette (Ctrl+Shift+P)
- Type "Preferences: Color Theme"
- Select "Lantern Dark" or "Lantern Light"
File Association
The extension automatically associates .ltn files with the Lantern language. To manually configure:
{
"files.associations": {
"*.ltn": "lantern"
}
}Custom Snippets
Add your own snippets by creating a lantern.json file in your VSCode snippets folder:
- Open Command Palette (Ctrl+Shift+P)
- Type "Preferences: Configure User Snippets"
- Select "lantern"
- Add your custom snippets
Commands
The extension provides the following commands:
- Lantern: Validate Syntax - Validates the current Lantern file syntax
- Lantern: Generate Code - Generates code from the current Lantern specification
Access these commands through:
- Command Palette (Ctrl+Shift+P)
- Right-click context menu on
.ltnfiles - Editor context menu when viewing
.ltnfiles
Language Server Support
This extension includes basic language features. For advanced features like:
- Real-time syntax validation
- Go-to-definition
- Find references
- Hover information
- Code generation
Consider installing the Lantern Language Server extension (when available).
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Clone the repository
- Run
npm install - Open in VSCode
- Press F5 to launch Extension Development Host
- Make changes and test
- Submit a pull request
Testing
- Test files are located in
test-fixtures/ - Run tests with
npm test - Manual testing in Extension Development Host
Changelog
See CHANGELOG.md for release notes.
Known Issues
- Large files (>10MB) may experience slower syntax highlighting
- Complex nested structures might have occasional highlighting glitches
- Code generation commands require the Lantern CLI to be installed
Report issues at: GitHub Issues
License
This extension is licensed under the MIT License.
