-
Notifications
You must be signed in to change notification settings - Fork 44
SourceAnnotation underline displays offset from range #29
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
Comments
Oh, #27 didn't fix the bug properly. As I said here, one cannot use
What this does is that instead of treating each line ending as 2 chars, they treat it as 1 char. But the correct fix is to distinguish between the different types of line endings. Generally I don't think char indexing is really what you want anyways, because unicode makes everything complicated. |
@Nadrieril Can you post the |
This is the exact same issue as in #24, except that in #24 it failed on |
Actually, here you go: Snippet {
title: Some(
Annotation {
id: None,
label: Some(
"oops".to_string(),
),
annotation_type: AnnotationType::Error,
},
),
footer: vec![],
slices: vec![
Slice {
source: "First line\r\nSecond oops line".to_string(),
line_start: 1,
origin: Some(
"<current file>".to_string(),
),
annotations: vec![
SourceAnnotation {
range: (
19,
23,
),
label: "oops".to_string(),
annotation_type: AnnotationType::Error,
},
],
fold: true,
},
],
opt: Default::default(),
} Output:
Expected:
The shift gets linearly worse when there are more lines. |
Ok it is easy to solve. The other cases without I would greatly appreciate your help detecting these extreme cases and adding coverage since I want to use it in my template engine, thanks !! |
This is the only problem I am aware of |
Fix no copy when cast `Snippet` to `DisplayList` and #29
@Nadrieril can you try master! @botika wrote a patch for the line endings! |
The patch looks good ! As far as I'm concerned this is fixed. |
I released |
I was getting #24 with v0.6.1, but not anymore. Unfortunately I got a similar problem when I tried to update to v0.7.0.
Here's with v0.6.1:
and with v0.7.0, removing the
DisplayListFormatter
and adding defaultFormatOptions
to the snippet:add.asm
has 4 lines before that error, each ending in CRLF. It seems like the offset is in the other direction now.Originally posted by @gipsond in #24 (comment)
The text was updated successfully, but these errors were encountered: