Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@magurotuna
Copy link
Contributor

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:

consta="こんにちは";

Specifically, if we attempt to point to in this snippet by passing(15, 16) as range, annotate-snippets will give us:

  |1 | const a = "こんにちは";  |                ^  |

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.

Comment on lines +638 to +644
let expected =r#" --> <current file>:1:1
|
1 | お寿司
| ^^^^^^ Sushi1
2 | 食べたい🍣
| ---- note: Sushi2
|"#;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

With monospace fonts, this is displayed like:

image

Comment on lines +601 to +607
let expected =r#" --> <current file>:1:3
|
1 | おはよう
| _____^
2 | | ございます
| |______^ Good morning
|"#;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

image

Comment on lines +573 to +577
let expected =r#" --> <current file>:1:7
|
1 | こんにちは、世界
| ^^^^ world
|"#;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

image

Comment on lines +668 to +672
let expected =r#" --> <current file>:1:7
|
1 | こんにちは、新しいWorld!
| ^^^^^^^^^^^ New world
|"#;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

image

@zbraniecki
Copy link
Contributor

Thank you so much for the patch! It reads very clear and not just fixes the bug, but also improves the code.

@zbranieckizbraniecki merged commitfc99036 intorust-lang:masterSep 4, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@zbranieckizbranieckizbraniecki approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@magurotuna@zbraniecki

[8]ページ先頭

©2009-2025 Movatter.jp