@rohal12/spindle-lsp 0.15.45 → 0.15.46

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.45";
58
+ VERSION = false ? pkg.version : "0.15.46";
59
59
  }
60
60
  });
61
61
 
@@ -33091,7 +33091,7 @@ var init_passage_index = __esm({
33091
33091
  getAllPassages() {
33092
33092
  const result2 = [];
33093
33093
  for (const uri of this.uris()) {
33094
- result2.push(...this.byUri.get(uri));
33094
+ for (const passage of this.byUri.get(uri)) result2.push(passage);
33095
33095
  }
33096
33096
  return result2;
33097
33097
  }
@@ -36184,16 +36184,21 @@ function declarationsOf(workspace, name) {
36184
36184
  return new Map(markup.declarations.declarations.map((declaration) => [declaration.name, declaration.schema]));
36185
36185
  }
36186
36186
  function markupDiagnostics(passage, story, workspace) {
36187
- return (story.markup.get(passage) ?? []).map((found) => fromMarkup(passage, found, workspace));
36187
+ const found = story.markup.get(passage) ?? [];
36188
+ const tokens2 = /* @__PURE__ */ new Map();
36189
+ if (found.some((diagnostic) => diagnostic.code === "unknown-macro")) {
36190
+ for (const token of macroTokens(passage)) tokens2.set(token.start, token);
36191
+ }
36192
+ return found.map((diagnostic) => fromMarkup(passage, diagnostic, workspace, tokens2));
36188
36193
  }
36189
- function fromMarkup(passage, found, workspace) {
36194
+ function fromMarkup(passage, found, workspace, tokens2) {
36190
36195
  const range2 = passage.range(...visibleSpan(passage.content, found.start, found.end));
36191
36196
  const name = text2(found.data?.name);
36192
36197
  let code = MARKUP_CODES[found.code];
36193
36198
  let data2;
36194
36199
  switch (found.code) {
36195
36200
  case "unknown-macro": {
36196
- const token = [...macroTokens(passage)].find((candidate) => candidate.start === found.start);
36201
+ const token = tokens2.get(found.start);
36197
36202
  data2 = {
36198
36203
  kind: "unknown-macro",
36199
36204
  name,
@@ -90572,9 +90577,10 @@ function computeDocumentLinks(uri, workspace) {
90572
90577
  const doc = workspace.markup.get(uri);
90573
90578
  if (!doc) return [];
90574
90579
  const links = [];
90580
+ const targets = new Map(workspace.passages.getEffectivePassages().map((passage) => [passage.name, passage]));
90575
90581
  for (const ref2 of documentPassageRefs(doc)) {
90576
90582
  if (ref2.form !== "bracket") continue;
90577
- const targetPassage = workspace.passages.getEffectivePassage(ref2.name);
90583
+ const targetPassage = targets.get(ref2.name);
90578
90584
  links.push({
90579
90585
  range: ref2.range,
90580
90586
  target: targetPassage ? `${targetPassage.uri}#L${targetPassage.range.start.line + 1}` : void 0