@rohal12/spindle-lsp 0.15.3 → 0.15.4
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 +66 -76
- package/dist/bin.js.map +3 -3
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -55,7 +55,7 @@ var VERSION;
|
|
|
55
55
|
var init_version = __esm({
|
|
56
56
|
"src/version.ts"() {
|
|
57
57
|
"use strict";
|
|
58
|
-
VERSION = false ? pkg.version : "0.15.
|
|
58
|
+
VERSION = false ? pkg.version : "0.15.4";
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -31694,7 +31694,7 @@ var init_variable_tracker = __esm({
|
|
|
31694
31694
|
const member = u.fullName.split(".")[1];
|
|
31695
31695
|
if (member === void 0) continue;
|
|
31696
31696
|
if (declared.get(u.baseName)?.type !== "array") continue;
|
|
31697
|
-
if (ARRAY_MEMBERS.has(member)) continue;
|
|
31697
|
+
if (ARRAY_MEMBERS.has(member) || /^(0|[1-9]\d*)$/.test(member) && Number(member) < 4294967295) continue;
|
|
31698
31698
|
results.push({ sigil, name: u.baseName, member, range: u.range });
|
|
31699
31699
|
}
|
|
31700
31700
|
}
|
|
@@ -33043,17 +33043,10 @@ function lexFormat(formatString) {
|
|
|
33043
33043
|
throw new Error(`Lex: Invalid character after '|': '${next}'`);
|
|
33044
33044
|
}
|
|
33045
33045
|
} else if (quoteRe.test(ch)) {
|
|
33046
|
-
const
|
|
33047
|
-
|
|
33048
|
-
pos
|
|
33049
|
-
|
|
33050
|
-
if (++iter > LEX_LIMIT) throw new Error("Format lex string iteration limit exceeded");
|
|
33051
|
-
pos++;
|
|
33052
|
-
}
|
|
33053
|
-
if (pos >= formatString.length) throw new Error("Lex: Unterminated string literal");
|
|
33054
|
-
const value = formatString.slice(start + 1, pos);
|
|
33055
|
-
pos++;
|
|
33056
|
-
lexed.push({ kind: 1 /* Literal */, value });
|
|
33046
|
+
const quoted = readQuoted(formatString, pos);
|
|
33047
|
+
if (!quoted) throw new Error("Lex: Unterminated string literal");
|
|
33048
|
+
pos = quoted.end;
|
|
33049
|
+
lexed.push({ kind: 1 /* Literal */, value: quoted.value });
|
|
33057
33050
|
} else if (ch === "(" || ch === ")") {
|
|
33058
33051
|
pos++;
|
|
33059
33052
|
lexed.push({ kind: 2 /* Group */, open: ch === "(" });
|
|
@@ -33201,114 +33194,111 @@ function isFail(s) {
|
|
|
33201
33194
|
return s === 1 /* Failure */ || s === 0 /* NotFound */;
|
|
33202
33195
|
}
|
|
33203
33196
|
function crawlValidate(format, args2, startIndex, state) {
|
|
33204
|
-
|
|
33197
|
+
const memo2 = /* @__PURE__ */ new Map();
|
|
33198
|
+
function append(left, right) {
|
|
33199
|
+
return { ...right, rank: left.rank + right.rank, warnings: left.warnings.concat(right.warnings) };
|
|
33200
|
+
}
|
|
33201
|
+
function follow(left, right) {
|
|
33202
|
+
return left.flatMap((matched) => isFail(matched.status) ? [matched] : crawl(right, matched.argIndex).map((result2) => append(matched, result2)));
|
|
33203
|
+
}
|
|
33205
33204
|
function crawl(fmt, argIdx) {
|
|
33206
|
-
|
|
33205
|
+
let positions = memo2.get(fmt);
|
|
33206
|
+
if (!positions) memo2.set(fmt, positions = /* @__PURE__ */ new Map());
|
|
33207
|
+
const cached2 = positions.get(argIdx);
|
|
33208
|
+
if (cached2) return cached2;
|
|
33209
|
+
if (positions.size >= VALIDATE_LIMIT) {
|
|
33207
33210
|
throw new Error(`Validation iteration limit exceeded at argument ${argIdx}`);
|
|
33208
33211
|
}
|
|
33212
|
+
const unique = /* @__PURE__ */ new Map();
|
|
33213
|
+
for (const result2 of match2(fmt, argIdx)) {
|
|
33214
|
+
const key = isFail(result2.status) ? "failure" : result2.argIndex;
|
|
33215
|
+
const previous2 = unique.get(key);
|
|
33216
|
+
if (!previous2 || key === "failure" && result2.rank > previous2.rank) unique.set(key, result2);
|
|
33217
|
+
}
|
|
33218
|
+
const results2 = [...unique.values()];
|
|
33219
|
+
positions.set(argIdx, results2);
|
|
33220
|
+
return results2;
|
|
33221
|
+
}
|
|
33222
|
+
function match2(fmt, argIdx) {
|
|
33209
33223
|
switch (fmt.kind) {
|
|
33210
33224
|
case 4 /* MaybeNext */: {
|
|
33211
|
-
|
|
33212
|
-
|
|
33213
|
-
let idx = argIdx;
|
|
33214
|
-
if (fmt.left) {
|
|
33215
|
-
const left = crawl(fmt.left, idx);
|
|
33216
|
-
if (isFail(left.status)) return left;
|
|
33217
|
-
rank += left.rank;
|
|
33218
|
-
idx = left.argIndex;
|
|
33219
|
-
warnings = left.warnings;
|
|
33220
|
-
}
|
|
33221
|
-
const right = crawl(fmt.right, idx);
|
|
33222
|
-
if (right.status === 0 /* NotFound */) {
|
|
33223
|
-
return makeSuccess(idx, rank, warnings);
|
|
33224
|
-
}
|
|
33225
|
-
if (isFail(right.status)) {
|
|
33226
|
-
right.status = 1 /* Failure */;
|
|
33227
|
-
return right;
|
|
33228
|
-
}
|
|
33229
|
-
return makeSuccess(right.argIndex, rank + right.rank, warnings.concat(right.warnings));
|
|
33225
|
+
const left = fmt.left ? crawl(fmt.left, argIdx) : [makeSuccess(argIdx, 0)];
|
|
33226
|
+
return [...follow(left, fmt.right), ...left];
|
|
33230
33227
|
}
|
|
33231
33228
|
case 3 /* AndNext */: {
|
|
33232
|
-
|
|
33233
|
-
if (isFail(left.status)) return left;
|
|
33234
|
-
const right = crawl(fmt.right, left.argIndex);
|
|
33235
|
-
if (isFail(right.status)) return right;
|
|
33236
|
-
return makeSuccess(
|
|
33237
|
-
right.argIndex,
|
|
33238
|
-
left.rank + right.rank,
|
|
33239
|
-
left.warnings.concat(right.warnings)
|
|
33240
|
-
);
|
|
33229
|
+
return follow(crawl(fmt.left, argIdx), fmt.right);
|
|
33241
33230
|
}
|
|
33242
33231
|
case 5 /* Or */: {
|
|
33243
|
-
|
|
33244
|
-
if (!isFail(left.status)) return left;
|
|
33245
|
-
const right = crawl(fmt.right, argIdx);
|
|
33246
|
-
if (!isFail(right.status)) return right;
|
|
33247
|
-
return left;
|
|
33232
|
+
return [...crawl(fmt.left, argIdx), ...crawl(fmt.right, argIdx)];
|
|
33248
33233
|
}
|
|
33249
33234
|
case 6 /* Repeat */: {
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33253
|
-
|
|
33254
|
-
const
|
|
33255
|
-
if (
|
|
33256
|
-
|
|
33257
|
-
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
|
|
33235
|
+
const matches = [];
|
|
33236
|
+
const pending = [makeSuccess(argIdx, 0)];
|
|
33237
|
+
const reached = /* @__PURE__ */ new Set();
|
|
33238
|
+
while (pending.length > 0) {
|
|
33239
|
+
const matched = pending.pop();
|
|
33240
|
+
if (reached.has(matched.argIndex)) continue;
|
|
33241
|
+
reached.add(matched.argIndex);
|
|
33242
|
+
matches.push(matched);
|
|
33243
|
+
const items = crawl(fmt.right, matched.argIndex);
|
|
33244
|
+
for (let i2 = items.length - 1; i2 >= 0; i2--) {
|
|
33245
|
+
const item = items[i2];
|
|
33246
|
+
if (!isFail(item.status) && !reached.has(item.argIndex)) pending.push(append(matched, item));
|
|
33247
|
+
}
|
|
33248
|
+
}
|
|
33249
|
+
return matches.sort((left, right) => right.argIndex - left.argIndex);
|
|
33261
33250
|
}
|
|
33262
33251
|
case 1 /* Literal */: {
|
|
33263
33252
|
const arg = args2[argIdx];
|
|
33264
33253
|
if (arg === void 0) {
|
|
33265
|
-
return makeError(0 /* NotFound */, `Expected literal '${fmt.value}' but no argument found`, argIdx);
|
|
33254
|
+
return [makeError(0 /* NotFound */, `Expected literal '${fmt.value}' but no argument found`, argIdx)];
|
|
33266
33255
|
}
|
|
33267
33256
|
if (isAlwaysArg(arg)) {
|
|
33268
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK);
|
|
33257
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK)];
|
|
33269
33258
|
}
|
|
33270
|
-
const argText = arg.type === 0 /* String */ ? arg.text
|
|
33259
|
+
const argText = arg.type === 0 /* String */ ? readQuoted(arg.text, 0)?.value : arg.text;
|
|
33271
33260
|
if (argText === fmt.value) {
|
|
33272
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK);
|
|
33261
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK)];
|
|
33273
33262
|
}
|
|
33274
33263
|
if (fmt.value === "null" && arg.type === 3 /* Null */ || fmt.value === "undefined" && arg.type === 10 /* Undefined */ || fmt.value === "true" && arg.type === 2 /* Boolean */ && arg.text === "true" || fmt.value === "false" && arg.type === 2 /* Boolean */ && arg.text === "false" || fmt.value === "NaN" && arg.type === 9 /* NaN */) {
|
|
33275
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK);
|
|
33264
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK)];
|
|
33276
33265
|
}
|
|
33277
|
-
return makeError(1 /* Failure */, `Expected literal '${fmt.value}'`, argIdx, CORRECT_TYPE_RANK);
|
|
33266
|
+
return [makeError(1 /* Failure */, `Expected literal '${fmt.value}'`, argIdx, CORRECT_TYPE_RANK)];
|
|
33278
33267
|
}
|
|
33279
33268
|
case 0 /* Type */: {
|
|
33280
33269
|
const arg = args2[argIdx];
|
|
33281
33270
|
const typeDef = fmt.type;
|
|
33282
33271
|
if (arg === void 0) {
|
|
33283
|
-
return makeError(
|
|
33272
|
+
return [makeError(
|
|
33284
33273
|
0 /* NotFound */,
|
|
33285
33274
|
`Expected type '${typeDef.name[0]}' but no argument found`,
|
|
33286
33275
|
argIdx
|
|
33287
|
-
);
|
|
33276
|
+
)];
|
|
33288
33277
|
}
|
|
33289
33278
|
if (isAlwaysArg(arg)) {
|
|
33290
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK);
|
|
33279
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK)];
|
|
33291
33280
|
}
|
|
33292
33281
|
const result2 = typeDef.validate(arg, args2, argIdx, state);
|
|
33293
33282
|
if (result2 instanceof TypeError2) {
|
|
33294
|
-
return {
|
|
33283
|
+
return [{
|
|
33295
33284
|
status: 1 /* Failure */,
|
|
33296
33285
|
rank: 0,
|
|
33297
33286
|
argIndex: argIdx,
|
|
33298
33287
|
errors: [{ message: result2.message, argIndex: argIdx }],
|
|
33299
33288
|
warnings: []
|
|
33300
|
-
};
|
|
33289
|
+
}];
|
|
33301
33290
|
}
|
|
33302
33291
|
if (result2 instanceof TypeWarning) {
|
|
33303
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK, [
|
|
33292
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK, [
|
|
33304
33293
|
{ message: result2.message, argIndex: argIdx }
|
|
33305
|
-
]);
|
|
33294
|
+
])];
|
|
33306
33295
|
}
|
|
33307
|
-
return makeSuccess(argIdx + 1, CORRECT_RANK);
|
|
33296
|
+
return [makeSuccess(argIdx + 1, CORRECT_RANK)];
|
|
33308
33297
|
}
|
|
33309
33298
|
}
|
|
33310
33299
|
}
|
|
33311
|
-
|
|
33300
|
+
const results = crawl(format, startIndex);
|
|
33301
|
+
return results.find((result2) => !isFail(result2.status) && result2.argIndex === args2.length) ?? results.reduce((best, result2) => result2.rank > best.rank ? result2 : best);
|
|
33312
33302
|
}
|
|
33313
33303
|
var TypeError2, TypeWarning, parameterTypes, LEX_LIMIT, wsRe, identStartRe, identStopRe, quoteRe, digitRe, PARSE_LIMIT, DESCRIBE_ALTERNATIVE_LIMIT, VALIDATE_LIMIT, CORRECT_TYPE_RANK, CORRECT_RANK, Parameters;
|
|
33314
33304
|
var init_parameter_validator = __esm({
|
|
@@ -33820,7 +33810,7 @@ function computeDiagnostics(uri, workspace, options) {
|
|
|
33820
33810
|
}
|
|
33821
33811
|
function storyReport(workspace) {
|
|
33822
33812
|
const documents = [];
|
|
33823
|
-
for (const uri of workspace.
|
|
33813
|
+
for (const uri of workspace.passages.getDocumentUris()) {
|
|
33824
33814
|
if (isMacroSource(uri)) continue;
|
|
33825
33815
|
const doc = workspace.markup.get(uri);
|
|
33826
33816
|
if (doc) documents.push(doc);
|
|
@@ -81366,7 +81356,7 @@ function startServer(args2) {
|
|
|
81366
81356
|
connection.onInitialize((params) => {
|
|
81367
81357
|
console.error("[spindle-lsp] onInitialize called");
|
|
81368
81358
|
const initOptions = params.initializationOptions ?? {};
|
|
81369
|
-
workspaceRoot = initOptions.workspaceRoot ?? (params.workspaceFolders?.[0]?.uri ? uriToFsPath(params.workspaceFolders[0].uri) : void 0) ?? (params.rootUri ? uriToFsPath(params.rootUri) : void 0);
|
|
81359
|
+
workspaceRoot = (initOptions.workspaceRoot !== void 0 ? uriToFsPath(initOptions.workspaceRoot) : void 0) ?? (params.workspaceFolders?.[0]?.uri ? uriToFsPath(params.workspaceFolders[0].uri) : void 0) ?? (params.rootUri ? uriToFsPath(params.rootUri) : void 0);
|
|
81370
81360
|
let projectConfig = { macros: {} };
|
|
81371
81361
|
try {
|
|
81372
81362
|
if (workspaceRoot) projectConfig = loadConfigFromDisk(workspaceRoot);
|