sysml-v2-lsp 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -46
- package/dist/server/mcpServer.js +43 -43
- package/dist/server/server.js +62 -62
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,80 +33,100 @@ Install via the VS Code extension from the [VS Code Marketplace](https://marketp
|
|
|
33
33
|
|
|
34
34
|
### Dev Container (recommended)
|
|
35
35
|
|
|
36
|
-
Open in GitHub Codespaces or VS Code Dev Containers — everything is pre-installed.
|
|
36
|
+
Open in GitHub Codespaces or VS Code Dev Containers — everything is pre-installed, including Python 3.13, Jupyter, and Node.js 22.
|
|
37
37
|
|
|
38
38
|
### Manual Setup
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
42
|
-
npm install
|
|
43
|
-
|
|
44
|
-
# Build
|
|
45
|
-
npm run build
|
|
46
|
-
|
|
47
|
-
# Run tests
|
|
48
|
-
npm test
|
|
41
|
+
npm install && npm run build && npm test
|
|
49
42
|
```
|
|
50
43
|
|
|
51
44
|
### Development
|
|
52
45
|
|
|
53
46
|
```bash
|
|
54
|
-
|
|
55
|
-
npm run watch
|
|
56
|
-
|
|
47
|
+
npm run watch # recompiles on file changes
|
|
57
48
|
# Then press F5 in VS Code to launch the extension + server
|
|
58
49
|
```
|
|
59
50
|
|
|
60
51
|
Use the **"Client + Server"** compound debug configuration to debug both sides simultaneously.
|
|
61
52
|
|
|
53
|
+
## Client Examples
|
|
54
|
+
|
|
55
|
+
The LSP server is language-agnostic. Three client implementations are included to demonstrate different integration patterns:
|
|
56
|
+
|
|
57
|
+
### VS Code Extension (`clients/vscode/`)
|
|
58
|
+
|
|
59
|
+
The primary client — a full VS Code extension using `vscode-languageclient`, communicating over IPC. Provides diagnostics, completions, hover, go-to-definition, semantic tokens, and all other LSP features directly in the editor.
|
|
60
|
+
|
|
61
|
+
### Web Client (`clients/web/`)
|
|
62
|
+
|
|
63
|
+
A browser-based SysML explorer with a Node.js HTTP bridge to the LSP server. Features a live editor with auto-analyse, diagnostics panel, symbol outline, and Mermaid diagram generation with zoom/pan.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
make web # build + start on http://localhost:3000
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Python Client (`clients/python/`)
|
|
70
|
+
|
|
71
|
+
A zero-dependency Python script and Jupyter notebook that drives the LSP over stdio — the same JSON-RPC protocol VS Code uses, with no framework overhead.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python3 clients/python/sysml_lsp_client.py # analyse all examples
|
|
75
|
+
python3 clients/python/sysml_lsp_client.py examples/bike.sysml # analyse a specific file
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The Jupyter notebook (`sysml_lsp_demo.ipynb`) provides an interactive walkthrough of every LSP feature.
|
|
79
|
+
|
|
62
80
|
## Architecture
|
|
63
81
|
|
|
64
82
|
```
|
|
65
|
-
|
|
66
|
-
│
|
|
67
|
-
│
|
|
68
|
-
|
|
69
|
-
│ •
|
|
70
|
-
│ •
|
|
71
|
-
│
|
|
72
|
-
│
|
|
73
|
-
│
|
|
74
|
-
│
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
┌───────────────────────────┐
|
|
84
|
+
│ Language Server │
|
|
85
|
+
│ (Node.js process) │
|
|
86
|
+
├───────────────────────────┤
|
|
87
|
+
│ • ANTLR4 parser │
|
|
88
|
+
│ • Diagnostics │
|
|
89
|
+
│ • Symbols / hover │
|
|
90
|
+
│ • Completions / rename │
|
|
91
|
+
│ • Semantic tokens │
|
|
92
|
+
│ • Go-to-def / references │
|
|
93
|
+
└────────┬──────────────────┘
|
|
94
|
+
│ LSP (JSON-RPC)
|
|
95
|
+
┌───────────────────┼────────────────────┐
|
|
96
|
+
│ │ │
|
|
97
|
+
┌────────┴───────┐ ┌────────┴───────┐ ┌─────────┴──────┐
|
|
98
|
+
│ VS Code (IPC) │ │ Web (HTTP) │ │ Python (stdio)│
|
|
99
|
+
│ Extension │ │ Browser SPA │ │ Script/Jupyter│
|
|
100
|
+
└────────────────┘ └────────────────┘ └────────────────┘
|
|
77
101
|
```
|
|
78
102
|
|
|
79
103
|
### Project Structure
|
|
80
104
|
|
|
81
105
|
```
|
|
82
106
|
sysml-v2-lsp/
|
|
83
|
-
├──
|
|
84
|
-
│
|
|
85
|
-
├──
|
|
86
|
-
│ └──
|
|
87
|
-
|
|
88
|
-
│
|
|
89
|
-
│
|
|
90
|
-
│
|
|
91
|
-
│
|
|
92
|
-
│
|
|
93
|
-
│
|
|
94
|
-
|
|
95
|
-
├──
|
|
107
|
+
├── clients/
|
|
108
|
+
│ ├── vscode/ # VS Code extension (TypeScript)
|
|
109
|
+
│ ├── web/ # Browser SPA + Node.js HTTP bridge
|
|
110
|
+
│ └── python/ # Zero-dep Python client + Jupyter notebook
|
|
111
|
+
├── server/src/ # Language Server
|
|
112
|
+
│ ├── server.ts # LSP connection, capability registration
|
|
113
|
+
│ ├── documentManager.ts # Parse cache, document lifecycle
|
|
114
|
+
│ ├── parser/ # Parse pipeline
|
|
115
|
+
│ ├── symbols/ # Symbol table, scopes, element types
|
|
116
|
+
│ ├── providers/ # LSP feature implementations
|
|
117
|
+
│ ├── analysis/ # Complexity analyzer
|
|
118
|
+
│ └── mcp/ # Mermaid diagram generator
|
|
119
|
+
├── grammar/ # ANTLR4 grammar files (.g4)
|
|
120
|
+
├── sysml.library/ # SysML v2 standard library
|
|
121
|
+
├── examples/ # Example .sysml models
|
|
122
|
+
├── test/ # Unit tests (vitest)
|
|
96
123
|
└── package.json # Extension manifest + monorepo scripts
|
|
97
124
|
```
|
|
98
125
|
|
|
99
|
-
## Grammar Updates
|
|
100
|
-
|
|
101
|
-
The grammar files in `grammar/` are sourced from [daltskin/sysml-v2-grammar](https://github.com/daltskin/sysml-v2-grammar). To pull the latest version:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
npm run update-grammar
|
|
105
|
-
```
|
|
106
|
-
|
|
107
126
|
## Available Commands
|
|
108
127
|
|
|
109
128
|
```bash
|
|
129
|
+
make help # Show all targets
|
|
110
130
|
make install # Install all dependencies
|
|
111
131
|
make generate # Generate TypeScript parser from grammar
|
|
112
132
|
make build # Compile + bundle
|
|
@@ -114,8 +134,19 @@ make watch # Watch mode
|
|
|
114
134
|
make test # Run unit tests
|
|
115
135
|
make lint # ESLint
|
|
116
136
|
make package # Build .vsix
|
|
137
|
+
make package-server # Build server tarball for npm
|
|
138
|
+
make web # Launch web client (http://localhost:3000)
|
|
117
139
|
make update-grammar # Pull latest grammar from upstream
|
|
118
|
-
make
|
|
140
|
+
make update-library # Pull latest SysML v2 standard library
|
|
141
|
+
make ci # Full CI pipeline (lint + build + test)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Grammar Updates
|
|
145
|
+
|
|
146
|
+
The grammar files in `grammar/` are sourced from [daltskin/sysml-v2-grammar](https://github.com/daltskin/sysml-v2-grammar). To pull the latest version:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
make update-grammar
|
|
119
150
|
```
|
|
120
151
|
|
|
121
152
|
## Technology Stack
|