umple-lsp-server 0.4.2 → 1.0.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +35 -0
  3. package/completions.scm +9 -3
  4. package/definitions.scm +5 -0
  5. package/highlights.scm +487 -0
  6. package/out/codeActions.d.ts +31 -0
  7. package/out/codeActions.js +361 -0
  8. package/out/codeActions.js.map +1 -0
  9. package/out/completionAnalysis.d.ts +9 -1
  10. package/out/completionAnalysis.js +1211 -64
  11. package/out/completionAnalysis.js.map +1 -1
  12. package/out/completionBuilder.d.ts +1 -1
  13. package/out/completionBuilder.js +463 -319
  14. package/out/completionBuilder.js.map +1 -1
  15. package/out/completionTriggers.d.ts +20 -0
  16. package/out/completionTriggers.js +69 -0
  17. package/out/completionTriggers.js.map +1 -0
  18. package/out/diagnosticSources.d.ts +3 -0
  19. package/out/diagnosticSources.js +11 -0
  20. package/out/diagnosticSources.js.map +1 -0
  21. package/out/diagramNavigation.js +3 -3
  22. package/out/diagramNavigation.js.map +1 -1
  23. package/out/documentSymbolBuilder.js +2 -37
  24. package/out/documentSymbolBuilder.js.map +1 -1
  25. package/out/formatter.d.ts +13 -1
  26. package/out/formatter.js +303 -10
  27. package/out/formatter.js.map +1 -1
  28. package/out/hoverBuilder.js +90 -23
  29. package/out/hoverBuilder.js.map +1 -1
  30. package/out/inlayHints.d.ts +21 -0
  31. package/out/inlayHints.js +98 -0
  32. package/out/inlayHints.js.map +1 -0
  33. package/out/referenceSearch.d.ts +1 -1
  34. package/out/referenceSearch.js +134 -7
  35. package/out/referenceSearch.js.map +1 -1
  36. package/out/resolver.js +82 -3
  37. package/out/resolver.js.map +1 -1
  38. package/out/semanticTokens.d.ts +32 -0
  39. package/out/semanticTokens.js +228 -0
  40. package/out/semanticTokens.js.map +1 -0
  41. package/out/server.js +216 -36
  42. package/out/server.js.map +1 -1
  43. package/out/snippets.d.ts +39 -0
  44. package/out/snippets.js +328 -0
  45. package/out/snippets.js.map +1 -0
  46. package/out/symbolIndex.d.ts +50 -0
  47. package/out/symbolIndex.js +170 -7
  48. package/out/symbolIndex.js.map +1 -1
  49. package/out/symbolPresentation.d.ts +3 -0
  50. package/out/symbolPresentation.js +45 -0
  51. package/out/symbolPresentation.js.map +1 -0
  52. package/out/symbolTypes.d.ts +1 -0
  53. package/out/tokenAnalysis.js +77 -4
  54. package/out/tokenAnalysis.js.map +1 -1
  55. package/out/tokenTypes.d.ts +8 -1
  56. package/out/tokenTypes.js +2 -0
  57. package/out/tokenTypes.js.map +1 -1
  58. package/out/treeUtils.js +17 -4
  59. package/out/treeUtils.js.map +1 -1
  60. package/out/workspaceSymbolBuilder.d.ts +3 -0
  61. package/out/workspaceSymbolBuilder.js +117 -0
  62. package/out/workspaceSymbolBuilder.js.map +1 -0
  63. package/package.json +5 -2
  64. package/references.scm +31 -3
  65. package/tree-sitter-umple.wasm +0 -0
  66. package/out/bin.d.ts +0 -2
  67. package/out/bin.js +0 -5
  68. package/out/bin.js.map +0 -1
  69. package/out/log.d.ts +0 -7
  70. package/out/log.js +0 -22
  71. package/out/log.js.map +0 -1
  72. package/out/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2026-04-29
4
+
5
+ - Added broader semantic coverage across completion, hover, go-to-definition, references, rename, workspace symbols, inlay hints, semantic tokens, and code actions.
6
+ - Improved association, requirement, trace, port, state, method, class, trait, and enum language intelligence.
7
+ - Added class-scoped transition event symbols so `trace transition eventName;` can resolve, find references, hover, and complete real transition events.
8
+ - Expanded Tree-sitter grammar and query coverage for additional Umple constructs, with corpus checks to guard parser regressions.
9
+ - Improved formatter safety and parser-visible formatting behavior, including idempotence and symbol-preservation checks.
10
+ - Updated docs for editor behavior, local development, publishing, parser/highlighting boundaries, and future maintenance.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # umple-lsp-server
2
+
3
+ Language Server Protocol implementation for the [Umple](https://www.umple.org/) modeling language.
4
+
5
+ This package provides the editor-agnostic server used by VS Code, Zed, Neovim, and any generic LSP client that can launch a Node-based language server.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g umple-lsp-server
11
+ umple-lsp-server --stdio
12
+ ```
13
+
14
+ ## What Ships
15
+
16
+ - LSP server JavaScript compiled to `out/`
17
+ - `umple-lsp-server` command wrapper in `bin/`
18
+ - Bundled Tree-sitter Umple WASM parser
19
+ - Bundled Tree-sitter query files for definitions, references, completions, and highlighting
20
+
21
+ `umplesync.jar` is not bundled in the npm package. Editor clients either download it separately or pass a local path through server initialization options.
22
+
23
+ ## Release Notes
24
+
25
+ Current release: `1.0.0`
26
+
27
+ Highlights:
28
+
29
+ - Broader completion coverage for associations, requirements, traces, ports, states, and class-scoped symbols.
30
+ - Safer go-to-definition, references, rename, workspace symbols, hover, semantic tokens, inlay hints, and code actions across more Umple constructs.
31
+ - Formatter safety checks and focused formatting improvements for parser-visible structural syntax.
32
+ - Expanded Tree-sitter grammar and query coverage backed by corpus checks.
33
+ - Trace transition event symbols: `trace transition flip;` now resolves, references, hovers, and completes class-scoped transition events.
34
+
35
+ See `CHANGELOG.md` in this package and the upstream repository wiki for the full release history and publishing notes.
package/completions.scm CHANGED
@@ -85,10 +85,16 @@
85
85
  ; All trace entity forms use the same completion scope
86
86
  (trace_statement (trace_entity) @scope.trace_attribute_method)
87
87
  (trace_statement (trace_entity_call) @scope.trace_attribute_method)
88
- (trace_postfix "record" . (identifier) @scope.trace_attribute_method)
88
+ (trace_record_target) @scope.trace_attribute_method
89
89
 
90
- ; referenced_statemachine definition — offer statemachine names from enclosing class
91
- (referenced_statemachine definition: (identifier) @scope.statemachine)
90
+ ; referenced_statemachine definition — offer statemachine names from enclosing
91
+ ; class plus top-level standalone statemachines (topic 055).
92
+ (referenced_statemachine definition: (identifier) @scope.referenced_sm_target)
93
+
94
+ ; trait_sm_binding value — offer statemachine names (first segment) and states
95
+ ; in the bound SM (subsequent dotted segments). Disambiguation between first and
96
+ ; non-first identifier happens in completionAnalysis.ts.
97
+ (trait_sm_binding value: (qualified_name (identifier) @scope.trait_sm_binding_target))
92
98
 
93
99
  ; depend java.util.* — suppress (not a symbol reference)
94
100
  (depend_statement) @scope.suppress
package/definitions.scm CHANGED
@@ -37,13 +37,18 @@
37
37
 
38
38
  (attribute_declaration name: (identifier) @definition.attribute)
39
39
  (enumerated_attribute name: (identifier) @definition.attribute)
40
+ (port_declaration name: (identifier) @definition.port)
40
41
  (const_declaration name: (identifier) @definition.const)
41
42
  (method_declaration name: (identifier) @definition.method)
42
43
  (abstract_method_declaration name: (identifier) @definition.method)
43
44
  (method_signature name: (identifier) @definition.method)
44
45
  (trait_method_signature name: (identifier) @definition.method)
46
+ (active_method name: (identifier) @definition.method)
47
+ (test_case name: (identifier) @definition.method)
45
48
  (state_machine name: (identifier) @definition.statemachine)
46
49
  (state name: (identifier) @definition.state)
50
+ (state name: (qualified_name (identifier) @definition.state .))
51
+ (event_spec (identifier) @definition.event)
47
52
  (referenced_statemachine name: (identifier) @definition.statemachine)
48
53
  (emit_method name: (identifier) @definition.method)
49
54
  (template_attribute name: (identifier) @definition.template)
package/highlights.scm ADDED
@@ -0,0 +1,487 @@
1
+ ; Tree-sitter highlight queries for Umple
2
+ ; Only uses node types that exist in the grammar
3
+
4
+ ; =============
5
+ ; KEYWORDS
6
+ ; =============
7
+
8
+ [
9
+ "class"
10
+ "interface"
11
+ "trait"
12
+ "enum"
13
+ "association"
14
+ "external"
15
+ "req"
16
+ "mixset"
17
+ "associationClass"
18
+ "statemachine"
19
+ ] @keyword.type
20
+
21
+ [
22
+ "namespace"
23
+ "use"
24
+ "depend"
25
+ "generate"
26
+ ] @keyword.import
27
+
28
+ [
29
+ "filter"
30
+ "include"
31
+ "includeFilter"
32
+ "hops"
33
+ "super"
34
+ "sub"
35
+ "strictness"
36
+ "glossary"
37
+ "who"
38
+ "when"
39
+ "what"
40
+ "why"
41
+ "userStep"
42
+ "systemResponse"
43
+ ] @keyword.directive
44
+
45
+ (filter_definition
46
+ name: (filter_name (integer_literal) @number))
47
+
48
+ (filter_definition
49
+ name: (filter_name (identifier) @variable))
50
+
51
+ (filter_combined_value
52
+ (filter_name (integer_literal) @number))
53
+
54
+ (filter_combined_value
55
+ (filter_name (identifier) @variable))
56
+
57
+ (filter_value
58
+ (filter_pattern) @string.special)
59
+
60
+ (filter_namespace_stmt
61
+ (qualified_name) @module)
62
+
63
+ (filter_hop_super
64
+ (integer_literal) @number)
65
+
66
+ (filter_hop_sub
67
+ (integer_literal) @number)
68
+
69
+ (filter_hop_association
70
+ (integer_literal) @number)
71
+
72
+ (generate_statement language: _ @string.special)
73
+
74
+ (code_lang) @string.special
75
+
76
+ [
77
+ "--override"
78
+ "--override-all"
79
+ "-s"
80
+ "--suboption"
81
+ ] @keyword.modifier
82
+
83
+ [
84
+ "isA"
85
+ "implementsReq"
86
+ "isFeature"
87
+ ] @keyword.modifier
88
+
89
+ [
90
+ "require"
91
+ "subfeature"
92
+ ] @keyword.directive
93
+
94
+ [
95
+ "abstract"
96
+ "inner"
97
+ "static"
98
+ "const"
99
+ "constant"
100
+ "lazy"
101
+ "settable"
102
+ "internal"
103
+ "defaulted"
104
+ "immutable"
105
+ "autounique"
106
+ "ivar"
107
+ "unique"
108
+ "singleton"
109
+ "queued"
110
+ "pooled"
111
+ "conjugated"
112
+ "atomic"
113
+ "synchronous"
114
+ "intercept"
115
+ "override"
116
+ "JUnit"
117
+ "concrete"
118
+ "forced"
119
+ "on"
120
+ "off"
121
+ "modelOnly"
122
+ "noExtraCode"
123
+ "none"
124
+ "allow"
125
+ "ignore"
126
+ "expect"
127
+ "disallow"
128
+ "disable"
129
+ ] @keyword.modifier
130
+
131
+ [
132
+ "public"
133
+ "private"
134
+ "protected"
135
+ ] @keyword.modifier
136
+
137
+ [
138
+ "before"
139
+ "after"
140
+ "around"
141
+ "custom"
142
+ "generated"
143
+ "all"
144
+ "emit"
145
+ ] @keyword.directive
146
+
147
+ [
148
+ "entry"
149
+ "exit"
150
+ "do"
151
+ "active"
152
+ "final"
153
+ "trace"
154
+ "tracer"
155
+ "tracecase"
156
+ "suboption"
157
+ "distributable"
158
+ "test"
159
+ "testSequence"
160
+ "generic"
161
+ "activate"
162
+ "deactivate"
163
+ "position"
164
+ "position.association"
165
+ "in"
166
+ "out"
167
+ "port"
168
+ ] @keyword
169
+
170
+ ; Trace postfix sub-keywords (children of trace_postfix, not trace_statement)
171
+ ; Trace prefix keywords (children of trace_statement)
172
+ (trace_statement ["set" "get" "onlyGet" "onlySet" "in" "out" "entry" "exit" "cardinality" "add" "remove" "transition"] @keyword)
173
+ (trace_postfix ["where" "until" "after" "giving" "execute" "record" "logLevel" "for" "period" "during"] @keyword)
174
+ (trace_postfix ["trace" "debug" "info" "warn" "error" "fatal" "all" "finest" "finer" "fine" "config" "warning" "severe"] @constant)
175
+ (trace_record_target "only" @keyword)
176
+ ; Tracer directive type
177
+ (tracer_directive type: (identifier) @type)
178
+ (tracer_directive
179
+ type: (identifier)
180
+ (identifier) @variable.member)
181
+ ; activate/deactivate modifiers (direct children of trace_statement)
182
+ (trace_statement ["onAllObjects" "onThisThreadOnly" "onThisObject" "for"] @keyword)
183
+
184
+ [
185
+ "new"
186
+ ] @keyword.operator
187
+
188
+ [
189
+ "displayColor"
190
+ "displayColour"
191
+ "key"
192
+ "self"
193
+ ] @keyword
194
+
195
+ ; =============
196
+ ; TYPES
197
+ ; =============
198
+
199
+ (class_definition
200
+ name: (identifier) @type.definition)
201
+
202
+ (interface_definition
203
+ name: (identifier) @type.definition)
204
+
205
+ (trait_definition
206
+ name: (identifier) @type.definition)
207
+
208
+ (enum_definition
209
+ name: (identifier) @type.definition)
210
+
211
+ (enum_value
212
+ name: (identifier) @constant)
213
+
214
+ (external_definition
215
+ name: (identifier) @type.definition)
216
+
217
+ (requirement_definition
218
+ name: (identifier) @type.definition)
219
+
220
+ (mixset_definition
221
+ name: (identifier) @type.definition)
222
+
223
+ (association_class_definition
224
+ name: (identifier) @type.definition)
225
+
226
+ (toplevel_code_injection
227
+ target: (identifier) @type)
228
+
229
+ (type_name
230
+ (qualified_name) @type)
231
+
232
+ (isa_declaration
233
+ (isa_type_list
234
+ (type_name) @type))
235
+
236
+ (trait_binding
237
+ param: (identifier) @variable
238
+ value: (qualified_name) @type)
239
+
240
+ ; Trait SM binding: highlight only (value is visual approximation, not semantic type)
241
+ (trait_sm_binding
242
+ param: (qualified_name) @variable.member
243
+ value: (qualified_name) @type)
244
+
245
+ ; Built-in types
246
+ ((identifier) @type.builtin
247
+ (#any-of? @type.builtin
248
+ "String"
249
+ "Integer"
250
+ "Float"
251
+ "Double"
252
+ "Boolean"
253
+ "Date"
254
+ "Time"
255
+ "void"))
256
+
257
+ ; =============
258
+ ; FUNCTIONS
259
+ ; =============
260
+
261
+ (method_declaration
262
+ name: (identifier) @function)
263
+
264
+ (method_signature
265
+ name: (identifier) @function)
266
+
267
+ (trait_method_signature
268
+ name: (identifier) @function)
269
+
270
+ (active_method
271
+ name: (identifier) @function)
272
+
273
+ (event_spec
274
+ (identifier) @function.method)
275
+
276
+ (emit_method name: (identifier) @function)
277
+ (test_case name: (identifier) @function)
278
+ (test_sequence name: (identifier) @function)
279
+ (test_sequence_step
280
+ from: (identifier) @function.method
281
+ to: (identifier) @function.method)
282
+ (generic_test_case name: (identifier) @function)
283
+ (template_attribute name: (identifier) @variable.member)
284
+ (template_body) @string
285
+ (template_reference template_owner: (identifier) @type)
286
+ (template_reference template_name: (identifier) @variable.member)
287
+
288
+ ; =============
289
+ ; VARIABLES & PARAMETERS
290
+ ; =============
291
+
292
+ (attribute_declaration
293
+ name: (identifier) @variable.member)
294
+
295
+ (const_declaration
296
+ name: (identifier) @constant)
297
+
298
+ (param
299
+ name: (identifier) @variable.parameter)
300
+
301
+ ; Ports
302
+ (port_declaration
303
+ name: (identifier) @variable.member)
304
+
305
+ (port_connector
306
+ (qualified_name (identifier) @variable.member))
307
+
308
+ ; Key attributes
309
+ (key_definition
310
+ (identifier) @variable.member)
311
+
312
+ ; =============
313
+ ; STATE MACHINES
314
+ ; =============
315
+
316
+ (state_machine
317
+ name: (identifier) @variable.member)
318
+
319
+ (statemachine_definition
320
+ name: (identifier) @variable.member)
321
+
322
+ (referenced_statemachine
323
+ name: (identifier) @variable.member)
324
+
325
+ (referenced_statemachine
326
+ definition: (identifier) @type)
327
+
328
+ "as" @keyword
329
+
330
+ (state
331
+ change_type: _ @operator)
332
+
333
+ (state
334
+ name: (identifier) @constant)
335
+
336
+ (transition
337
+ target: (qualified_name (identifier) @constant))
338
+
339
+ ; Standalone transition states
340
+ (standalone_transition
341
+ from_state: (identifier) @constant)
342
+
343
+ (standalone_transition
344
+ to_state: (identifier) @constant)
345
+
346
+ (state_to_state_transition
347
+ from_state: (identifier) @constant)
348
+
349
+ (state_to_state_transition
350
+ to_state: (identifier) @constant)
351
+
352
+ ; =============
353
+ ; ASSOCIATIONS
354
+ ; =============
355
+
356
+ ; Inline association type (e.g., "1 -- * Address addresses;")
357
+ (association_inline
358
+ right_type: (identifier) @type)
359
+
360
+ (association_inline
361
+ right_role: (identifier) @variable.member)
362
+
363
+ (association_inline
364
+ left_role: (identifier) @variable.member)
365
+
366
+ ; Standalone association types (e.g., "0..1 Mentor -- * Student;")
367
+ (association_member
368
+ left_type: (identifier) @type)
369
+
370
+ (association_member
371
+ right_type: (identifier) @type)
372
+
373
+ (association_member
374
+ left_role: (identifier) @variable.member)
375
+
376
+ (association_member
377
+ right_role: (identifier) @variable.member)
378
+
379
+ ; Single association end (in associationClass)
380
+ (single_association_end
381
+ type: (identifier) @type)
382
+
383
+ (single_association_end
384
+ other_end_role: (identifier) @variable.member)
385
+
386
+ (single_association_end
387
+ role_name: (identifier) @variable.member)
388
+
389
+ ; Symmetric reflexive association
390
+ (symmetric_reflexive_association
391
+ role: (identifier) @variable.member)
392
+
393
+ ; =============
394
+ ; NAMESPACE & IMPORTS
395
+ ; =============
396
+
397
+ (namespace_declaration
398
+ name: (qualified_name) @module)
399
+
400
+ (use_statement
401
+ path: (_) @string.special.path)
402
+
403
+ (depend_statement
404
+ package: (_) @module)
405
+
406
+ ; =============
407
+ ; OPERATORS & PUNCTUATION
408
+ ; =============
409
+
410
+ [
411
+ "->"
412
+ "--"
413
+ "<-"
414
+ "<@>-"
415
+ "-<@>"
416
+ ">->"
417
+ "<-<"
418
+ "="
419
+ "||"
420
+ ] @operator
421
+
422
+ [
423
+ ";"
424
+ ","
425
+ "."
426
+ ] @punctuation.delimiter
427
+
428
+ [
429
+ "{"
430
+ "}"
431
+ "("
432
+ ")"
433
+ "["
434
+ "]"
435
+ "<"
436
+ ">"
437
+ ] @punctuation.bracket
438
+
439
+ ; Multiplicity
440
+ (multiplicity) @number
441
+
442
+ ; UmpleOnline layout payloads
443
+ (position_directive
444
+ (position_number) @number)
445
+
446
+ (position_association_directive
447
+ (position_association_payload) @variable.member
448
+ (position_coordinate_pair) @number)
449
+
450
+ ; =============
451
+ ; LITERALS
452
+ ; =============
453
+
454
+ (number) @number
455
+
456
+ (integer_literal) @number
457
+
458
+ (string_literal) @string
459
+
460
+ (boolean) @boolean
461
+
462
+ "null" @constant.builtin
463
+ "true" @boolean
464
+ "false" @boolean
465
+
466
+ ; =============
467
+ ; COMMENTS
468
+ ; =============
469
+
470
+ (line_comment) @comment
471
+
472
+ (block_comment) @comment
473
+
474
+ ; =============
475
+ ; CONSTRAINTS
476
+ ; =============
477
+
478
+ (constraint) @string.special
479
+
480
+ ; Named invariant label: [myInvariant: expr]
481
+ (constraint_name (identifier) @property)
482
+
483
+ ; =============
484
+ ; REQUIRE STATEMENT
485
+ ; =============
486
+
487
+ (require_body) @string.special
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Quick-fix code actions for Umple diagnostics (topics 056, 057).
3
+ *
4
+ * Pure logic only: takes a TextDocument + Diagnostic[] and returns the
5
+ * CodeActions that apply. No LSP transport, no compiler invocation.
6
+ *
7
+ * Currently produces a single user-visible action: `Add missing semicolon`.
8
+ * Three trigger codes, three classifiers:
9
+ *
10
+ * - W1007 (class-content): isA / implementsReq / inline assoc / interface
11
+ * method signature / attribute declaration (incl. simple default value).
12
+ * - W1006 (state-machine): transition with optional guard + action body.
13
+ * - E1502 (filter-body): include / includeFilter / namespace statements.
14
+ * The diagnostic line points to the filter HEADER, so this branch
15
+ * scans the filter block for an unterminated single-line statement and
16
+ * emits the action only when EXACTLY ONE candidate is found.
17
+ *
18
+ * Each classifier rejects line shapes where appending `;` either doesn't
19
+ * fix the diagnostic or introduces a new one.
20
+ */
21
+ import { CodeAction, Diagnostic } from "vscode-languageserver/node";
22
+ import { TextDocument } from "vscode-languageserver-textdocument";
23
+ /**
24
+ * Build all quick-fix CodeActions that apply to the given diagnostic set.
25
+ * Currently this is just `Add missing semicolon`.
26
+ */
27
+ export declare function buildQuickFixActions(document: TextDocument, diagnostics: Diagnostic[]): CodeAction[];
28
+ export declare function splitCodeAndComment(lineText: string): {
29
+ code: string;
30
+ comment: string;
31
+ };