show unresolved cross-sheet references as a visible #ref? marker

This commit is contained in:
Horizontal42 2026-07-02 05:41:17 +03:00
parent 9d8f977c46
commit 90c19e343f
2 changed files with 12 additions and 4 deletions

View file

@ -21,6 +21,7 @@
--border: #e4e4e0;
--sel: #cfe3f7;
--caret: #d57d2c;
--error: #c1443a;
--toolbar-bg: #fafaf8;
--hover: #ececea;
}
@ -41,6 +42,7 @@
--border: #333438;
--sel: #2d4a68;
--caret: #e8923c;
--error: #e2685c;
--toolbar-bg: #232428;
--hover: #2f3035;
}
@ -332,6 +334,10 @@ body {
text-overflow: ellipsis;
}
.result-line:hover { text-decoration: underline; }
.result-line.result-error {
color: var(--error);
font-style: italic;
}
.result-sparkline {
position: absolute;
right: 14px;

View file

@ -324,7 +324,8 @@ export class SumEditor {
for (let i = 0; i < Math.min(this.results.length, doc.lines); i++) {
const r = this.results[i];
const isChart = r.value?.kind === "chart";
if (!r.text && !isChart) continue;
const isError = !!r.error;
if (!r.text && !isChart && !isError) continue;
const line = doc.line(i + 1);
const block = this.view.lineBlockAt(line.from);
const top = docTop + block.top - overlayTop;
@ -333,9 +334,10 @@ export class SumEditor {
frag.appendChild(buildSparkline(r.value.points.map((p) => p.toNumber()), top));
} else {
const el = document.createElement("div");
el.className = "result-line";
el.textContent = r.text;
el.dataset.value = r.text!;
el.className = "result-line" + (isError ? " result-error" : "");
el.textContent = isError ? "#ref?" : r.text;
if (!isError) el.dataset.value = r.text!;
if (isError) el.title = r.error!;
el.style.top = `${top}px`;
frag.appendChild(el);
}