Merge pull request #240 from fredsa/errorclick

Improve compile error message click behavior
This commit is contained in:
Steven Hugg authored and GitHub committed 2026-03-24 09:20:18 +01:00
commit 1b4593984e
4 files changed
+18 -2

No files matched your search

+3
View File
@@ -159,6 +159,9 @@ div.is-busy-unused {
#error_alert_msg {
margin-right: 2em;
}
#error_alert_msg a {
cursor: pointer;
}
div.menu_div {
position: absolute;
width: 200px;
+1 -1
View File
@@ -870,7 +870,7 @@ function getErrorElement(err: WorkerError) {
link.click((ev) => {
var wnd = projectWindows.createOrShow(path);
if (wnd instanceof SourceEditor) {
wnd.setCurrentLine(err, true);
wnd.navigateToLine(err.line);
}
});
}
+13
View File
@@ -341,6 +341,19 @@ export class SourceEditor implements ProjectView {
});
}
navigateToLine(line: number) {
if (line < 1 || line > this.editor.state.doc.lines) return;
const targetLine = this.editor.state.doc.line(line);
this.editor.dispatch({
selection: { anchor: targetLine.from },
effects: [
highlightLines.effect.of({ start: line, end: line }),
EditorView.scrollIntoView(targetLine.from, { y: "center" }),
],
});
this.editor.focus();
}
getValue(): string {
return this.editor.state.doc.toString();
}
+1 -1
View File
@@ -71,7 +71,7 @@ export class ProjectWindows {
this.refreshErrors();
wnd.setVisible && wnd.setVisible(true);
this.id2showfn[id] && this.id2showfn[id](id, wnd);
} else {
} else if (moveCursor) {
this.refresh(moveCursor);
}
this.activeid = id;