Skip to content

Add inline error decorations for previews and editor - #32

Merged
zhemingfan merged 1 commit into
mainfrom
feature/inline-error-decorations
Jul 4, 2026
Merged

Add inline error decorations for previews and editor#32
zhemingfan merged 1 commit into
mainfrom
feature/inline-error-decorations

Conversation

@zhemingfan

Copy link
Copy Markdown
Owner

Summary

The LSP already validates omics files, but diagnostics were only visible in the Problems panel and as editor squiggles — the previews, the strongest surface of the extension, were diagnostic-blind. This surfaces existing diagnostics where users actually look, without re-implementing what VS Code already renders (squiggles, overview ruler, minimap, editor F8).

What's new

  • Preview row markers — a leading status column shows a severity glyph (● error / ▲ warning / ■ info), a subtle row tint, and a tooltip with [CODE] message for every row whose source line has a diagnostic. Clicking a marker reveals that line in the text editor. Wired into the shared VirtualTable and the VCF preview, so 13 previews get it from one code path; chart/tree/sequence previews degrade gracefully to no markers.
  • Editor gutter icons for error/warning lines — the one editor decoration VS Code does not paint from published diagnostics.
  • Diagnostic navigation bar — error/warning counts labelled "in view" plus next/previous cycling that reveals and scrolls to each marker. Also bound to F8 / Shift+F8 while a preview is focused, scoped by a biofmtPreviewFocused context key so it never shadows the editor's own F8.
  • Preview-viewport validation — preview panels now report their viewport, so viewport-aware validation covers what the table is showing. Editor and preview viewports are tracked per source and validated as their union via a new VisibleRangeTracker.

Design notes

  • Counts are labelled "in view" because validation is viewport-bounded — we never imply the whole file was scanned, consistent with the project's lazy-parsing design.
  • The diagnostics transform (src/shared/diagnostics.ts) and VisibleRangeTracker are kept free of any vscode import, so they unit-test under Mocha.

New modules

  • Extension: services/DiagnosticBridge.ts, services/DiagnosticGutter.ts, shared/diagnostics.ts, two gutter SVGs under media/.
  • Server: visibleRanges.ts (VisibleRangeTracker).
  • Webview: diagnostics/DiagnosticsContext.tsx, components/RowStatus.tsx, components/DiagnosticNav.tsx.

Testing

  • Unit (Mocha): diagnostics transform (severity/code/range mapping, worst-severity) and visible-range union/delete/isolation — test/unit/diagnostics.test.ts, test/unit/visible-ranges.test.ts.
  • Component (Jest + RTL): DiagnosticsContext grouping/counts/worst-severity, RowStatus glyph/tooltip/click-to-reveal, DiagnosticNav counts and cycling.
  • Full suite: 802 unit tests and 60 webview tests pass; lint, all three type-checks, and the build are green; generator drift check clean.

Diagnostics were validated by the LSP but only visible in the Problems panel
and as editor squiggles. Surface them where users actually look:

- Preview row markers: a leading status column shows a severity glyph, row
  tint, and tooltip for every row whose source line has a diagnostic; clicking
  reveals that line in the editor. Wired into the shared VirtualTable and the
  VCF preview, covering 13 previews. Non-line previews degrade to no markers.
- Editor gutter icons for error/warning lines — the one decoration VS Code
  does not render from published diagnostics.
- A diagnostic navigation bar with error/warning counts (labelled "in view")
  and next/previous cycling, also driven by F8 / Shift+F8 while a preview is
  focused, scoped by a biofmtPreviewFocused context key so it never shadows the
  editor's own F8.
- Preview panels now report their viewport, so viewport-aware validation covers
  what the table shows. Editor and preview viewports are tracked per source and
  validated as a union via a new VisibleRangeTracker.

Adds DiagnosticBridge and DiagnosticGutter services, a shared vscode-free
diagnostics module, and webview DiagnosticsContext/RowStatus/DiagnosticNav,
with unit tests (diagnostics transform, visible-range union) and component
tests (context, row marker, navigation).
@zhemingfan
zhemingfan merged commit acf2c9e into main Jul 4, 2026
3 checks passed
@zhemingfan
zhemingfan deleted the feature/inline-error-decorations branch July 4, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant