@immediate-diagram/lsp-server
v1.2.3
Published
Language Server Protocol (LSP) server for Immediate Diagram `.imd` files. Provides IDE features powered by the `@immediate-diagram/parser`.
Readme
@immediate-diagram/lsp-server
Language Server Protocol (LSP) server for Immediate Diagram .imd files. Provides IDE features powered by the @immediate-diagram/parser.
Install
bun add @immediate-diagram/lsp-serverNote: This package publishes raw
.tssource. Requires Bun as runtime.
Features
- Diagnostics — real-time parse errors and semantic validation warnings
- Autocomplete — keyword completions for diagram types, directives, shapes, styles, and more
- Hover — documentation on hover for keywords, properties, and syntax
- Document Symbols — outline view with diagram structure (nodes, edges, states, groups)
Usage
The LSP server is typically consumed by an editor extension (e.g., the Immediate Diagram VS Code extension).
Standalone Usage
import { getDiagnostics } from "@immediate-diagram/lsp-server";
import { getCompletionItems } from "@immediate-diagram/lsp-server";
import { getHoverInfo } from "@immediate-diagram/lsp-server";
import { getDocumentSymbols } from "@immediate-diagram/lsp-server";getDiagnostics(text: string)
Parse and validate the document, returning LSP Diagnostic[] for errors and warnings.
getCompletionItems(text: string, position: Position)
Return context-aware completion items based on cursor position — diagram types, directives, node shapes, style properties, colors, easing functions.
getHoverInfo(text: string, position: Position)
Return hover documentation for the token at the cursor position.
getDocumentSymbols(text: string)
Return DocumentSymbol[] representing the document outline — diagram type, title, nodes, edges, states, groups.
Development
bun test # Run tests
bun run typecheck # Type checkingLicense
MIT
