Lexicon IntelliSense#
VS Code extension providing IntelliSense support for AT Protocol lexicon JSON files.
Features#
- Real-time validation: Validates lexicon files as you type
- JSON Schema support: Provides autocomplete and validation using comprehensive JSON schemas
- Cross-lexicon validation: Validates references between lexicon files in your workspace
- Error diagnostics: Shows validation errors directly in the editor with location information
- Workspace validation: Command to validate all lexicon files in your workspace
Installation#
-
Install dependencies:
npm install -
Compile the extension:
npm run compile -
Install in VS Code:
- Open VS Code
- Press F5 to launch a new Extension Development Host window
- Open a workspace containing lexicon files
Configuration#
The extension can be configured in VS Code settings:
lexiconIntelliSense.enableValidation: Enable/disable lexicon validation (default: true)lexiconIntelliSense.lexiconDirectory: Directory containing lexicon files relative to workspace root (default: "lexicons")
Usage#
Automatic Validation#
The extension automatically validates:
- JSON files in directories containing "lexicons" in the path
- JSON files that contain lexicon-like structure (have
idanddefsfields)
Manual Validation#
Use the command palette (Ctrl+Shift+P / Cmd+Shift+P):
Lexicon: Validate Current File- Validates the currently open lexicon fileLexicon: Validate Workspace- Validates all lexicon files in the workspace
Features in Action#
- Structure validation: Ensures lexicon files have required
idanddefsfields - Type checking: Validates that definition types are correct
- Reference validation: Checks that references to other lexicons can be resolved
- Format validation: Validates string formats like datetime, uri, nsid, etc.
File Structure#
packages/lexicon-intellisense/
├── package.json # Extension manifest
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── language-server.ts # Language server implementation
│ └── lexicon-validator.ts # WASM validator wrapper
├── schemas/
│ └── lexicon-schema.json # JSON schema for lexicon files
├── wasm/ # WASM files from lexicon-rs
└── language-configuration.json
Development#
Building#
npm run compile
Testing#
- Open the project in VS Code
- Press F5 to launch the Extension Development Host
- Open a workspace with lexicon files
- Test validation and IntelliSense features
Validation#
The extension provides comprehensive AT Protocol lexicon validation including structure validation, type checking, reference validation, and format validation.
Commands#
lexiconIntelliSense.validateFile: Validate the current lexicon filelexiconIntelliSense.validateWorkspace: Validate all lexicon files in workspace
License#
MIT