Make compiler diagnostics navigable
Body
Compiler diagnostics for C, C++, and Java currently leave candidates to locate reported lines by hand. This change makes only verified candidate-source locations mouse- and keyboard-operable, focusing the editor at the start of the mapped line and synchronizing the editor, syntax overlay, line numbers, and active-line highlight.
Location extraction reuses the remapped line numbers from compiler-explorer.js without applying offsets again. Diagnostic text remains escaped and unchanged for Jim, while the completed-run code and language snapshot prevents stale results from moving a changed editor. Navigation does not edit code, alter undo/redo history, or publish a code update.
Tests cover multiple diagnostics, Java output without columns, C++ include chains, invalid, harness, header, and runtime locations, stale pending runs, focus and scroll synchronization, unchanged history and publication, and diagnostic escaping. The LiveKit publication fixture is shared by both browser suites.
Validation:
./scripts/test.sh browser: 2003 passed, 0 failed, and 12 skipped becausejavacandjavaare unavailable locally.- The directly affected Chromium suites passed 47 tests with no failures or skips.
- Prettier, ESLint, and
git diff --checkpassed. - Manually checked a second problem with a different generated harness.
Screenshots:
Before this change, compiler locations are plain text:
First revision, each location was operable but kept the browser's default button styling:
Current revision, each location is an underlined link, shown here focused from the keyboard:
PR #518 also changes web/compiler-explorer.js and its tests, while PR #519 changes web/interview.js; whichever lands second may need to rebase.
Close #486
Summary by cubic
Makes C, C++, and Java compiler diagnostics navigable: valid candidate-source locations in the output are now mouse- and keyboard-operable, focusing the editor at the mapped line and syncing the syntax overlay, line numbers, and active-line highlight.
- Reuses the remapped line numbers from
compiler-explorer.jswithout applying the harness offset again, and keeps javac's echoed source excerpts—even bare-caret ones—plain so they can't be read as locations. - Ties navigation to the completed run snapshot, so editing code or changing language after a run shows a "run tests again" message instead of moving the editor.
- Navigation never edits code, changes undo/redo history, or publishes a code update.
- Diagnostic text stays escaped and unchanged; only verified locations become operable.
- The LiveKit publication fixture is now shared by both browser suites.
Closes #486.