Skip to content

Improve diagnostics UX: map LaTeX log errors to source location with highlighting/jump-to-error/fix hints #14

Description

@InMDev

Problem

Currently, LaTeX diagnostics are extracted from the LaTeX log using utility functions (summarizeLatexLog in both src/lib/latex.js and src/App.jsx) and are shown in the UI as plain summary or full log text. While some line number extraction and error highlighting exists, the editor does not yet provide full navigation from log errors to the corresponding line/column in the LaTeX source, context highlighting, or actionable hints for common errors.

Proposal

Enhance the diagnostics UX by:

  • Parsing LaTeX log errors to extract precise line (and if possible, column) information for errors and warnings.
  • Visually highlighting the offending code directly in the editor (textarea/source view) when an error is present in the log.
  • Enabling a "jump to error" action/button which focuses the editor on the relevant line.
  • Displaying suggestions/hints for common LaTeX errors (e.g., missing $ or \end, underfull/overfull hbox issues).

Suggested Implementation Details

  • Extend or replace summarizeLatexLog (see src/lib/latex.js & src/App.jsx) so that instead of just a summary string, it returns a structured error list with line info, error type, and fix suggestions when possible.
  • Integrate this structured error info into the React state/UI:
    • Highlight offending code in the LaTeX source editor (e.g., with a red background for error lines).
    • Add a "jump to error" button in the log summary section (src/App.jsx), which scrolls the editor to the relevant line.
    • Show contextual hints/fix suggestions under each error if a known pattern is matched.

Relevant code references

Acceptance Criteria

  • Error messages in the diagnostic summary are clickable and/or the user can jump to the exact line in the source for each error.
  • Offending lines are visually highlighted in the source editor when errors are present.
  • For any error in the log with a matching known-common issue, an actionable fix/hint displays in the UI.
  • Changes are covered by appropriate unit tests (see tests/lib/latex.test.js).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions