@rohal12/spindle-lsp 0.15.43 → 0.15.44

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 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.43";
58
+ VERSION = false ? pkg.version : "0.15.44";
59
59
  }
60
60
  });
61
61
 
@@ -3546,7 +3546,7 @@ var require_identity = __commonJS({
3546
3546
  var SCALAR = /* @__PURE__ */ Symbol.for("yaml.scalar");
3547
3547
  var SEQ = /* @__PURE__ */ Symbol.for("yaml.seq");
3548
3548
  var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
3549
- var isAlias = (node2) => !!node2 && typeof node2 === "object" && node2[NODE_TYPE] === ALIAS;
3549
+ var isAlias2 = (node2) => !!node2 && typeof node2 === "object" && node2[NODE_TYPE] === ALIAS;
3550
3550
  var isDocument = (node2) => !!node2 && typeof node2 === "object" && node2[NODE_TYPE] === DOC;
3551
3551
  var isMap2 = (node2) => !!node2 && typeof node2 === "object" && node2[NODE_TYPE] === MAP;
3552
3552
  var isPair = (node2) => !!node2 && typeof node2 === "object" && node2[NODE_TYPE] === PAIR;
@@ -3581,7 +3581,7 @@ var require_identity = __commonJS({
3581
3581
  exports.SCALAR = SCALAR;
3582
3582
  exports.SEQ = SEQ;
3583
3583
  exports.hasAnchor = hasAnchor;
3584
- exports.isAlias = isAlias;
3584
+ exports.isAlias = isAlias2;
3585
3585
  exports.isCollection = isCollection;
3586
3586
  exports.isDocument = isDocument;
3587
3587
  exports.isMap = isMap2;
@@ -36348,12 +36348,13 @@ function childDiagnostics(passage, node2, token, workspace) {
36348
36348
  if (!constraints || constraints.length === 0 || !node2.body?.close) return [];
36349
36349
  const direct = [...node2.body.children];
36350
36350
  for (const branch of node2.body.branches) direct.push({ token: branch.tag, start: branch.tag.start, end: branch.tag.end }, ...branch.children);
36351
+ const branchTags = new Set(node2.body.branches.map((branch) => branch.tag));
36351
36352
  const consumesOptions = macro?.source === "builtin" && ["listbox", "cycle"].includes(token.name.toLowerCase());
36352
36353
  const counts = /* @__PURE__ */ Object.create(null);
36353
36354
  for (const child of direct) {
36354
36355
  if (child.token.type !== "macro" || child.token.isClose) continue;
36355
36356
  const key = child.token.name.toLowerCase();
36356
- if (consumesOptions && key === "option" || workspace.getEffectiveMacro(key)) counts[key] = (counts[key] ?? 0) + 1;
36357
+ if (branchTags.has(child.token) || consumesOptions && key === "option" || workspace.getEffectiveMacro(key)) counts[key] = (counts[key] ?? 0) + 1;
36357
36358
  }
36358
36359
  const diagnostics = [];
36359
36360
  const range2 = passage.range(token.start, token.end);
@@ -90041,7 +90042,11 @@ function addMacroToYamlConfig(text3, macroName) {
90041
90042
  if (doc.contents !== null && !(0, import_yaml3.isMap)(doc.contents)) return null;
90042
90043
  const path2 = macrosPath(doc.toJS());
90043
90044
  const parent = path2.length > 1 ? doc.getIn(path2.slice(0, -1), true) : doc.contents;
90044
- const macros = doc.getIn(path2, true);
90045
+ let macros = doc.getIn(path2, true);
90046
+ if ((0, import_yaml3.isAlias)(macros)) {
90047
+ macros = doc.createNode(macros.toJS(doc));
90048
+ doc.setIn(path2, macros);
90049
+ }
90045
90050
  if ((0, import_yaml3.isMap)(macros) && definesMacro(macros.toJS(doc), macroName)) return null;
90046
90051
  if ((0, import_yaml3.isMap)(parent) && (0, import_yaml3.isMap)(macros) && !macros.flow && macros.items.length > 0 && macros.range) {
90047
90052
  const macrosKey = parent.items.find((p) => (0, import_yaml3.isScalar)(p.key) && p.key.value === "macros")?.key;