Skip to content

Preserve diagnostic labels in JSON output #516

Closed

Description

@LunaStev

A diagnostic loses its source label when switching from human output to JSON. Reproduced on canonical master 0c67f4c.

Reproduction:

fun main() { "\q"; }

wavec check input.wave includes the label unsupported escape sequence. wavec --error-format=json check input.wave omits it entirely. WaveError::to_json in front/error/src/error.rs serializes context, expected, found, help, and note but never serializes self.label.

Add a nullable label field using the existing JSON escaping helper. Cover labels containing quotes, backslashes and control characters, the absent-label case, and a real lexer diagnostic through the driver. Existing fields and source coordinates should remain unchanged. No new dependency is needed.

This is an implementation defect; #404 separately tracks diagnostic format documentation.

Activity

  1. added
    good first issue
    on Sep 8, 2026
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

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions