@rohal12/spindle-lsp 0.9.1 → 0.9.2
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/bin.js +96 -103
- package/dist/bin.js.map +3 -3
- package/package.json +5 -2
package/dist/bin.js
CHANGED
|
@@ -3185,10 +3185,10 @@ var init_esm4 = __esm({
|
|
|
3185
3185
|
* Return a void Promise that resolves once the stream ends.
|
|
3186
3186
|
*/
|
|
3187
3187
|
async promise() {
|
|
3188
|
-
return new Promise((
|
|
3188
|
+
return new Promise((resolve4, reject) => {
|
|
3189
3189
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
3190
3190
|
this.on("error", (er) => reject(er));
|
|
3191
|
-
this.on("end", () =>
|
|
3191
|
+
this.on("end", () => resolve4());
|
|
3192
3192
|
});
|
|
3193
3193
|
}
|
|
3194
3194
|
/**
|
|
@@ -3212,7 +3212,7 @@ var init_esm4 = __esm({
|
|
|
3212
3212
|
return Promise.resolve({ done: false, value: res });
|
|
3213
3213
|
if (this[EOF])
|
|
3214
3214
|
return stop();
|
|
3215
|
-
let
|
|
3215
|
+
let resolve4;
|
|
3216
3216
|
let reject;
|
|
3217
3217
|
const onerr = (er) => {
|
|
3218
3218
|
this.off("data", ondata);
|
|
@@ -3226,19 +3226,19 @@ var init_esm4 = __esm({
|
|
|
3226
3226
|
this.off("end", onend);
|
|
3227
3227
|
this.off(DESTROYED, ondestroy);
|
|
3228
3228
|
this.pause();
|
|
3229
|
-
|
|
3229
|
+
resolve4({ value, done: !!this[EOF] });
|
|
3230
3230
|
};
|
|
3231
3231
|
const onend = () => {
|
|
3232
3232
|
this.off("error", onerr);
|
|
3233
3233
|
this.off("data", ondata);
|
|
3234
3234
|
this.off(DESTROYED, ondestroy);
|
|
3235
3235
|
stop();
|
|
3236
|
-
|
|
3236
|
+
resolve4({ done: true, value: void 0 });
|
|
3237
3237
|
};
|
|
3238
3238
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
3239
3239
|
return new Promise((res2, rej) => {
|
|
3240
3240
|
reject = rej;
|
|
3241
|
-
|
|
3241
|
+
resolve4 = res2;
|
|
3242
3242
|
this.once(DESTROYED, ondestroy);
|
|
3243
3243
|
this.once("error", onerr);
|
|
3244
3244
|
this.once("end", onend);
|
|
@@ -4226,9 +4226,9 @@ var init_esm5 = __esm({
|
|
|
4226
4226
|
if (this.#asyncReaddirInFlight) {
|
|
4227
4227
|
await this.#asyncReaddirInFlight;
|
|
4228
4228
|
} else {
|
|
4229
|
-
let
|
|
4229
|
+
let resolve4 = () => {
|
|
4230
4230
|
};
|
|
4231
|
-
this.#asyncReaddirInFlight = new Promise((res) =>
|
|
4231
|
+
this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
|
|
4232
4232
|
try {
|
|
4233
4233
|
for (const e of await this.#fs.promises.readdir(fullpath, {
|
|
4234
4234
|
withFileTypes: true
|
|
@@ -4241,7 +4241,7 @@ var init_esm5 = __esm({
|
|
|
4241
4241
|
children.provisional = 0;
|
|
4242
4242
|
}
|
|
4243
4243
|
this.#asyncReaddirInFlight = void 0;
|
|
4244
|
-
|
|
4244
|
+
resolve4();
|
|
4245
4245
|
}
|
|
4246
4246
|
return children.slice(0, children.provisional);
|
|
4247
4247
|
}
|
|
@@ -6439,9 +6439,19 @@ var init_passage_index = __esm({
|
|
|
6439
6439
|
|
|
6440
6440
|
// src/core/workspace/macro-registry.ts
|
|
6441
6441
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
6442
|
-
import {
|
|
6443
|
-
import { dirname, join, parse as parsePath } from "node:path";
|
|
6442
|
+
import { dirname, join, resolve } from "node:path";
|
|
6444
6443
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
6444
|
+
function findRegistryPath(startDir) {
|
|
6445
|
+
const target = join("node_modules", "@rohal12", "spindle", "dist", "pkg", "macro-registry.json");
|
|
6446
|
+
let dir = resolve(startDir);
|
|
6447
|
+
for (; ; ) {
|
|
6448
|
+
const candidate = join(dir, target);
|
|
6449
|
+
if (existsSync(candidate)) return candidate;
|
|
6450
|
+
const parent = dirname(dir);
|
|
6451
|
+
if (parent === dir) return null;
|
|
6452
|
+
dir = parent;
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6445
6455
|
var MacroRegistry;
|
|
6446
6456
|
var init_macro_registry = __esm({
|
|
6447
6457
|
"src/core/workspace/macro-registry.ts"() {
|
|
@@ -6454,18 +6464,30 @@ var init_macro_registry = __esm({
|
|
|
6454
6464
|
discovered = /* @__PURE__ */ new Map();
|
|
6455
6465
|
/** Tier 4: user config entries, kept so they can be re-applied over discovered macros. */
|
|
6456
6466
|
configEntries = /* @__PURE__ */ new Map();
|
|
6467
|
+
/** Warnings collected during loadBuiltins for logging. */
|
|
6468
|
+
warnings = [];
|
|
6469
|
+
/** Path of the macro-registry.json the builtins were loaded from, if any. */
|
|
6470
|
+
builtinsPath = null;
|
|
6457
6471
|
/**
|
|
6458
6472
|
* Load built-in macro metadata from @rohal12/spindle's macro-registry.json.
|
|
6459
6473
|
* This is the base layer that provides name, block, subMacros, flags, source.
|
|
6474
|
+
*
|
|
6475
|
+
* The project's own Spindle is authoritative: the registry is resolved from
|
|
6476
|
+
* `workspaceRoot` first, and from this package's install location (a
|
|
6477
|
+
* development copy, or one installed for the peer dependency) only when the
|
|
6478
|
+
* workspace has none.
|
|
6460
6479
|
*/
|
|
6461
|
-
|
|
6462
|
-
warnings = [];
|
|
6463
|
-
loadBuiltins() {
|
|
6480
|
+
loadBuiltins(workspaceRoot) {
|
|
6464
6481
|
let builtinMacros = [];
|
|
6465
6482
|
try {
|
|
6466
6483
|
const thisDir = dirname(fileURLToPath3(import.meta.url));
|
|
6467
|
-
const registryPath =
|
|
6468
|
-
if (registryPath) {
|
|
6484
|
+
const registryPath = (workspaceRoot ? findRegistryPath(workspaceRoot) : null) ?? findRegistryPath(thisDir);
|
|
6485
|
+
if (!registryPath) {
|
|
6486
|
+
this.warnings.push(
|
|
6487
|
+
"macro-registry.json not found: install @rohal12/spindle in the project. Continuing with supplements only."
|
|
6488
|
+
);
|
|
6489
|
+
} else {
|
|
6490
|
+
this.builtinsPath = registryPath;
|
|
6469
6491
|
const raw = readFileSync2(registryPath, "utf-8");
|
|
6470
6492
|
const parsed = JSON.parse(raw);
|
|
6471
6493
|
if (!Array.isArray(parsed)) {
|
|
@@ -6641,37 +6663,6 @@ var init_macro_registry = __esm({
|
|
|
6641
6663
|
}
|
|
6642
6664
|
return info;
|
|
6643
6665
|
}
|
|
6644
|
-
/**
|
|
6645
|
-
* Walk up directory tree from `startDir` to find the
|
|
6646
|
-
* @rohal12/spindle/dist/pkg/macro-registry.json file.
|
|
6647
|
-
*/
|
|
6648
|
-
/**
|
|
6649
|
-
* Resolve macro-registry.json using Node's require resolution.
|
|
6650
|
-
* Works in bundled contexts where import.meta.url may not be near node_modules.
|
|
6651
|
-
*/
|
|
6652
|
-
resolveRegistryPathViaRequire(startDir) {
|
|
6653
|
-
try {
|
|
6654
|
-
const require2 = createRequire(join(startDir, "_"));
|
|
6655
|
-
const toolingPath = require2.resolve("@rohal12/spindle/tooling");
|
|
6656
|
-
const candidate = join(dirname(toolingPath), "macro-registry.json");
|
|
6657
|
-
if (existsSync(candidate)) return candidate;
|
|
6658
|
-
} catch {
|
|
6659
|
-
}
|
|
6660
|
-
return null;
|
|
6661
|
-
}
|
|
6662
|
-
resolveRegistryPath(startDir) {
|
|
6663
|
-
const target = join("node_modules", "@rohal12", "spindle", "dist", "pkg", "macro-registry.json");
|
|
6664
|
-
let dir = startDir;
|
|
6665
|
-
const { root } = parsePath(dir);
|
|
6666
|
-
while (dir !== root) {
|
|
6667
|
-
const candidate = join(dir, target);
|
|
6668
|
-
if (existsSync(candidate)) {
|
|
6669
|
-
return candidate;
|
|
6670
|
-
}
|
|
6671
|
-
dir = dirname(dir);
|
|
6672
|
-
}
|
|
6673
|
-
return null;
|
|
6674
|
-
}
|
|
6675
6666
|
/** Merge a set of supplement/config entries into the registry. */
|
|
6676
6667
|
mergeEntries(entries) {
|
|
6677
6668
|
for (const [rawKey, entry] of Object.entries(entries)) {
|
|
@@ -7746,7 +7737,7 @@ var init_workspace_model = __esm({
|
|
|
7746
7737
|
this.macros = new MacroRegistry();
|
|
7747
7738
|
this.variables = new VariableTracker();
|
|
7748
7739
|
this.widgets = new WidgetRegistry();
|
|
7749
|
-
this.macros.loadBuiltins();
|
|
7740
|
+
this.macros.loadBuiltins(config2?.workspaceRoot);
|
|
7750
7741
|
this.macros.loadSupplements(macro_supplements_default);
|
|
7751
7742
|
this.onDocumentChanged = (uri) => this.handleDocumentChange(uri);
|
|
7752
7743
|
this.onDocumentOpened = (uri) => this.handleDocumentChange(uri);
|
|
@@ -8951,11 +8942,11 @@ function parseMacroPassageRefs(text, lineOffset = 0) {
|
|
|
8951
8942
|
const refs = [];
|
|
8952
8943
|
for (const macro of parseMacros(text)) {
|
|
8953
8944
|
if (!macro.open || !macro.rawArgs) continue;
|
|
8954
|
-
const
|
|
8955
|
-
if (!
|
|
8945
|
+
const resolve4 = macroTargetResolvers[macro.name.toLowerCase()];
|
|
8946
|
+
if (!resolve4) continue;
|
|
8956
8947
|
const argsEnd = lineStarts[macro.range.end.line] + macro.range.end.character - 1;
|
|
8957
8948
|
const argsStart = argsEnd - macro.rawArgs.length;
|
|
8958
|
-
const target =
|
|
8949
|
+
const target = resolve4(text.slice(argsStart, argsEnd));
|
|
8959
8950
|
if (!target || target.name === "") continue;
|
|
8960
8951
|
const startPos = offsetToPosition(argsStart + target.start, lineStarts);
|
|
8961
8952
|
const endPos = offsetToPosition(argsStart + target.end, lineStarts);
|
|
@@ -17203,7 +17194,7 @@ __export(check_exports, {
|
|
|
17203
17194
|
runCheck: () => runCheck
|
|
17204
17195
|
});
|
|
17205
17196
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
17206
|
-
import { resolve } from "node:path";
|
|
17197
|
+
import { resolve as resolve2 } from "node:path";
|
|
17207
17198
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
17208
17199
|
function parseArgs(args2) {
|
|
17209
17200
|
const options = {
|
|
@@ -17279,7 +17270,7 @@ async function runCheck(args2) {
|
|
|
17279
17270
|
let explicitConfig = null;
|
|
17280
17271
|
if (options.configPath) {
|
|
17281
17272
|
try {
|
|
17282
|
-
explicitConfig = loadConfigFile(
|
|
17273
|
+
explicitConfig = loadConfigFile(resolve2(cwd, options.configPath));
|
|
17283
17274
|
} catch (err) {
|
|
17284
17275
|
console.error(`spindle-lsp check: ${err instanceof Error ? err.message : String(err)}`);
|
|
17285
17276
|
return 2;
|
|
@@ -17305,28 +17296,28 @@ async function runCheck(args2) {
|
|
|
17305
17296
|
}
|
|
17306
17297
|
return 0;
|
|
17307
17298
|
}
|
|
17299
|
+
const commonDir = uniqueFiles.map((f) => resolve2(f, "..")).reduce((a, b) => {
|
|
17300
|
+
while (!b.startsWith(a)) a = resolve2(a, "..");
|
|
17301
|
+
return a;
|
|
17302
|
+
});
|
|
17308
17303
|
let projectConfig;
|
|
17309
17304
|
if (explicitConfig) {
|
|
17310
17305
|
projectConfig = explicitConfig;
|
|
17311
17306
|
} else {
|
|
17312
|
-
|
|
17313
|
-
let configRoot = dirs.reduce((a, b) => {
|
|
17314
|
-
while (!b.startsWith(a)) a = resolve(a, "..");
|
|
17315
|
-
return a;
|
|
17316
|
-
});
|
|
17307
|
+
let configRoot = commonDir;
|
|
17317
17308
|
let search = configRoot;
|
|
17318
17309
|
for (let i = 0; i < 10; i++) {
|
|
17319
17310
|
if (findConfigFile(search)) {
|
|
17320
17311
|
configRoot = search;
|
|
17321
17312
|
break;
|
|
17322
17313
|
}
|
|
17323
|
-
const parent =
|
|
17314
|
+
const parent = resolve2(search, "..");
|
|
17324
17315
|
if (parent === search) break;
|
|
17325
17316
|
search = parent;
|
|
17326
17317
|
}
|
|
17327
17318
|
projectConfig = loadConfigFromDisk(configRoot);
|
|
17328
17319
|
}
|
|
17329
|
-
const workspace = new WorkspaceModel();
|
|
17320
|
+
const workspace = new WorkspaceModel({ workspaceRoot: commonDir });
|
|
17330
17321
|
const fileContents = /* @__PURE__ */ new Map();
|
|
17331
17322
|
for (const filePath of uniqueFiles) {
|
|
17332
17323
|
try {
|
|
@@ -40352,7 +40343,7 @@ var init_protocol = __esm({
|
|
|
40352
40343
|
return;
|
|
40353
40344
|
}
|
|
40354
40345
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
40355
|
-
await new Promise((
|
|
40346
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
40356
40347
|
options?.signal?.throwIfAborted();
|
|
40357
40348
|
}
|
|
40358
40349
|
} catch (error48) {
|
|
@@ -40369,7 +40360,7 @@ var init_protocol = __esm({
|
|
|
40369
40360
|
*/
|
|
40370
40361
|
request(request, resultSchema, options) {
|
|
40371
40362
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
40372
|
-
return new Promise((
|
|
40363
|
+
return new Promise((resolve4, reject) => {
|
|
40373
40364
|
const earlyReject = (error48) => {
|
|
40374
40365
|
reject(error48);
|
|
40375
40366
|
};
|
|
@@ -40447,7 +40438,7 @@ var init_protocol = __esm({
|
|
|
40447
40438
|
if (!parseResult.success) {
|
|
40448
40439
|
reject(parseResult.error);
|
|
40449
40440
|
} else {
|
|
40450
|
-
|
|
40441
|
+
resolve4(parseResult.data);
|
|
40451
40442
|
}
|
|
40452
40443
|
} catch (error48) {
|
|
40453
40444
|
reject(error48);
|
|
@@ -40708,12 +40699,12 @@ var init_protocol = __esm({
|
|
|
40708
40699
|
}
|
|
40709
40700
|
} catch {
|
|
40710
40701
|
}
|
|
40711
|
-
return new Promise((
|
|
40702
|
+
return new Promise((resolve4, reject) => {
|
|
40712
40703
|
if (signal.aborted) {
|
|
40713
40704
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
40714
40705
|
return;
|
|
40715
40706
|
}
|
|
40716
|
-
const timeoutId = setTimeout(
|
|
40707
|
+
const timeoutId = setTimeout(resolve4, interval);
|
|
40717
40708
|
signal.addEventListener("abort", () => {
|
|
40718
40709
|
clearTimeout(timeoutId);
|
|
40719
40710
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -43740,7 +43731,7 @@ var require_compile = __commonJS({
|
|
|
43740
43731
|
const schOrFunc = root.refs[ref];
|
|
43741
43732
|
if (schOrFunc)
|
|
43742
43733
|
return schOrFunc;
|
|
43743
|
-
let _sch =
|
|
43734
|
+
let _sch = resolve4.call(this, root, ref);
|
|
43744
43735
|
if (_sch === void 0) {
|
|
43745
43736
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
43746
43737
|
const { schemaId } = this.opts;
|
|
@@ -43767,7 +43758,7 @@ var require_compile = __commonJS({
|
|
|
43767
43758
|
function sameSchemaEnv(s1, s2) {
|
|
43768
43759
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
43769
43760
|
}
|
|
43770
|
-
function
|
|
43761
|
+
function resolve4(root, ref) {
|
|
43771
43762
|
let sch;
|
|
43772
43763
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
43773
43764
|
ref = sch;
|
|
@@ -44342,7 +44333,7 @@ var require_fast_uri = __commonJS({
|
|
|
44342
44333
|
}
|
|
44343
44334
|
return uri;
|
|
44344
44335
|
}
|
|
44345
|
-
function
|
|
44336
|
+
function resolve4(baseURI, relativeURI, options) {
|
|
44346
44337
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
44347
44338
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
44348
44339
|
schemelessOptions.skipEscape = true;
|
|
@@ -44569,7 +44560,7 @@ var require_fast_uri = __commonJS({
|
|
|
44569
44560
|
var fastUri = {
|
|
44570
44561
|
SCHEMES,
|
|
44571
44562
|
normalize: normalize2,
|
|
44572
|
-
resolve:
|
|
44563
|
+
resolve: resolve4,
|
|
44573
44564
|
resolveComponent,
|
|
44574
44565
|
equal,
|
|
44575
44566
|
serialize,
|
|
@@ -48693,7 +48684,7 @@ var init_mcp = __esm({
|
|
|
48693
48684
|
let task = createTaskResult.task;
|
|
48694
48685
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
48695
48686
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
48696
|
-
await new Promise((
|
|
48687
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
48697
48688
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
48698
48689
|
if (!updatedTask) {
|
|
48699
48690
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -49284,12 +49275,12 @@ var init_stdio2 = __esm({
|
|
|
49284
49275
|
this.onclose?.();
|
|
49285
49276
|
}
|
|
49286
49277
|
send(message) {
|
|
49287
|
-
return new Promise((
|
|
49278
|
+
return new Promise((resolve4) => {
|
|
49288
49279
|
const json2 = serializeMessage(message);
|
|
49289
49280
|
if (this._stdout.write(json2)) {
|
|
49290
|
-
|
|
49281
|
+
resolve4();
|
|
49291
49282
|
} else {
|
|
49292
|
-
this._stdout.once("drain",
|
|
49283
|
+
this._stdout.once("drain", resolve4);
|
|
49293
49284
|
}
|
|
49294
49285
|
});
|
|
49295
49286
|
}
|
|
@@ -49303,7 +49294,7 @@ __export(server_exports, {
|
|
|
49303
49294
|
startMcpServer: () => startMcpServer
|
|
49304
49295
|
});
|
|
49305
49296
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "node:fs";
|
|
49306
|
-
import { resolve as
|
|
49297
|
+
import { resolve as resolve3 } from "node:path";
|
|
49307
49298
|
import { pathToFileURL as pathToFileURL3, fileURLToPath as fileURLToPath5 } from "node:url";
|
|
49308
49299
|
function filterBySeverity2(diagnostics, minSeverity) {
|
|
49309
49300
|
const minIdx = SEVERITY_ORDER2.indexOf(minSeverity);
|
|
@@ -49321,9 +49312,9 @@ async function resolveFiles(pattern, cwd) {
|
|
|
49321
49312
|
return [...new Set(matches)];
|
|
49322
49313
|
}
|
|
49323
49314
|
function findConfigRoot(files) {
|
|
49324
|
-
const dirs = files.map((f) =>
|
|
49315
|
+
const dirs = files.map((f) => resolve3(f, ".."));
|
|
49325
49316
|
let configRoot = dirs.reduce((a, b) => {
|
|
49326
|
-
while (!b.startsWith(a)) a =
|
|
49317
|
+
while (!b.startsWith(a)) a = resolve3(a, "..");
|
|
49327
49318
|
return a;
|
|
49328
49319
|
});
|
|
49329
49320
|
let search = configRoot;
|
|
@@ -49332,7 +49323,7 @@ function findConfigRoot(files) {
|
|
|
49332
49323
|
configRoot = search;
|
|
49333
49324
|
break;
|
|
49334
49325
|
}
|
|
49335
|
-
const parent =
|
|
49326
|
+
const parent = resolve3(search, "..");
|
|
49336
49327
|
if (parent === search) break;
|
|
49337
49328
|
search = parent;
|
|
49338
49329
|
}
|
|
@@ -49341,7 +49332,7 @@ function findConfigRoot(files) {
|
|
|
49341
49332
|
function createWorkspace(files) {
|
|
49342
49333
|
const configRoot = findConfigRoot(files);
|
|
49343
49334
|
const projectConfig = loadConfigFromDisk(configRoot);
|
|
49344
|
-
const workspace = new WorkspaceModel();
|
|
49335
|
+
const workspace = new WorkspaceModel({ workspaceRoot: configRoot });
|
|
49345
49336
|
const fileContents = /* @__PURE__ */ new Map();
|
|
49346
49337
|
for (const filePath of files) {
|
|
49347
49338
|
try {
|
|
@@ -50534,8 +50525,8 @@ var require_semaphore = __commonJS({
|
|
|
50534
50525
|
this._waiting = [];
|
|
50535
50526
|
}
|
|
50536
50527
|
lock(thunk) {
|
|
50537
|
-
return new Promise((
|
|
50538
|
-
this._waiting.push({ thunk, resolve:
|
|
50528
|
+
return new Promise((resolve4, reject) => {
|
|
50529
|
+
this._waiting.push({ thunk, resolve: resolve4, reject });
|
|
50539
50530
|
this.runNext();
|
|
50540
50531
|
});
|
|
50541
50532
|
}
|
|
@@ -52025,9 +52016,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
52025
52016
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
52026
52017
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
52027
52018
|
}
|
|
52028
|
-
return new Promise(async (
|
|
52019
|
+
return new Promise(async (resolve4, reject) => {
|
|
52029
52020
|
const resolveWithCleanup = (r) => {
|
|
52030
|
-
|
|
52021
|
+
resolve4(r);
|
|
52031
52022
|
cancellationStrategy.sender.cleanup(id);
|
|
52032
52023
|
disposable?.dispose();
|
|
52033
52024
|
};
|
|
@@ -52438,10 +52429,10 @@ var require_ril = __commonJS({
|
|
|
52438
52429
|
return api_1.Disposable.create(() => this.stream.off("end", listener));
|
|
52439
52430
|
}
|
|
52440
52431
|
write(data, encoding) {
|
|
52441
|
-
return new Promise((
|
|
52432
|
+
return new Promise((resolve4, reject) => {
|
|
52442
52433
|
const callback = (error48) => {
|
|
52443
52434
|
if (error48 === void 0 || error48 === null) {
|
|
52444
|
-
|
|
52435
|
+
resolve4();
|
|
52445
52436
|
} else {
|
|
52446
52437
|
reject(error48);
|
|
52447
52438
|
}
|
|
@@ -52693,10 +52684,10 @@ var require_main = __commonJS({
|
|
|
52693
52684
|
exports.generateRandomPipeName = generateRandomPipeName;
|
|
52694
52685
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
52695
52686
|
let connectResolve;
|
|
52696
|
-
const connected = new Promise((
|
|
52697
|
-
connectResolve =
|
|
52687
|
+
const connected = new Promise((resolve4, _reject) => {
|
|
52688
|
+
connectResolve = resolve4;
|
|
52698
52689
|
});
|
|
52699
|
-
return new Promise((
|
|
52690
|
+
return new Promise((resolve4, reject) => {
|
|
52700
52691
|
let server = (0, net_1.createServer)((socket) => {
|
|
52701
52692
|
server.close();
|
|
52702
52693
|
connectResolve([
|
|
@@ -52707,7 +52698,7 @@ var require_main = __commonJS({
|
|
|
52707
52698
|
server.on("error", reject);
|
|
52708
52699
|
server.listen(pipeName, () => {
|
|
52709
52700
|
server.removeListener("error", reject);
|
|
52710
|
-
|
|
52701
|
+
resolve4({
|
|
52711
52702
|
onConnected: () => {
|
|
52712
52703
|
return connected;
|
|
52713
52704
|
}
|
|
@@ -52726,10 +52717,10 @@ var require_main = __commonJS({
|
|
|
52726
52717
|
exports.createServerPipeTransport = createServerPipeTransport;
|
|
52727
52718
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
52728
52719
|
let connectResolve;
|
|
52729
|
-
const connected = new Promise((
|
|
52730
|
-
connectResolve =
|
|
52720
|
+
const connected = new Promise((resolve4, _reject) => {
|
|
52721
|
+
connectResolve = resolve4;
|
|
52731
52722
|
});
|
|
52732
|
-
return new Promise((
|
|
52723
|
+
return new Promise((resolve4, reject) => {
|
|
52733
52724
|
const server = (0, net_1.createServer)((socket) => {
|
|
52734
52725
|
server.close();
|
|
52735
52726
|
connectResolve([
|
|
@@ -52740,7 +52731,7 @@ var require_main = __commonJS({
|
|
|
52740
52731
|
server.on("error", reject);
|
|
52741
52732
|
server.listen(port, "127.0.0.1", () => {
|
|
52742
52733
|
server.removeListener("error", reject);
|
|
52743
|
-
|
|
52734
|
+
resolve4({
|
|
52744
52735
|
onConnected: () => {
|
|
52745
52736
|
return connected;
|
|
52746
52737
|
}
|
|
@@ -57526,8 +57517,8 @@ var require_server = __commonJS({
|
|
|
57526
57517
|
if (value instanceof Promise) {
|
|
57527
57518
|
return value;
|
|
57528
57519
|
} else if (Is.thenable(value)) {
|
|
57529
|
-
return new Promise((
|
|
57530
|
-
value.then((resolved) =>
|
|
57520
|
+
return new Promise((resolve4, reject) => {
|
|
57521
|
+
value.then((resolved) => resolve4(resolved), (error48) => reject(error48));
|
|
57531
57522
|
});
|
|
57532
57523
|
} else {
|
|
57533
57524
|
return Promise.resolve(value);
|
|
@@ -57797,7 +57788,7 @@ var require_files = __commonJS({
|
|
|
57797
57788
|
function isWindows() {
|
|
57798
57789
|
return process.platform === "win32";
|
|
57799
57790
|
}
|
|
57800
|
-
function
|
|
57791
|
+
function resolve4(moduleName, nodePath, cwd, tracer) {
|
|
57801
57792
|
const nodePathKey = "NODE_PATH";
|
|
57802
57793
|
const app = [
|
|
57803
57794
|
"var p = process;",
|
|
@@ -57816,7 +57807,7 @@ var require_files = __commonJS({
|
|
|
57816
57807
|
"}",
|
|
57817
57808
|
"});"
|
|
57818
57809
|
].join("");
|
|
57819
|
-
return new Promise((
|
|
57810
|
+
return new Promise((resolve5, reject) => {
|
|
57820
57811
|
let env = process.env;
|
|
57821
57812
|
let newEnv = /* @__PURE__ */ Object.create(null);
|
|
57822
57813
|
Object.keys(env).forEach((key) => newEnv[key] = env[key]);
|
|
@@ -57848,7 +57839,7 @@ var require_files = __commonJS({
|
|
|
57848
57839
|
if (message2.c === "r") {
|
|
57849
57840
|
cp.send({ c: "e" });
|
|
57850
57841
|
if (message2.s) {
|
|
57851
|
-
|
|
57842
|
+
resolve5(message2.r);
|
|
57852
57843
|
} else {
|
|
57853
57844
|
reject(new Error(`Failed to resolve module: ${moduleName}`));
|
|
57854
57845
|
}
|
|
@@ -57864,7 +57855,7 @@ var require_files = __commonJS({
|
|
|
57864
57855
|
}
|
|
57865
57856
|
});
|
|
57866
57857
|
}
|
|
57867
|
-
exports.resolve =
|
|
57858
|
+
exports.resolve = resolve4;
|
|
57868
57859
|
function resolveGlobalNodePath(tracer) {
|
|
57869
57860
|
let npmCommand = "npm";
|
|
57870
57861
|
const env = /* @__PURE__ */ Object.create(null);
|
|
@@ -57979,17 +57970,17 @@ var require_files = __commonJS({
|
|
|
57979
57970
|
if (!path2.isAbsolute(nodePath)) {
|
|
57980
57971
|
nodePath = path2.join(workspaceRoot, nodePath);
|
|
57981
57972
|
}
|
|
57982
|
-
return
|
|
57973
|
+
return resolve4(moduleName, nodePath, nodePath, tracer).then((value) => {
|
|
57983
57974
|
if (FileSystem.isParent(nodePath, value)) {
|
|
57984
57975
|
return value;
|
|
57985
57976
|
} else {
|
|
57986
57977
|
return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));
|
|
57987
57978
|
}
|
|
57988
57979
|
}).then(void 0, (_error) => {
|
|
57989
|
-
return
|
|
57980
|
+
return resolve4(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
|
57990
57981
|
});
|
|
57991
57982
|
} else {
|
|
57992
|
-
return
|
|
57983
|
+
return resolve4(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
|
57993
57984
|
}
|
|
57994
57985
|
}
|
|
57995
57986
|
exports.resolveModulePath = resolveModulePath;
|
|
@@ -60716,8 +60707,10 @@ function startServer(_args) {
|
|
|
60716
60707
|
diagnostics: initOptions.diagnostics,
|
|
60717
60708
|
workspaceRoot
|
|
60718
60709
|
};
|
|
60719
|
-
workspace = new WorkspaceModel();
|
|
60710
|
+
workspace = new WorkspaceModel(workspaceRoot ? { workspaceRoot } : void 0);
|
|
60720
60711
|
console.error("[spindle-lsp] workspaceRoot:", workspaceRoot ?? "undefined");
|
|
60712
|
+
console.error("[spindle-lsp] builtin macros:", workspace.macros.builtinsPath ?? "not found");
|
|
60713
|
+
for (const warning of workspace.macros.warnings) console.error("[spindle-lsp]", warning);
|
|
60721
60714
|
activePlugins = loadPlugins(allPlugins, config2);
|
|
60722
60715
|
console.error("[spindle-lsp] plugins loaded:", activePlugins.map((p) => p.id).join(", "));
|
|
60723
60716
|
for (const plugin of activePlugins) {
|
|
@@ -60883,7 +60876,7 @@ var init_server4 = __esm({
|
|
|
60883
60876
|
|
|
60884
60877
|
// src/bin.ts
|
|
60885
60878
|
var args = process.argv.slice(2);
|
|
60886
|
-
var VERSION = "0.9.
|
|
60879
|
+
var VERSION = "0.9.2";
|
|
60887
60880
|
var HELP = `spindle-lsp v${VERSION}
|
|
60888
60881
|
Language Server Protocol server for Spindle story format
|
|
60889
60882
|
|