Skip to content

Smarter unclosed delimiter error message location #5906

Open

Description

@Evidlo

I recently ran into this issue in my thesis document and spent about 20 minutes trying to find the real problem, which was located far away from the highlighted line.

Below is a stripped down reproduction:

- $3x + 123
- more content
- this is some content

$G_1, G_2$
[evan@blackbox tmp] typst compile test.typ 
error: unclosed delimiter
  ┌─ test.typ:5:9
  │
5 │ $G_1, G_2$
  │          ^

I'm not sure if there's any way to fix this with some fancy heuristics?

Operating system

Linux

Typst version

Typst 0.12

Activity

  1. added
    bug
    on Feb 20, 2025
  2. PartyWumpus commented on Feb 20, 2025

    @PartyWumpus

    It is technically correct though. The first math block is from `$3x to the second dollar sign.

    I would guess this is more difficult to do any sort of heuristics for compared to brackets because the opening symbol is the same as the closing one.

  3. added
    syntax
    diagnostics
    on Feb 25, 2025
  4. removed
    bug
    on Sep 19, 2025
  5. changed the title [-]Unclosed delimiter error message points to wrong location[/-] [+]Smart unclosed delimiter error message location[/+] on Sep 19, 2025
  6. added
    change request
    on Sep 19, 2025
  7. changed the title [-]Smart unclosed delimiter error message location[/-] [+]Smarter unclosed delimiter error message location[/+] on Sep 19, 2025
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

    change requestdiagnosticssyntax

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions