A VS Code extension providing SysML v2.0 language support with interactive visualization. All language intelligence (parsing, diagnostics, completions, hover, go-to-definition, formatting, etc.) is provided by the sysml-v2-lsp language server via the Language Server Protocol. The extension adds visualization, model exploration, and diagram rendering on top via a custom sysml/model LSP request.
┌─────────────────────────────────────────────────────────────────────┐
│ VS Code Extension Host │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────────────────────────────┐ │
│ │ extension.ts │─────────>│ LSP Client │ │
│ │ (entry) │ │ (vscode-languageclient) │ │
│ └──────┬───────┘ └──────────────┬───────────────────────┘ │
│ │ │ IPC │
│ │ v │
│ │ ┌──────────────────────────────────────┐ │
│ │ │ sysml-v2-lsp Language Server │ │
│ │ │ (separate Node.js process) │ │
│ │ │ │ │
│ │ │ * ANTLR4 parser (worker thread) │ │
│ │ │ * Symbol table & model provider │ │
│ │ │ * Diagnostics & keyword typos │ │
│ │ │ * Completions / signature help │ │
│ │ │ * Hover / go-to-def / references │ │
│ │ │ * Semantic tokens / CodeLens │ │
│ │ │ * Rename / linked editing │ │
│ │ │ * Inlay hints / document links │ │
│ │ │ * Type & call hierarchy │ │
│ │ │ * Formatting / folding / selection │ │
│ │ │ * Workspace symbols │ │
│ │ │ * Standard library resolution │ │
│ │ │ * Custom sysml/model request │ │
│ │ └──────────────────────────────────────┘ │
│ │ │
│ │ │
│ ┌──────┴──────────────────────────────────────────────────────┐ │
│ │ Extension Features │ │
│ │ │ │
│ │ ┌────────────┐ ┌───────────────┐ ┌────────────────────┐ │ │
│ │ │ Model Tree │ │ LSP Model │ │ Model Dashboard │ │ │
│ │ │ Explorer │ │ Provider │ │ Panel │ │ │
│ │ └────────────┘ └───────────────┘ └────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ Visualization Panel (Webview) │ │
│ │ ┌────────┬────────┬────────┬────────┬────────┬────────┬─────┐ │ │
│ │ │ BDD │ IBD │ ELK │Package │Activity│Sequence│State│ │ │
│ │ └────────┴────────┴────────┴────────┴────────┴────────┴─────┘ │ │
│ │ | Cytoscape.js + ELK | D3.js │ │
│ └────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
- Starts the sysml-v2-lsp language server as a child process (IPC transport)
- The server module is shipped as the
sysml-v2-lspnpm dependency - Provides all language intelligence: diagnostics, completions, hover, go-to-definition, references, rename, formatting, code actions, semantic tokens, CodeLens, inlay hints, type/call hierarchy, document symbols, folding ranges, selection ranges, workspace symbols
- Custom
sysml/modelrequest returns parsed model data for visualization and explorer - Supports
sysml.restartServercommand for development
lspModelProvider.ts— sendssysml/modelrequests to the LSP serversysmlModelTypes.ts— shared type definitions for model data (elements, relationships, stats)- Converts LSP model responses into visualization-ready data structures
modelExplorerProvider.ts— tree view showing SysML model structure- Displays packages, parts, attributes, ports, connections, etc.
- Uses
sysml/modelrequest with['elements', 'relationships']scope - Supports refresh, navigation to source, and model dashboard
modelDashboardPanel.ts— webview panel showing model statistics- Displays element counts, relationship types, parse timing, and model structure overview
visualizationPanel.ts— webview-based diagram rendering- Multiple renderers: BDD, IBD, Package, Activity, Sequence, State, UseCase
- Uses Cytoscape.js + ELK for graph layout
- Uses D3.js for custom diagrams
.sysml File
│
v
┌───────────┐ ┌──────────────────────────┐ ┌───────────────┐
│ TextDoc │--->│ sysml-v2-lsp Server │--->│ LSP Responses │
│ │ │ │ │ │
│ │ │ ANTLR4 parse (worker) │ │ diagnostics, │
│ │ │ Symbol table build │ │ completions, │
│ │ │ Library resolution │ │ model data │
└───────────┘ └──────────────────────────┘ └───────┬───────┘
│
┌───────────────────────────────┤
│ │
v v
┌─────────────┐ ┌───────────────┐
│ Model Tree │ │ Visualization│
│ Explorer │ │ Webview │
└─────────────┘ └───────────────┘
| Dependency | Purpose |
|---|---|
sysml-v2-lsp |
Language server (LSP) |
vscode-languageclient |
VS Code LSP client library |
elkjs |
ELK graph layout algorithm |
cytoscape |
Graph visualization library |
cytoscape-elk |
ELK layout adapter for Cytoscape |
d3 |
Data-driven document manipulation |
src/
├── extension.ts # Entry point, command registration
├── lsp/
│ ├── client.ts # LSP client (starts sysml-v2-lsp server)
│ └── server-launcher.cjs # Server process entry point
├── providers/
│ ├── lspModelProvider.ts # sysml/model request handler
│ └── sysmlModelTypes.ts # Shared model type definitions
├── visualization/
│ └── visualizationPanel.ts # Webview host & diagram rendering
├── explorer/
│ └── modelExplorerProvider.ts # Tree view provider
├── panels/
│ └── modelDashboardPanel.ts # Dashboard webview panel
├── types/
│ └── sysml-v2-lsp.d.ts # Type declarations for LSP package
└── test/
└── *.test.ts # Unit and integration tests
- Triggered by
onLanguage:sysmlor command invocation - Starts the sysml-v2-lsp language server via IPC (handles all language features)
- Registers Model Explorer tree view, visualization commands, and dashboard
- Sets up file watchers and document change handlers for model updates
Extension Host Webview (Browser)
│ │
│──── { command: 'update', ────────>│
│ data: elements } │
│ │
│<─── { command: 'select', ─────────│
│ element: name } │
│ │
│──── { command: 'highlight' ───────>│
│ name: string } │
Messages are serialized JSON passed via postMessage().