diff --git a/src/template-model/src/parser/yaml.rs b/src/template-model/src/parser/yaml.rs index bae68fa..c04cbac 100644 --- a/src/template-model/src/parser/yaml.rs +++ b/src/template-model/src/parser/yaml.rs @@ -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(_))