Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/template-model/src/parser/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,14 @@ impl MarkedEventReceiver for CfnYamlLoader {
}
self.path_stack.push(v.clone());
let path = self.current_path();
// mark.line() and mark.col() are 0-based
self.span_map.insert(path, (mark.line() as u32 + 1, mark.col() as u32 + 1));
// yaml_rust2 Marker reports line 1-based but column 0-based,
// so only the column is shifted to the 1-based column every
// other diagnostic reports (see the parse-error path above).
self.span_map.insert(path, (mark.line() as u32, mark.col() as u32 + 1));
// Remember this key's position so a later duplicate of it
// can be anchored at the offending occurrence.
if let Some(slot) = self.key_marks.last_mut() {
*slot = Some((mark.line() as u32 + 1, mark.col() as u32 + 1));
*slot = Some((mark.line() as u32, mark.col() as u32 + 1));
}
}
} else if matches!(parent.0, Yaml::Array(_))
Expand Down
Loading