umple-lsp-server 0.1.1 → 0.2.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/completions.scm +72 -0
- package/definitions.scm +37 -0
- package/out/bin.d.ts +2 -0
- package/out/bin.js +5 -0
- package/out/bin.js.map +1 -0
- package/out/keywords.d.ts +4 -36
- package/out/keywords.js +14 -200
- package/out/keywords.js.map +1 -1
- package/out/log.d.ts +7 -0
- package/out/log.js +22 -0
- package/out/log.js.map +1 -0
- package/out/server.js +266 -311
- package/out/server.js.map +1 -1
- package/out/symbolIndex.d.ts +123 -90
- package/out/symbolIndex.js +619 -426
- package/out/symbolIndex.js.map +1 -1
- package/out/tsconfig.tsbuildinfo +1 -0
- package/out/utils/debug.d.ts +1 -0
- package/out/utils/debug.js +8 -0
- package/out/utils/debug.js.map +1 -0
- package/package.json +6 -4
- package/references.scm +99 -0
- package/tree-sitter-umple.wasm +0 -0
package/completions.scm
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
; completions.scm — Scope detection for symbol completions.
|
|
2
|
+
;
|
|
3
|
+
; Used by the LSP server to determine which symbols to offer.
|
|
4
|
+
; Capture names follow the pattern: @scope.<kind1>_<kind2>_...
|
|
5
|
+
; where each <kind> is a SymbolKind.
|
|
6
|
+
;
|
|
7
|
+
; The LSP finds the innermost (smallest) capture containing
|
|
8
|
+
; the cursor and offers symbols of the encoded kinds.
|
|
9
|
+
;
|
|
10
|
+
; @scope.none = keywords only (no symbol completions)
|
|
11
|
+
; @scope.suppress = suppress ALL completions
|
|
12
|
+
; @scope.use_path = trigger file path completions
|
|
13
|
+
|
|
14
|
+
; =====================
|
|
15
|
+
; SUPPRESS CONTEXTS
|
|
16
|
+
; =====================
|
|
17
|
+
; Method/code bodies — not Umple completion context
|
|
18
|
+
(code_content) @scope.suppress
|
|
19
|
+
(code_block) @scope.suppress
|
|
20
|
+
|
|
21
|
+
; =====================
|
|
22
|
+
; TOP-LEVEL SCOPES (keywords only)
|
|
23
|
+
; =====================
|
|
24
|
+
(source_file) @scope.none
|
|
25
|
+
(mixset_definition) @scope.none
|
|
26
|
+
(statemachine_definition) @scope.none
|
|
27
|
+
(requirement_definition) @scope.none
|
|
28
|
+
|
|
29
|
+
; =====================
|
|
30
|
+
; CLASS-LIKE SCOPES (offer type names)
|
|
31
|
+
; =====================
|
|
32
|
+
(class_definition) @scope.class_interface_trait_enum
|
|
33
|
+
(trait_definition) @scope.class_interface_trait_enum
|
|
34
|
+
(interface_definition) @scope.class_interface_trait_enum
|
|
35
|
+
(association_class_definition) @scope.class_interface_trait_enum
|
|
36
|
+
(isa_declaration) @scope.class_interface_trait_enum
|
|
37
|
+
|
|
38
|
+
; =====================
|
|
39
|
+
; ASSOCIATION SCOPES (offer class names only)
|
|
40
|
+
; =====================
|
|
41
|
+
(association_definition) @scope.class
|
|
42
|
+
(association_inline) @scope.class
|
|
43
|
+
(association_member) @scope.class
|
|
44
|
+
|
|
45
|
+
; =====================
|
|
46
|
+
; STATE MACHINE SCOPES (offer state names)
|
|
47
|
+
; =====================
|
|
48
|
+
(state_machine) @scope.state
|
|
49
|
+
(state) @scope.state
|
|
50
|
+
(transition) @scope.state
|
|
51
|
+
|
|
52
|
+
; =====================
|
|
53
|
+
; FINE-GRAINED CLASS MEMBER SCOPES
|
|
54
|
+
; =====================
|
|
55
|
+
; key { attr1, attr2 } — offer attribute names (scoped to class + inherited)
|
|
56
|
+
(key_definition) @scope.attribute
|
|
57
|
+
|
|
58
|
+
; depend java.util.* — suppress (not a symbol reference)
|
|
59
|
+
(depend_statement) @scope.suppress
|
|
60
|
+
|
|
61
|
+
; implementsReq R1, R2 — offer requirement names
|
|
62
|
+
(req_implementation) @scope.requirement
|
|
63
|
+
|
|
64
|
+
; [name != ""] — offer only own attributes (Umple E28: no inherited attrs in constraints)
|
|
65
|
+
(constraint) @scope.own_attribute
|
|
66
|
+
|
|
67
|
+
; =====================
|
|
68
|
+
; OTHER
|
|
69
|
+
; =====================
|
|
70
|
+
(enum_definition) @scope.none
|
|
71
|
+
(use_statement) @scope.use_path
|
|
72
|
+
(template_list) @scope.template
|
package/definitions.scm
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
; definitions.scm — Maps AST nodes to symbol definitions for indexing.
|
|
2
|
+
;
|
|
3
|
+
; Used by the LSP server to build the symbol index.
|
|
4
|
+
; Capture names follow the pattern: @definition.<kind>
|
|
5
|
+
; where <kind> is a SymbolKind ("class", "attribute", "state", etc.)
|
|
6
|
+
;
|
|
7
|
+
; The LSP walks up from each captured node to find the enclosing
|
|
8
|
+
; parent scope (class, statemachine, etc.) for scoped lookups.
|
|
9
|
+
|
|
10
|
+
; =====================
|
|
11
|
+
; TOP-LEVEL DEFINITIONS
|
|
12
|
+
; =====================
|
|
13
|
+
|
|
14
|
+
(class_definition name: (identifier) @definition.class)
|
|
15
|
+
(interface_definition name: (identifier) @definition.interface)
|
|
16
|
+
(trait_definition name: (identifier) @definition.trait)
|
|
17
|
+
(enum_definition name: (identifier) @definition.enum)
|
|
18
|
+
(external_definition name: (identifier) @definition.class)
|
|
19
|
+
(association_definition name: (identifier) @definition.association)
|
|
20
|
+
(requirement_definition name: (identifier) @definition.requirement)
|
|
21
|
+
(mixset_definition name: (identifier) @definition.mixset)
|
|
22
|
+
(association_class_definition name: (identifier) @definition.class)
|
|
23
|
+
(statemachine_definition name: (identifier) @definition.statemachine)
|
|
24
|
+
|
|
25
|
+
; =====================
|
|
26
|
+
; SCOPED DEFINITIONS
|
|
27
|
+
; =====================
|
|
28
|
+
; These require a parent scope (class, statemachine, etc.)
|
|
29
|
+
|
|
30
|
+
(attribute_declaration name: (identifier) @definition.attribute)
|
|
31
|
+
(method_declaration name: (identifier) @definition.method)
|
|
32
|
+
(method_signature name: (identifier) @definition.method)
|
|
33
|
+
(state_machine name: (identifier) @definition.statemachine)
|
|
34
|
+
(state name: (identifier) @definition.state)
|
|
35
|
+
(referenced_statemachine name: (identifier) @definition.statemachine)
|
|
36
|
+
(emit_method name: (identifier) @definition.method)
|
|
37
|
+
(template_attribute name: (identifier) @definition.template)
|
package/out/bin.d.ts
ADDED
package/out/bin.js
ADDED
package/out/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,oBAAkB"}
|
package/out/keywords.d.ts
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Built-in types for attribute/parameter declarations.
|
|
3
|
+
* NOT grammar keywords — they're regular identifiers highlighted by highlights.scm.
|
|
4
|
+
* LookaheadIterator won't yield them, so we offer them explicitly.
|
|
4
5
|
*/
|
|
5
|
-
export declare const
|
|
6
|
-
top: string[];
|
|
7
|
-
class_body: string[];
|
|
8
|
-
attribute_modifiers: string[];
|
|
9
|
-
attribute_types: string[];
|
|
10
|
-
state_machine: string[];
|
|
11
|
-
state: string[];
|
|
12
|
-
association: string[];
|
|
13
|
-
enum: never[];
|
|
14
|
-
method: never[];
|
|
15
|
-
use_path: never[];
|
|
16
|
-
isa_type: never[];
|
|
17
|
-
transition_target: never[];
|
|
18
|
-
association_type: never[];
|
|
19
|
-
depend_package: never[];
|
|
20
|
-
comment: never[];
|
|
21
|
-
unknown: never[];
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Legacy keyword categories (kept for backward compatibility).
|
|
25
|
-
*/
|
|
26
|
-
export declare const KEYWORDS: {
|
|
27
|
-
topLevel: string[];
|
|
28
|
-
classLevel: string[];
|
|
29
|
-
attribute: string[];
|
|
30
|
-
method: string[];
|
|
31
|
-
statemachine: string[];
|
|
32
|
-
constraints: string[];
|
|
33
|
-
modelConstraints: string[];
|
|
34
|
-
tracing: string[];
|
|
35
|
-
testing: string[];
|
|
36
|
-
misc: string[];
|
|
37
|
-
};
|
|
38
|
-
export declare const ALL_KEYWORDS: string[];
|
|
6
|
+
export declare const BUILTIN_TYPES: string[];
|
package/out/keywords.js
CHANGED
|
@@ -1,205 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BUILTIN_TYPES = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Built-in types for attribute/parameter declarations.
|
|
6
|
+
* NOT grammar keywords — they're regular identifiers highlighted by highlights.scm.
|
|
7
|
+
* LookaheadIterator won't yield them, so we offer them explicitly.
|
|
7
8
|
*/
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"mixset",
|
|
19
|
-
"use",
|
|
20
|
-
"external",
|
|
21
|
-
],
|
|
22
|
-
// Inside class/trait/interface body
|
|
23
|
-
class_body: [
|
|
24
|
-
"isA",
|
|
25
|
-
"singleton",
|
|
26
|
-
"depend",
|
|
27
|
-
"before",
|
|
28
|
-
"after",
|
|
29
|
-
// Visibility modifiers for methods
|
|
30
|
-
"public",
|
|
31
|
-
"private",
|
|
32
|
-
"protected",
|
|
33
|
-
// Other method/attribute modifiers
|
|
34
|
-
"static",
|
|
35
|
-
"abstract",
|
|
36
|
-
"const",
|
|
37
|
-
],
|
|
38
|
-
// Attribute modifiers (used in class_body context when typing attribute)
|
|
39
|
-
attribute_modifiers: [
|
|
40
|
-
"lazy",
|
|
41
|
-
"settable",
|
|
42
|
-
"internal",
|
|
43
|
-
"defaulted",
|
|
44
|
-
"immutable",
|
|
45
|
-
"autounique",
|
|
46
|
-
"unique",
|
|
47
|
-
"const",
|
|
48
|
-
],
|
|
49
|
-
// Common types for attribute declarations
|
|
50
|
-
attribute_types: [
|
|
51
|
-
"String",
|
|
52
|
-
"Integer",
|
|
53
|
-
"Double",
|
|
54
|
-
"Float",
|
|
55
|
-
"Boolean",
|
|
56
|
-
"Date",
|
|
57
|
-
"Time",
|
|
58
|
-
"void",
|
|
59
|
-
],
|
|
60
|
-
// State machine definition (outside states)
|
|
61
|
-
state_machine: ["queued", "pooled"],
|
|
62
|
-
// Inside a state
|
|
63
|
-
state: ["entry", "exit", "do", "final", "->"],
|
|
64
|
-
// Inside association block
|
|
65
|
-
association: ["--", "->", "<-", "<@>-", "-<@>", ">->", "<-<"],
|
|
66
|
-
// Inside enum - typically just identifiers, no keywords
|
|
67
|
-
enum: [],
|
|
68
|
-
// Inside method body - code completion out of scope for now
|
|
69
|
-
method: [],
|
|
70
|
-
// Contexts where only symbol completions are offered (no keywords)
|
|
71
|
-
use_path: [],
|
|
72
|
-
isa_type: [],
|
|
73
|
-
transition_target: [],
|
|
74
|
-
association_type: [],
|
|
75
|
-
depend_package: [],
|
|
76
|
-
comment: [],
|
|
77
|
-
unknown: [],
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Legacy keyword categories (kept for backward compatibility).
|
|
81
|
-
*/
|
|
82
|
-
exports.KEYWORDS = {
|
|
83
|
-
topLevel: [
|
|
84
|
-
"after",
|
|
85
|
-
"around",
|
|
86
|
-
"association",
|
|
87
|
-
"associationClass",
|
|
88
|
-
"class",
|
|
89
|
-
"distributable",
|
|
90
|
-
"filter",
|
|
91
|
-
"generate",
|
|
92
|
-
"interface",
|
|
93
|
-
"mixset",
|
|
94
|
-
"namespace",
|
|
95
|
-
"statemachine",
|
|
96
|
-
"strictness",
|
|
97
|
-
"trait",
|
|
98
|
-
"use",
|
|
99
|
-
"--redefine",
|
|
100
|
-
],
|
|
101
|
-
classLevel: [
|
|
102
|
-
"abstract",
|
|
103
|
-
"active",
|
|
104
|
-
"const",
|
|
105
|
-
"depend",
|
|
106
|
-
"distributable",
|
|
107
|
-
"emit",
|
|
108
|
-
"enum",
|
|
109
|
-
"inner",
|
|
110
|
-
"isA",
|
|
111
|
-
"key",
|
|
112
|
-
"model",
|
|
113
|
-
"self",
|
|
114
|
-
"singleton",
|
|
115
|
-
"sorted",
|
|
116
|
-
"static",
|
|
117
|
-
],
|
|
118
|
-
attribute: [
|
|
119
|
-
"attribute",
|
|
120
|
-
"attr",
|
|
121
|
-
"autounique",
|
|
122
|
-
"defaulted",
|
|
123
|
-
"false",
|
|
124
|
-
"immutable",
|
|
125
|
-
"internal",
|
|
126
|
-
"lazy",
|
|
127
|
-
"settable",
|
|
128
|
-
"true",
|
|
129
|
-
"unique",
|
|
130
|
-
],
|
|
131
|
-
method: [
|
|
132
|
-
"public",
|
|
133
|
-
"protected",
|
|
134
|
-
"private",
|
|
135
|
-
"static",
|
|
136
|
-
"abstract",
|
|
137
|
-
"pre",
|
|
138
|
-
"custom",
|
|
139
|
-
"generated",
|
|
140
|
-
"all",
|
|
141
|
-
"around_proceed",
|
|
142
|
-
],
|
|
143
|
-
statemachine: [
|
|
144
|
-
"after",
|
|
145
|
-
"afterEvery",
|
|
146
|
-
"as",
|
|
147
|
-
"do",
|
|
148
|
-
"entry",
|
|
149
|
-
"exit",
|
|
150
|
-
"final",
|
|
151
|
-
"Final",
|
|
152
|
-
"pooled",
|
|
153
|
-
"queued",
|
|
154
|
-
"statemachine",
|
|
155
|
-
"unspecified",
|
|
156
|
-
],
|
|
157
|
-
constraints: ["and", "not", "or"],
|
|
158
|
-
modelConstraints: [
|
|
159
|
-
"attribute",
|
|
160
|
-
"attr",
|
|
161
|
-
"has",
|
|
162
|
-
"model",
|
|
163
|
-
"of",
|
|
164
|
-
"subclass",
|
|
165
|
-
"superclass",
|
|
166
|
-
],
|
|
167
|
-
tracing: [
|
|
168
|
-
"add",
|
|
169
|
-
"cardinality",
|
|
170
|
-
"for",
|
|
171
|
-
"giving",
|
|
172
|
-
"remove",
|
|
173
|
-
"trace",
|
|
174
|
-
"tracer",
|
|
175
|
-
"until",
|
|
176
|
-
"where",
|
|
177
|
-
],
|
|
178
|
-
testing: [
|
|
179
|
-
"assertAttribute",
|
|
180
|
-
"assertEqual",
|
|
181
|
-
"assertFalse",
|
|
182
|
-
"assertMethod",
|
|
183
|
-
"assertNull",
|
|
184
|
-
"assertTrue",
|
|
185
|
-
"generic",
|
|
186
|
-
"prefix",
|
|
187
|
-
"regex",
|
|
188
|
-
"suffix",
|
|
189
|
-
"test",
|
|
190
|
-
],
|
|
191
|
-
misc: [
|
|
192
|
-
"forced",
|
|
193
|
-
"hops",
|
|
194
|
-
"ignore",
|
|
195
|
-
"include",
|
|
196
|
-
"includeFilter",
|
|
197
|
-
"off",
|
|
198
|
-
"RMI",
|
|
199
|
-
"sub",
|
|
200
|
-
"super",
|
|
201
|
-
"WS",
|
|
202
|
-
],
|
|
203
|
-
};
|
|
204
|
-
exports.ALL_KEYWORDS = Array.from(new Set(Object.values(exports.KEYWORDS).flat()));
|
|
9
|
+
exports.BUILTIN_TYPES = [
|
|
10
|
+
"String",
|
|
11
|
+
"Integer",
|
|
12
|
+
"Double",
|
|
13
|
+
"Float",
|
|
14
|
+
"Boolean",
|
|
15
|
+
"Date",
|
|
16
|
+
"Time",
|
|
17
|
+
"void",
|
|
18
|
+
];
|
|
205
19
|
//# sourceMappingURL=keywords.js.map
|
package/out/keywords.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../src/keywords.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../src/keywords.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC"}
|
package/out/log.d.ts
ADDED
package/out/log.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debugLog = debugLog;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const LOG_FILE = path.join(os.tmpdir(), "umple-lsp.log");
|
|
8
|
+
/**
|
|
9
|
+
* Write a debug message to a dedicated log file.
|
|
10
|
+
*
|
|
11
|
+
* Usage: debugLog("token:", word, "kinds:", kinds);
|
|
12
|
+
* View: tail -f /tmp/umple-lsp.log
|
|
13
|
+
*/
|
|
14
|
+
function debugLog(...args) {
|
|
15
|
+
console.error("okokokokok", LOG_FILE);
|
|
16
|
+
const timestamp = new Date().toISOString().slice(11, 23);
|
|
17
|
+
const message = args
|
|
18
|
+
.map((a) => (typeof a === "object" ? JSON.stringify(a) : String(a)))
|
|
19
|
+
.join(" ");
|
|
20
|
+
fs.appendFileSync(LOG_FILE, `[${timestamp}] ${message}\n`);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=log.js.map
|
package/out/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;AAYA,4BAOC;AAnBD,yBAAyB;AACzB,6BAA6B;AAC7B,yBAAyB;AAEzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAG,IAAe;IACzC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SACnE,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC;AAC7D,CAAC"}
|