sysml-v2-lsp 0.2.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0]
4
+
5
+ ### Added
6
+
7
+ - Mermaid diagram preview: SysML → Mermaid diagram generation with 6 diagram types (class, activity, state, sequence, interconnection, use-case) and auto-detection
8
+ - Mermaid focus mode: filter diagram to a specific element, its children, parent, and related types
9
+ - Mermaid diff mode: compare original vs. modified SysML and report structural changes
10
+ - Complexity analyzer: structural complexity metrics (nesting depth, coupling, fan-out, documentation coverage) with composite 0–100 index and per-definition hotspots
11
+ - Semantic validator: unresolved type references, invalid multiplicity bounds, empty enumerations, duplicate definitions — with standard-library type allow-list
12
+ - MCP tool `preview`: generates Mermaid diagrams from SysML with focus/diff support
13
+ - MCP tool `getDiagnostics`: returns semantic diagnostics for parsed documents
14
+ - MCP tool `getComplexity`: exposes complexity analysis as an MCP tool
15
+ - Code action quick-fixes: naming convention (PascalCase/camelCase), missing documentation stub, empty enumeration placeholder, unused definition suppression
16
+ - Library type-level indexing: Go-to-Definition into standard library types at exact declaration lines
17
+ - Multiplicity extraction from parse tree (`0..*`, `1`, etc.) on symbols
18
+ - Documentation extraction from doc/comment nodes on symbols
19
+ - Symbol table caching per URI keyed by document version
20
+ - Multi-specialization support: comma-separated specialization targets with `:>` and `specializes`
21
+ - LSP `sysml/serverStats` request: uptime, memory, and cache statistics
22
+ - LSP `sysml/clearCache` request: flush all in-memory caches
23
+ - LSP `sysml/status` notifications: begin/end parse progress events
24
+ - Language configuration: folding markers (`#region`/`#endregion`), indentation rules, `wordPattern`
25
+ - Model stats: lex/parse timing breakdown and complexity report in `sysml/model` response
26
+ - New tests: codeActions, complexity, libraryIndex, semantic validation, MCP preview/diagnostics
27
+
28
+ ### Changed
29
+
30
+ - MCP `validate` response shape: now returns `syntaxErrors`, `semanticIssues`, and `totalIssues` (was `errors` + `errorCount`)
31
+ - Symbol `typeName` → `typeNames` (array) across MCP core and model provider
32
+ - Definition provider simplified: word-at-position logic moved inline
33
+ - References provider: uses symbol-table–based `findReferences()` instead of cross-file text scanning
34
+ - Diagnostics computed synchronously on document change (removed background parse worker thread)
35
+ - Symbol table kind inference: direct string comparison replaces regex-based rule matching for minification safety
36
+ - Document manager simplified: removed `TextDocuments` integration; parse timing now derived from `ParseResult.timing`
37
+ - esbuild: output format changed from ESM (`.mjs`) to CJS (`.js`); simplified to server + MCP + client bundles
38
+ - Parser simplified: removed SLL/LL two-stage fallback with `BailErrorStrategy`; single-pass parse
39
+ - MCP server: added `instructions` field for tool-call guidance
40
+ - Library index: `resolveLibraryPackage()` replaced by `resolveLibraryType()` for type-level lookups
41
+
42
+ ### Removed
43
+
44
+ - Background parse worker thread (`parseWorker.mjs`) and DFA warm-up
45
+ - `resolveAt()` and `getWordAtPosition()` from symbol table (moved to providers)
46
+ - `findTextReferences()` text-scanning reference finder
47
+ - Keyword typo validation from diagnostics provider (replaced by semantic validator)
48
+ - Several parser and symbol table tests (connection-end parsing, keyword typo, `findTextReferences`)
49
+
3
50
  ## [0.2.0]
4
51
 
5
52
  ### Added
package/README.md CHANGED
@@ -1,23 +1,36 @@
1
1
  # SysML v2 Language Server
2
2
 
