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

Add a new diagnostics library #347

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Add a new diagnostics library #347

wants to merge 11 commits into from

Conversation

mcy
Copy link
Member

@mcy mcy commented Oct 2, 2024

This is the first PR of many to implement a new frontend for protocompile. New packages will live under protocompile/experimental until we're ready to promote the next protocompile verison.

This change adds:

  • internal/golden, a golden tests framework.
  • internal/width, a port of Rust's unicode-width for calculation the approximate terminal display width of multilingual strings. Using uniseg for this, works great!
  • report.proto, a Protobuf for diagnostics.
  • experimental/report, the package itself.
  • experimental/report/testdata, a suite of tests for the report renderer.

The fussiest part of this PR is experimental/report/renderer.go. I have tried to include tests for all of the corner cases, and I have attempted to document it so that which mysterious layout trick is written down, lest I forget.

There's one intentionally broken test: it's very difficulty to support users who want to use RTL scripts in diagnostics, because not only does that cause the text direction to flip, it flips around things that are not part of the RTL script. Bidi handling is not worth it, and not even Rust tries to get this right.

@mcy mcy requested a review from jhump October 2, 2024 18:04
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.

1 participant