@mirascript/monaco 0.1.9 → 0.1.11
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/dist/basic/index.d.ts.map +1 -1
- package/dist/basic/index.js +1 -1
- package/dist/basic/language-configuration.d.ts.map +1 -1
- package/dist/basic/tokens-provider.d.ts.map +1 -1
- package/dist/{chunk-OTLGDSYY.js → chunk-LWDQEIU4.js} +114 -81
- package/dist/chunk-LWDQEIU4.js.map +6 -0
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/contribute.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/lsp/index.d.ts.map +1 -1
- package/dist/lsp/index.js +130 -103
- package/dist/lsp/index.js.map +2 -2
- package/dist/lsp/providers/base.d.ts +11 -2
- package/dist/lsp/providers/base.d.ts.map +1 -1
- package/dist/lsp/providers/completion-item-provider.d.ts.map +1 -1
- package/dist/lsp/providers/definition-reference-provider.d.ts.map +1 -1
- package/dist/lsp/providers/hover-provider.d.ts.map +1 -1
- package/dist/lsp/utils.d.ts +4 -4
- package/dist/lsp/utils.d.ts.map +1 -1
- package/dist/lsp/worker-helper.d.ts.map +1 -1
- package/dist/lsp/worker.d.ts +2 -2
- package/dist/lsp/worker.d.ts.map +1 -1
- package/dist/lsp/worker.js +3 -2
- package/dist/lsp/worker.js.map +1 -1
- package/package.json +3 -4
- package/src/basic/index.ts +2 -2
- package/src/basic/language-configuration.ts +2 -1
- package/src/basic/tokens-provider.ts +100 -64
- package/src/constants.ts +8 -9
- package/src/contribute.ts +7 -0
- package/src/lsp/index.ts +2 -2
- package/src/lsp/providers/base.ts +23 -3
- package/src/lsp/providers/color-provider.ts +1 -1
- package/src/lsp/providers/completion-item-provider.ts +7 -5
- package/src/lsp/providers/definition-reference-provider.ts +58 -52
- package/src/lsp/providers/document-symbol-provider.ts +1 -1
- package/src/lsp/providers/hover-provider.ts +8 -20
- package/src/lsp/providers/inlay-hints-provider.ts +1 -1
- package/src/lsp/providers/rename-provider.ts +1 -1
- package/src/lsp/providers/semantic-tokens-provider.ts +4 -4
- package/src/lsp/providers/signature-help-provider.ts +1 -1
- package/src/lsp/utils.ts +40 -18
- package/src/lsp/worker-helper.ts +6 -2
- package/src/lsp/worker.ts +6 -3
- package/dist/chunk-OTLGDSYY.js.map +0 -6
package/dist/lsp/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DOC_HEADER,
|
|
3
2
|
REG_IDENTIFIER,
|
|
4
3
|
REG_ORDINAL,
|
|
5
4
|
keywords,
|
|
6
5
|
reservedKeywords
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-LWDQEIU4.js";
|
|
8
7
|
import {
|
|
9
8
|
Emitter,
|
|
10
9
|
MarkerSeverity,
|
|
@@ -20,7 +19,7 @@ import {
|
|
|
20
19
|
import { DefaultVmContext } from "@mirascript/mirascript/subtle";
|
|
21
20
|
|
|
22
21
|
// src/lsp/utils.ts
|
|
23
|
-
import { DiagnosticCode } from "@mirascript/wasm";
|
|
22
|
+
import { DiagnosticCode } from "@mirascript/bindings/wasm";
|
|
24
23
|
import {
|
|
25
24
|
getVmFunctionInfo,
|
|
26
25
|
isVmArray,
|
|
@@ -110,22 +109,23 @@ function globalFnDoc(info) {
|
|
|
110
109
|
paramDoc.push(`- **返回值**: ${info.returns}`);
|
|
111
110
|
}
|
|
112
111
|
if (paramDoc.length) {
|
|
113
|
-
doc.push(paramDoc.join("\n"));
|
|
112
|
+
doc.push("", paramDoc.join("\n"));
|
|
114
113
|
}
|
|
115
114
|
if (info.examples?.length) {
|
|
116
115
|
let exp = `### 示例`;
|
|
117
116
|
for (const example of info.examples) {
|
|
118
117
|
exp += codeblock(example);
|
|
119
118
|
}
|
|
120
|
-
doc.push(exp);
|
|
119
|
+
doc.push("", exp);
|
|
121
120
|
}
|
|
122
121
|
return doc;
|
|
123
122
|
}
|
|
124
123
|
function codeblock(value) {
|
|
124
|
+
const lang = value.startsWith("\0") ? "mirascript-doc" : "mirascript";
|
|
125
125
|
const includeFences = /`{3,}/.exec(value);
|
|
126
126
|
const CODEBLOCK_FENCE = includeFences ? "`".repeat(includeFences[0].length + 1) : "```";
|
|
127
127
|
return `
|
|
128
|
-
${CODEBLOCK_FENCE}
|
|
128
|
+
${CODEBLOCK_FENCE}${lang}
|
|
129
129
|
${value}
|
|
130
130
|
${CODEBLOCK_FENCE}
|
|
131
131
|
`;
|
|
@@ -160,6 +160,9 @@ function serializeForDisplayInner(value, maxWidth) {
|
|
|
160
160
|
if (!len) return "()";
|
|
161
161
|
return `(../* x${len} */)`;
|
|
162
162
|
}
|
|
163
|
+
if (isVmExtern(value)) {
|
|
164
|
+
return `/* <extern ${value.describe}> */`;
|
|
165
|
+
}
|
|
163
166
|
return `/* ${operations.$ToString(value)} */`;
|
|
164
167
|
}
|
|
165
168
|
function serializeForDisplay(value, maxEntries = 100, maxWidth = 40) {
|
|
@@ -197,10 +200,20 @@ function serializeForDisplay(value, maxEntries = 100, maxWidth = 40) {
|
|
|
197
200
|
}
|
|
198
201
|
} else {
|
|
199
202
|
const hint = serializeForDisplayInner(value, 100);
|
|
200
|
-
const isArray =
|
|
203
|
+
const isArray = Array.isArray(value.value);
|
|
201
204
|
begin = `${hint} ${isArray ? "[" : "("}`;
|
|
202
205
|
end = isArray ? "]" : ")";
|
|
203
206
|
const keys = value.keys();
|
|
207
|
+
if (keys.length === 0 && !isArray) {
|
|
208
|
+
if (typeof value.value == "object") {
|
|
209
|
+
for (const key of Object.getOwnPropertyNames(value.value)) {
|
|
210
|
+
if (value.has(key)) keys.push(key);
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
begin = hint;
|
|
214
|
+
end = "";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
204
217
|
for (const [index, key] of keys.entries()) {
|
|
205
218
|
if (entries.length > maxEntries) {
|
|
206
219
|
entries.push(`../* x${keys.length - entries.length} */`);
|
|
@@ -224,6 +237,13 @@ ${end}`;
|
|
|
224
237
|
}
|
|
225
238
|
return `${begin}${entries.join(", ")}${end}`;
|
|
226
239
|
}
|
|
240
|
+
function docComment(doc) {
|
|
241
|
+
const lines = doc.flatMap((sec) => sec.split("\n").map((s) => s.trimEnd()));
|
|
242
|
+
const firstLine = lines.findIndex((line) => line.length > 0);
|
|
243
|
+
const lastLine = lines.findLastIndex((line) => line.length > 0);
|
|
244
|
+
if (firstLine < 0 || lastLine < 0) return [];
|
|
245
|
+
return [`/**`, ...lines.slice(firstLine, lastLine + 1).map((line) => ` * ${line}`), ` */`];
|
|
246
|
+
}
|
|
227
247
|
function valueDoc(name, value, type) {
|
|
228
248
|
const info = getVmFunctionInfo(value);
|
|
229
249
|
if (info) {
|
|
@@ -257,14 +277,7 @@ function valueDoc(name, value, type) {
|
|
|
257
277
|
for (const k of exports) {
|
|
258
278
|
const v = value.get(k);
|
|
259
279
|
const vDoc = valueDoc(k, v, isVmModule(v) ? "field" : "declare");
|
|
260
|
-
const code = [
|
|
261
|
-
`/**`,
|
|
262
|
-
...vDoc.doc.flatMap((sec) => sec.split("\n")).map((line) => ` * ${line}`),
|
|
263
|
-
` */`,
|
|
264
|
-
"export " + vDoc.script,
|
|
265
|
-
"",
|
|
266
|
-
""
|
|
267
|
-
];
|
|
280
|
+
const code = [...docComment(vDoc.doc), "export " + vDoc.script, "", ""];
|
|
268
281
|
script += code.join("\n");
|
|
269
282
|
}
|
|
270
283
|
script = script.trimEnd();
|
|
@@ -287,10 +300,11 @@ function valueDoc(name, value, type) {
|
|
|
287
300
|
function getDeep(value, path) {
|
|
288
301
|
let current = value;
|
|
289
302
|
for (const key of path) {
|
|
290
|
-
if (current == null) return
|
|
303
|
+
if (current == null) return current;
|
|
304
|
+
if (!operations.$Has(current, key)) return void 0;
|
|
291
305
|
current = operations.$Get(current, key);
|
|
292
306
|
}
|
|
293
|
-
return current
|
|
307
|
+
return current;
|
|
294
308
|
}
|
|
295
309
|
|
|
296
310
|
// src/lsp/compile-result.ts
|
|
@@ -789,10 +803,14 @@ async function compileWorker(req) {
|
|
|
789
803
|
});
|
|
790
804
|
return new CompileResult(key, version, source, result);
|
|
791
805
|
}
|
|
806
|
+
var compileImpl;
|
|
792
807
|
async function compileSync(req) {
|
|
793
808
|
const [key, version, script, mode] = req;
|
|
794
|
-
|
|
795
|
-
|
|
809
|
+
if (compileImpl == null) {
|
|
810
|
+
const mod = await import("./worker.js");
|
|
811
|
+
compileImpl = mod.compile;
|
|
812
|
+
}
|
|
813
|
+
const result = compileImpl(script, mode);
|
|
796
814
|
return new CompileResult(key, version, script, result);
|
|
797
815
|
}
|
|
798
816
|
var USE_WORKER = typeof Worker === "function";
|
|
@@ -849,6 +867,22 @@ var Provider = class {
|
|
|
849
867
|
async getContext(model) {
|
|
850
868
|
return await contextProvider?.(model) ?? DefaultVmContext;
|
|
851
869
|
}
|
|
870
|
+
/** 获取当前位置的值 */
|
|
871
|
+
async getValueAt(model, position) {
|
|
872
|
+
const compiled = await this.getCompileResult(model);
|
|
873
|
+
if (!compiled) return void 0;
|
|
874
|
+
const d = compiled.variableAccessAt(model, position);
|
|
875
|
+
if (d) return { range: d.range, variable: d };
|
|
876
|
+
const word = wordAt(model, position);
|
|
877
|
+
if (word) {
|
|
878
|
+
const a = compiled.fieldAccessAt(model, {
|
|
879
|
+
lineNumber: position.lineNumber,
|
|
880
|
+
column: word.range.endColumn
|
|
881
|
+
});
|
|
882
|
+
if (a) return { range: word.range, fields: a };
|
|
883
|
+
}
|
|
884
|
+
return void 0;
|
|
885
|
+
}
|
|
852
886
|
/** @inheritdoc */
|
|
853
887
|
get onDidChange() {
|
|
854
888
|
this._onDidChange ??= new Emitter();
|
|
@@ -876,7 +910,7 @@ var CodeActionProvider = class extends Provider {
|
|
|
876
910
|
};
|
|
877
911
|
|
|
878
912
|
// src/lsp/providers/color-provider.ts
|
|
879
|
-
import { DiagnosticCode as DiagnosticCode4 } from "@mirascript/wasm";
|
|
913
|
+
import { DiagnosticCode as DiagnosticCode4 } from "@mirascript/bindings/wasm";
|
|
880
914
|
var REG_COLOR_STR = /^(@*)(['"`])(#(?:[0-9a-f]{6}|[0-9a-f]{3}|[0-9a-f]{8}|[0-9a-f]{4}))\2\1$/iu;
|
|
881
915
|
function parseColorString(text) {
|
|
882
916
|
const colorMatch = REG_COLOR_STR.exec(text);
|
|
@@ -1124,7 +1158,9 @@ function kwSuggestion(kw, range) {
|
|
|
1124
1158
|
}
|
|
1125
1159
|
function filterText(key, char) {
|
|
1126
1160
|
if (char == null || key.startsWith(char)) return key;
|
|
1127
|
-
|
|
1161
|
+
if (key.startsWith("@")) return key.replace(/^@+/, "");
|
|
1162
|
+
if (key.startsWith("$")) return key.replace(/^\$+/, "");
|
|
1163
|
+
return key;
|
|
1128
1164
|
}
|
|
1129
1165
|
function completion(model, description, key, value, fn, field) {
|
|
1130
1166
|
let detail = "";
|
|
@@ -1222,11 +1258,9 @@ var CompletionItemProvider = class extends Provider {
|
|
|
1222
1258
|
const locals = /* @__PURE__ */ new Set();
|
|
1223
1259
|
while (scope) {
|
|
1224
1260
|
for (const { definition, fn } of scope.locals) {
|
|
1225
|
-
const name = model.getValueInRange(definition.range);
|
|
1261
|
+
const name = definition.code === DiagnosticCode5.ParameterIt ? "it" : model.getValueInRange(definition.range);
|
|
1262
|
+
if (char && !name.toLowerCase().includes(char)) continue;
|
|
1226
1263
|
if (locals.has(name)) continue;
|
|
1227
|
-
if (char && !name.toLowerCase().includes(char)) {
|
|
1228
|
-
continue;
|
|
1229
|
-
}
|
|
1230
1264
|
locals.add(name);
|
|
1231
1265
|
suggestions.push({
|
|
1232
1266
|
insertText: name,
|
|
@@ -1378,23 +1412,24 @@ ${vmDescribe ?? ""}`
|
|
|
1378
1412
|
|
|
1379
1413
|
// src/lsp/providers/definition-reference-provider.ts
|
|
1380
1414
|
var DefinitionReferenceProvider = class extends Provider {
|
|
1381
|
-
constructor(globalModel = editor.createModel(
|
|
1415
|
+
constructor(globalModel = editor.createModel(
|
|
1416
|
+
``,
|
|
1417
|
+
"mirascript-doc",
|
|
1418
|
+
Uri.parse("mirascript:///lib/global.mira")
|
|
1419
|
+
)) {
|
|
1382
1420
|
super();
|
|
1383
1421
|
this.globalModel = globalModel;
|
|
1384
1422
|
}
|
|
1385
1423
|
/** 准备要显示的定义 */
|
|
1386
|
-
prepareGlobal(
|
|
1424
|
+
async prepareGlobal(model, path) {
|
|
1387
1425
|
const { globalModel } = this;
|
|
1388
|
-
const
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
script,
|
|
1396
|
-
""
|
|
1397
|
-
];
|
|
1426
|
+
const globals = await this.getContext(model);
|
|
1427
|
+
const [name, ...access] = path;
|
|
1428
|
+
if (!globals.has(name)) return void 0;
|
|
1429
|
+
const value = getDeep(globals.get(name), access);
|
|
1430
|
+
if (value === void 0) return void 0;
|
|
1431
|
+
const { script, doc } = valueDoc(path.at(-1), value, "declare");
|
|
1432
|
+
const code = ["", ...docComment(doc), script, ""];
|
|
1398
1433
|
globalModel.setValue(code.join("\n"));
|
|
1399
1434
|
return {
|
|
1400
1435
|
uri: globalModel.uri,
|
|
@@ -1408,50 +1443,54 @@ var DefinitionReferenceProvider = class extends Provider {
|
|
|
1408
1443
|
}
|
|
1409
1444
|
/** @inheritdoc */
|
|
1410
1445
|
async provideDefinition(model, position, token) {
|
|
1411
|
-
const
|
|
1412
|
-
if (!
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
if ("name" in def) {
|
|
1425
|
-
link = this.prepareGlobal(def.name, globals.get(def.name));
|
|
1446
|
+
const value = await this.getValueAt(model, position);
|
|
1447
|
+
if (!value) return void 0;
|
|
1448
|
+
if ("variable" in value) {
|
|
1449
|
+
const { def } = value.variable;
|
|
1450
|
+
let link;
|
|
1451
|
+
if ("name" in def) {
|
|
1452
|
+
link = await this.prepareGlobal(model, [def.name]);
|
|
1453
|
+
} else {
|
|
1454
|
+
link = { uri: model.uri, range: def.definition.range };
|
|
1455
|
+
}
|
|
1456
|
+
if (!link) return void 0;
|
|
1457
|
+
link.originSelectionRange = value.range;
|
|
1458
|
+
return [link];
|
|
1426
1459
|
} else {
|
|
1427
|
-
|
|
1460
|
+
const {
|
|
1461
|
+
def: { def },
|
|
1462
|
+
fields
|
|
1463
|
+
} = value.fields;
|
|
1464
|
+
if ("name" in def) {
|
|
1465
|
+
const link = await this.prepareGlobal(model, [def.name, ...fields]);
|
|
1466
|
+
if (!link) return void 0;
|
|
1467
|
+
link.originSelectionRange = value.range;
|
|
1468
|
+
return [link];
|
|
1469
|
+
}
|
|
1428
1470
|
}
|
|
1429
|
-
|
|
1430
|
-
return [link];
|
|
1471
|
+
return void 0;
|
|
1431
1472
|
}
|
|
1432
1473
|
/** @inheritdoc */
|
|
1433
1474
|
async provideReferences(model, position, context, token) {
|
|
1434
|
-
const
|
|
1435
|
-
if (!
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
uri: model.uri,
|
|
1450
|
-
range: def.definition.range
|
|
1451
|
-
});
|
|
1475
|
+
const value = await this.getValueAt(model, position);
|
|
1476
|
+
if (!value) return void 0;
|
|
1477
|
+
if ("variable" in value) {
|
|
1478
|
+
const { def } = value.variable;
|
|
1479
|
+
const links = def.references.map((u) => ({
|
|
1480
|
+
uri: model.uri,
|
|
1481
|
+
range: u.range
|
|
1482
|
+
}));
|
|
1483
|
+
if (context.includeDeclaration) {
|
|
1484
|
+
if ("name" in def) {
|
|
1485
|
+
const link = await this.prepareGlobal(model, [def.name]);
|
|
1486
|
+
if (link) links.push(link);
|
|
1487
|
+
} else if (!Range.isEmpty(def.definition.range)) {
|
|
1488
|
+
links.push({ uri: model.uri, range: def.definition.range });
|
|
1489
|
+
}
|
|
1452
1490
|
}
|
|
1491
|
+
return links;
|
|
1453
1492
|
}
|
|
1454
|
-
return
|
|
1493
|
+
return void 0;
|
|
1455
1494
|
}
|
|
1456
1495
|
};
|
|
1457
1496
|
|
|
@@ -1506,7 +1545,7 @@ var DocumentHighlightProvider = class extends Provider {
|
|
|
1506
1545
|
};
|
|
1507
1546
|
|
|
1508
1547
|
// src/lsp/providers/document-symbol-provider.ts
|
|
1509
|
-
import { DiagnosticCode as DiagnosticCode7 } from "@mirascript/wasm";
|
|
1548
|
+
import { DiagnosticCode as DiagnosticCode7 } from "@mirascript/bindings/wasm";
|
|
1510
1549
|
var DocumentSymbolProvider = class extends Provider {
|
|
1511
1550
|
/** 构建树 */
|
|
1512
1551
|
handleScope(model, scope) {
|
|
@@ -1605,7 +1644,7 @@ var FormatterProvider = class extends Provider {
|
|
|
1605
1644
|
};
|
|
1606
1645
|
|
|
1607
1646
|
// src/lsp/providers/hover-provider.ts
|
|
1608
|
-
import { DiagnosticCode as DiagnosticCode8 } from "@mirascript/wasm";
|
|
1647
|
+
import { DiagnosticCode as DiagnosticCode8 } from "@mirascript/bindings/wasm";
|
|
1609
1648
|
var HoverProvider = class extends Provider {
|
|
1610
1649
|
/** 变量提示 */
|
|
1611
1650
|
async provideVariableHover(model, { def, ref }) {
|
|
@@ -1718,30 +1757,18 @@ var HoverProvider = class extends Provider {
|
|
|
1718
1757
|
}
|
|
1719
1758
|
/** @inheritdoc */
|
|
1720
1759
|
async provideHover(model, position, token, context) {
|
|
1721
|
-
const
|
|
1722
|
-
if (!
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
return this.provideVariableHover(model, d);
|
|
1728
|
-
}
|
|
1729
|
-
const word = wordAt(model, position);
|
|
1730
|
-
if (word) {
|
|
1731
|
-
const a = compiled.fieldAccessAt(model, {
|
|
1732
|
-
lineNumber: position.lineNumber,
|
|
1733
|
-
column: word.range.endColumn
|
|
1734
|
-
});
|
|
1735
|
-
if (a) {
|
|
1736
|
-
return this.provideFieldHover(model, word.range, a);
|
|
1737
|
-
}
|
|
1760
|
+
const value = await this.getValueAt(model, position);
|
|
1761
|
+
if (!value) return void 0;
|
|
1762
|
+
if ("fields" in value) {
|
|
1763
|
+
return this.provideFieldHover(model, value.range, value.fields);
|
|
1764
|
+
} else {
|
|
1765
|
+
return this.provideVariableHover(model, value.variable);
|
|
1738
1766
|
}
|
|
1739
|
-
return void 0;
|
|
1740
1767
|
}
|
|
1741
1768
|
};
|
|
1742
1769
|
|
|
1743
1770
|
// src/lsp/providers/inlay-hints-provider.ts
|
|
1744
|
-
import { DiagnosticCode as DiagnosticCode9 } from "@mirascript/wasm";
|
|
1771
|
+
import { DiagnosticCode as DiagnosticCode9 } from "@mirascript/bindings/wasm";
|
|
1745
1772
|
var InlayHintsProvider = class extends Provider {
|
|
1746
1773
|
/** @inheritdoc */
|
|
1747
1774
|
get onDidChangeInlayHints() {
|
|
@@ -1873,7 +1900,7 @@ var RangeProvider = class extends Provider {
|
|
|
1873
1900
|
};
|
|
1874
1901
|
|
|
1875
1902
|
// src/lsp/providers/rename-provider.ts
|
|
1876
|
-
import { DiagnosticCode as DiagnosticCode10 } from "@mirascript/wasm";
|
|
1903
|
+
import { DiagnosticCode as DiagnosticCode10 } from "@mirascript/bindings/wasm";
|
|
1877
1904
|
var RenameProvider = class extends Provider {
|
|
1878
1905
|
/** 重命名推断字段 */
|
|
1879
1906
|
provideRenameEditsOmitNameFields(model, compiled, edits, ref, oldName) {
|
|
@@ -1990,16 +2017,16 @@ var RenameProvider = class extends Provider {
|
|
|
1990
2017
|
|
|
1991
2018
|
// src/lsp/providers/semantic-tokens-provider.ts
|
|
1992
2019
|
import { isVmFunction as isVmFunction2, isVmModule as isVmModule3 } from "@mirascript/mirascript";
|
|
1993
|
-
import { DiagnosticCode as DiagnosticCode11 } from "@mirascript/wasm";
|
|
2020
|
+
import { DiagnosticCode as DiagnosticCode11 } from "@mirascript/bindings/wasm";
|
|
1994
2021
|
var TOKEN_TYPES = {
|
|
1995
2022
|
[0 /* VARIABLE */]: "variable.other.constant",
|
|
1996
2023
|
[1 /* VARIABLE_MUTABLE */]: "variable",
|
|
1997
2024
|
[2 /* CONSTANT */]: "variable.other.constant",
|
|
1998
2025
|
[3 /* GLOBAL */]: "variable",
|
|
1999
2026
|
[4 /* FUNCTION */]: "entity.name.function",
|
|
2000
|
-
[5 /* MODULE */]: "
|
|
2001
|
-
[6 /* PROPERTY */]: "
|
|
2002
|
-
[7 /* KEYWORD_CONTROL */]: "keyword.
|
|
2027
|
+
[5 /* MODULE */]: "type",
|
|
2028
|
+
[6 /* PROPERTY */]: "variable.other.property",
|
|
2029
|
+
[7 /* KEYWORD_CONTROL */]: "keyword.flow",
|
|
2003
2030
|
[8 /* PARAM */]: "variable.other.constant.emphasis",
|
|
2004
2031
|
[9 /* PARAM_MUTABLE */]: "variable.emphasis"
|
|
2005
2032
|
};
|
|
@@ -2130,7 +2157,7 @@ var DocumentSemanticTokensProvider = class extends Provider {
|
|
|
2130
2157
|
};
|
|
2131
2158
|
|
|
2132
2159
|
// src/lsp/providers/signature-help-provider.ts
|
|
2133
|
-
import { DiagnosticCode as DiagnosticCode12 } from "@mirascript/wasm";
|
|
2160
|
+
import { DiagnosticCode as DiagnosticCode12 } from "@mirascript/bindings/wasm";
|
|
2134
2161
|
import { getVmFunctionInfo as getVmFunctionInfo3 } from "@mirascript/mirascript";
|
|
2135
2162
|
var SignatureHelpProvider = class extends Provider {
|
|
2136
2163
|
constructor() {
|
|
@@ -2234,10 +2261,10 @@ var SignatureHelpProvider = class extends Provider {
|
|
|
2234
2261
|
};
|
|
2235
2262
|
|
|
2236
2263
|
// src/lsp/index.ts
|
|
2237
|
-
import { ready } from "@mirascript/wasm";
|
|
2238
2264
|
async function registerLSP(contextProvider2) {
|
|
2239
2265
|
setContextProvider(contextProvider2);
|
|
2240
|
-
await
|
|
2266
|
+
const { loadModule } = await import("@mirascript/bindings/wasm");
|
|
2267
|
+
await loadModule();
|
|
2241
2268
|
const codeActionProvider = new CodeActionProvider();
|
|
2242
2269
|
const colorProvider = new ColorProvider();
|
|
2243
2270
|
const completionItemProvider = new CompletionItemProvider();
|