@rohal12/spindle-lsp 0.15.44 → 0.15.45
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 +25 -9
- 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.45";
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -32868,6 +32868,10 @@ function encodePassageName(name) {
|
|
|
32868
32868
|
const parsed = parseTwee(`:: ${encoded}`);
|
|
32869
32869
|
return parsed.passages.length === 1 && parsed.passages[0].name === name && !parsed.diagnostics.some((d) => d.level === "error") ? encoded : void 0;
|
|
32870
32870
|
}
|
|
32871
|
+
function trimmedEnd(text3, end = text3.length) {
|
|
32872
|
+
while (end > 0 && new RegExp("\\p{White_Space}", "u").test(text3[end - 1])) end--;
|
|
32873
|
+
return end;
|
|
32874
|
+
}
|
|
32871
32875
|
function parsePassageHeader(rawLine, lineNumber) {
|
|
32872
32876
|
const line = withoutCr(rawLine);
|
|
32873
32877
|
const bomLength = /^\uFEFF*/.exec(line)[0].length;
|
|
@@ -32879,8 +32883,9 @@ function parsePassageHeader(rawLine, lineNumber) {
|
|
|
32879
32883
|
delimiter.lastIndex = nameStart;
|
|
32880
32884
|
const first = delimiter.exec(escaped);
|
|
32881
32885
|
const boundary = first?.index ?? line.length;
|
|
32882
|
-
const nameEnd = escaped
|
|
32883
|
-
const
|
|
32886
|
+
const nameEnd = trimmedEnd(escaped, boundary);
|
|
32887
|
+
const decodedName = line.slice(nameStart, nameEnd).replace(/\\(.|$)/g, "$1").replace(new RegExp("^\\p{White_Space}+", "u"), "");
|
|
32888
|
+
const name = decodedName.slice(0, trimmedEnd(decodedName));
|
|
32884
32889
|
if (!name) return null;
|
|
32885
32890
|
let rest = boundary;
|
|
32886
32891
|
let tags = [];
|
|
@@ -32894,7 +32899,7 @@ function parsePassageHeader(rawLine, lineNumber) {
|
|
|
32894
32899
|
}
|
|
32895
32900
|
let meta3;
|
|
32896
32901
|
if (rest < line.length) {
|
|
32897
|
-
const raw = line.slice(rest
|
|
32902
|
+
const raw = line.slice(rest, trimmedEnd(line));
|
|
32898
32903
|
if (escaped[rest] !== "{" || !raw.endsWith("}")) return null;
|
|
32899
32904
|
try {
|
|
32900
32905
|
meta3 = JSON.parse(raw);
|
|
@@ -90041,12 +90046,23 @@ function addMacroToYamlConfig(text3, macroName) {
|
|
|
90041
90046
|
if (doc.errors.length > 0) return null;
|
|
90042
90047
|
if (doc.contents !== null && !(0, import_yaml3.isMap)(doc.contents)) return null;
|
|
90043
90048
|
const path2 = macrosPath(doc.toJS());
|
|
90044
|
-
|
|
90045
|
-
|
|
90046
|
-
|
|
90047
|
-
|
|
90048
|
-
|
|
90049
|
+
for (let depth = 1; depth <= path2.length; depth++) {
|
|
90050
|
+
const prefix = path2.slice(0, depth);
|
|
90051
|
+
const node2 = doc.getIn(prefix, true);
|
|
90052
|
+
if ((0, import_yaml3.isAlias)(node2)) {
|
|
90053
|
+
let value = node2.toJS(doc);
|
|
90054
|
+
if (depth < path2.length && (0, import_yaml3.isMap)(node2.resolve(doc))) {
|
|
90055
|
+
const key = path2[depth];
|
|
90056
|
+
const child = value[key];
|
|
90057
|
+
if (child !== null && typeof child === "object" && !Array.isArray(child)) {
|
|
90058
|
+
value = { ...value, [key]: { ...child } };
|
|
90059
|
+
}
|
|
90060
|
+
}
|
|
90061
|
+
doc.setIn(prefix, doc.createNode(value));
|
|
90062
|
+
}
|
|
90049
90063
|
}
|
|
90064
|
+
const parent = path2.length > 1 ? doc.getIn(path2.slice(0, -1), true) : doc.contents;
|
|
90065
|
+
const macros = doc.getIn(path2, true);
|
|
90050
90066
|
if ((0, import_yaml3.isMap)(macros) && definesMacro(macros.toJS(doc), macroName)) return null;
|
|
90051
90067
|
if ((0, import_yaml3.isMap)(parent) && (0, import_yaml3.isMap)(macros) && !macros.flow && macros.items.length > 0 && macros.range) {
|
|
90052
90068
|
const macrosKey = parent.items.find((p) => (0, import_yaml3.isScalar)(p.key) && p.key.value === "macros")?.key;
|