- Notifications
You must be signed in to change notification settings - Fork47
Fix display of annotation for double width characters#46
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| let expected =r#" --> <current file>:1:1 | ||
| | | ||
| 1 | お寿司 | ||
| | ^^^^^^ Sushi1 | ||
| 2 | 食べたい🍣 | ||
| | ---- note: Sushi2 | ||
| |"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| let expected =r#" --> <current file>:1:3 | ||
| | | ||
| 1 | おはよう | ||
| | _____^ | ||
| 2 | | ございます | ||
| | |______^ Good morning | ||
| |"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| let expected =r#" --> <current file>:1:7 | ||
| | | ||
| 1 | こんにちは、世界 | ||
| | ^^^^ world | ||
| |"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| let expected =r#" --> <current file>:1:7 | ||
| | | ||
| 1 | こんにちは、新しいWorld! | ||
| | ^^^^^^^^^^^ New world | ||
| |"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
zbraniecki commentedSep 4, 2021
Thank you so much for the patch! It reads very clear and not just fixes the bug, but also improves the code. |




Hi there.
We're using this crate indenoland/deno_lint to display pretty diagnostics of the linter. By chance, I found that this crate doesn't work well if the source includes double width characters like:
Specifically, if we attempt to point to
はin this snippet by passing(15, 16)as range, annotate-snippets will give us:where obviously
^points to the wrong position.These characters take up twice the size of ordinary characters like the alphabet, so displaying annotation for them requires special handling, which I implemented in this patch.