Skip to content
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

Provide more structured data in SyntaxError #57

Closed
bartlomieju opened this issue Sep 24, 2024 · 3 comments
Closed

Provide more structured data in SyntaxError #57

bartlomieju opened this issue Sep 24, 2024 · 3 comments

Comments

@bartlomieju
Copy link
Contributor

I already opened #56 to have more granular control over how error messages are displayed.

It would be lovely if SyntaxError could provide additional information like "start" and "end" position (a "range") of the error (if that's possible) so that users of the crate could crate more rich error displays, something like dprint-plugin-typescript does:

Error formatting: /Users/ib/dev/deno/broken.ts
   Expected '{', got 'interface' at file:///Users/ib/dev/deno/broken.ts:1:8

  export interface Foo }{}
         ~~~~~~~~~
Checked 1 file

In this particular case we have a range that points to the "interface" keyword which is underlined.

@g-plane
Copy link
Owner

g-plane commented Sep 25, 2024

Source code is parsed directly without tokenizing/lexing, so it doesn't know where the end position is.

@bartlomieju
Copy link
Contributor Author

Makes sense, I can just point to the concrete line/column without a range then :) any chance you could cut another release so I could leverage #56 and #58?

@g-plane
Copy link
Owner

g-plane commented Sep 26, 2024

https://github.com/g-plane/markup_fmt/releases/tag/v0.13.1

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

No branches or pull requests

2 participants