3
- A [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) implementation for [SysML v2](https://www.omgsysml.org/SysML-2.htm), powered by the ANTLR4 grammar from [daltskin/sysml-v2-grammar](https://github.com/daltskin/sysml-v2-grammar).
3
+ [![npm](https://img.shields.io/npm/v/sysml-v2-lsp?logo=npm)](https://www.npmjs.com/package/sysml-v2-lsp)
4
+
5
+ [![SysML v2.0 Language Support VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/JamieD.sysml-v2-support?label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=JamieD.sysml-v2-support)
6
+
7
+ A [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) implementation for [SysML v2](https://www.omgsysml.org/SysML-2.htm).
4
8
 
5
9
  ## Features
6
10
 
7
- | Feature | Status | Description |
8
- |---------|--------|-------------|
9
- | **Diagnostics** | ✅ | Syntax error reporting with red squiggles |
10
- | **Document Symbols** | ✅ | Outline panel with SysML model structure |
11
- | **Hover** | ✅ | Element kind, type, and documentation on hover |
12
- | **Go to Definition** | ✅ | Ctrl+Click navigation to declarations |
13
- | **Find References** | ✅ | Find all usages of a symbol |
14
- | **Code Completion** | ✅ | Keywords, snippets, and symbol suggestions |
15
- | **Semantic Tokens** | ✅ | Rich, context-aware syntax highlighting |
16
- | **Folding Ranges** | ✅ | Collapsible `{ }` blocks and comments |
17
- | **Rename** | ✅ | Rename symbol and all references |
11
+ | Feature | Status | Description |
12
+ | ----------------------- | ------ | -------------------------------------------------------- |
13
+ | **Diagnostics** | ✅ | Syntax error reporting with red squiggles |
14
+ | **Document Symbols** | ✅ | Outline panel with SysML model structure |
15
+ | **Hover** | ✅ | Element kind, type, and documentation on hover |
16
+ | **Go to Definition** | ✅ | Ctrl+Click navigation to declarations |
17
+ | **Find References** | ✅ | Find all usages of a symbol |
18
+ | **Code Completion** | ✅ | Keywords, snippets, and symbol suggestions |
19
+ | **Semantic Tokens** | ✅ | Rich, context-aware syntax highlighting |
20
+ | **Folding Ranges** | ✅ | Collapsible `{ }` blocks and comments |
21
+ | **Rename** | ✅ | Rename symbol and all references |
22
+ | **Semantic Validation** | ✅ | Unresolved types, invalid multiplicity, duplicates |
23
+ | **Code Actions** | ✅ | Quick-fixes: naming, doc stubs, empty enums, unused defs |
24
+ | **Complexity Analysis** | ✅ | Structural metrics, composite index, hotspot detection |
25
+ | **Mermaid Preview** | ✅ | 6 diagram types with auto-detect, focus, and diff modes |
26
+ | **MCP Server** | ✅ | AI-assisted modelling via `sysml-mcp` CLI |
18
27
 
19
28
  ## Quick Start
20
29
 
30
+ ### Install from Marketplace
31
+
32
+ Install via the VS Code extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=JamieD.sysml-v2-support).
33
+
21
34
  ### Dev Container (recommended)
22
35
 
23
36
  Open in GitHub Codespaces or VS Code Dev Containers — everything is pre-installed.
@@ -28,9 +41,6 @@ Open in GitHub Codespaces or VS Code Dev Containers — everything is pre-instal
28
41
  # Install dependencies
29
42
  npm install
30
43
 
31
- # Generate TypeScript parser from ANTLR4 grammar
32
- npm run generate
33
-
34
44
  # Build
35
45
  npm run build
36
46
 
@@ -53,16 +63,16 @@ Use the **"Client + Server"** compound debug configuration to debug both sides s
53
63
 
54
64
  ```
55
65
  ┌──────────────────────┐ IPC ┌──────────────────────────┐
56
- │ VS Code Extension │ ◄─────────► │ Language Server
57
- │ (Language Client) │ │ (Separate Process)
66
+ │ VS Code Extension │ ◄─────────► │ Language Server
67
+ │ (Language Client) │ │ (Separate Process)
58
68
  ├──────────────────────┤ ├──────────────────────────┤
59
- │ • Starts server │ │ • ANTLR4 parser
60
- │ • Registers language │ │ • Diagnostics
61
- │ │ • Completion (keywords)
62
- │ │ • Symbols / hover
63
- │ │ • Go-to-def / references
64
- │ │ • Semantic tokens
65
- │ │ • Rename / folding
69
+ │ • Starts server │ │ • Parser
70
+ │ • Registers language │ │ • Diagnostics
71
+ │ │ • Completion (keywords)
72
+ │ │ • Symbols / hover
73
+ │ │ • Go-to-def / references
74
+ │ │ • Semantic tokens
75
+ │ │ • Rename / folding
66
76
  └──────────────────────┘ └──────────────────────────┘
67
77
  ```
68
78
 
@@ -76,10 +86,12 @@ sysml-v2-lsp/
76
86
  │ └── src/
77
87
  │ ├── server.ts # LSP connection, capability registration
78
88
  │ ├── documentManager.ts # Parse cache, document lifecycle
79
- │ ├── parser/ # ANTLR4 parse pipeline
89
+ │ ├── parser/ # Parse pipeline
80
90
  │ ├── symbols/ # Symbol table, scopes, element types
81
- └── providers/ # LSP feature implementations
82
- ├── grammar/ # ANTLR4 grammar files (.g4)
91
+ ├── providers/ # LSP feature implementations
92
+ ├── analysis/ # Complexity analyzer
93
+ │ └── mcp/ # Mermaid diagram generator
94
+ ├── grammar/ # Grammar files (.g4)
83
95
  ├── test/ # Unit tests (vitest) + E2E tests
84
96
  └── package.json # Extension manifest + monorepo scripts
85
97
  ```
@@ -90,7 +102,6 @@ The grammar files in `grammar/` are sourced from [daltskin/sysml-v2-grammar](htt
90
102
 
91
103
  ```bash
92
104
  npm run update-grammar
93
- npm run generate
94
105
  ```
95
106
 
96
107
  ## Available Commands
@@ -109,19 +120,19 @@ make ci # Full CI pipeline
109
120
 
110
121
  ## Technology Stack
111
122
 
112
- | Component | Technology |
113
- |-----------|-----------|
114
- | Language | TypeScript (strict mode) |
115
- | Runtime | Node.js ≥ 18 |
116
- | Parser | ANTLR4 via [antlr4ng](https://github.com/mike-lischke/antlr4ng) |
117
- | Generator | [antlr-ng](https://github.com/nicklockwood/antlr-ng) |
118
- | LSP | [vscode-languageserver](https://github.com/microsoft/vscode-languageserver-node) |
119
- | Bundler | esbuild |
120
- | Tests | vitest |
123
+ | Component | Technology |
124
+ | --------- | -------------------------------------------------------------------------------- |
125
+ | Language | TypeScript (strict mode) |
126
+ | Runtime | Node.js ≥ 18 |
127
+ | Parser | [antlr4ng](https://github.com/mike-lischke/antlr4ng) |
128
+ | Generator | [antlr-ng](https://github.com/nicklockwood/antlr-ng) |
129
+ | LSP | [vscode-languageserver](https://github.com/microsoft/vscode-languageserver-node) |
130
+ | Bundler | esbuild |
131
+ | Tests | vitest |
121
132
 
122
133
  ## Related Projects
123
134
 
124
- - [daltskin/sysml-v2-grammar](https://github.com/daltskin/sysml-v2-grammar) — ANTLR4 grammar for SysML v2
135
+ - [daltskin/sysml-v2-grammar](https://github.com/daltskin/sysml-v2-grammar) — Grammar for SysML v2
125
136
  - [daltskin/VSCode_SysML_Extension](https://github.com/daltskin/VSCode_SysML_Extension) — VS Code extension with visualization
126
137
  - [OMG SysML v2 Specification](https://github.com/Systems-Modeling/SysML-v2-Release)
127
138