Skip to content

Commit ec54c7c

Browse files
authored
fix: line number in syntax error message from external formatter (#722)
1 parent 12b7893 commit ec54c7c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/format_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ mod test {
167167
assert!(result.is_err());
168168
assert_eq!(
169169
result.unwrap_err().to_string(),
170-
"Error formatting tagged template literal at line 0: Syntax error from external formatter"
170+
"Error formatting tagged template literal at line 1: Syntax error from external formatter"
171171
);
172172
}
173173
}

src/generation/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,7 @@ fn maybe_gen_tagged_tpl_with_external_formatter<'a>(node: &TaggedTpl<'a>, contex
30473047
Ok(formatted_tpl) => formatted_tpl?.replace("\\", r"\\"),
30483048
Err(err) => {
30493049
context.diagnostics.push(context::GenerateDiagnostic {
3050-
message: format!("Error formatting tagged template literal at line {}: {}", node.start_line(), err),
3050+
message: format!("Error formatting tagged template literal at line {}: {}", node.start_line() + 1, err),
30513051
});
30523052
return None;
30533053
}

0 commit comments

Comments
 (0)