Skip to content

Add startLine & startCharacter to parser errors #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2025

Conversation

pimterry
Copy link
Contributor

If you're parsing JSON and providing feedback about errors to a user or developer, a specific line & character is more useful than an offset.

JSONVisitor onError already exposes this information, but parse() and parseTree() did not. This tiny change just exposes the existing error details on all ParseErrors.

This fixes #1 (already closed, but there's ongoing debate there about adding line & character information).

@aeschli
Copy link
Contributor

aeschli commented Aug 5, 2025

Thanks @pimterry !

@aeschli aeschli enabled auto-merge (squash) August 5, 2025 08:53
@vs-code-engineering vs-code-engineering bot added this to the August 2025 milestone Aug 5, 2025
@aeschli aeschli merged commit fe33019 into microsoft:main Aug 5, 2025
2 checks passed
@pimterry pimterry deleted the error-lines branch August 5, 2025 10:17
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.

Error objects should also contain location information
3 participants