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

feat: Span visualization command #303

Merged

Conversation

grantlemons
Copy link
Collaborator

@grantlemons grantlemons commented Dec 4, 2024

Added a command to harper-cli and the justfile that visually displays spans on a parsed file.

It can be painstaking to verify that a parser is working correctly when writing one, but this command makes it easier to verify that the correct spans are being chosen.

I created this to assist me in implementing the typst parser (#302), but am spinning it off into it's own PR since it is pretty distinct.

The output is rather cluttered because it prints the span numbers as well. I'm split on this one, it can be helpful because you can cross-reference with the output of just parse to check what each span corresponds to, but it also makes the output less readable (or at least a lot longer vertically).

Example usage:
image

Note: it alternates colors to make adjacent spans stand out.

@grantlemons grantlemons force-pushed the span-visualization-command branch from b7138f6 to 3d1fd05 Compare December 4, 2024 20:03
@grantlemons grantlemons force-pushed the span-visualization-command branch from 3d1fd05 to 47b12be Compare December 4, 2024 20:04
@elijah-potter
Copy link
Collaborator

Love the work. Since harper-cli continues to primarily be a debugging tool, this is fine. Be aware that this might be removed if that changes.

@elijah-potter elijah-potter merged commit 608433b into Automattic:master Dec 26, 2024
17 checks passed
@grantlemons grantlemons deleted the span-visualization-command branch December 28, 2024 05:55
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.

2 participants