Compare commits

...

1 Commits

Author SHA1 Message Date
Dhruv Manilawala
909798ffa2 Offset syntax error for each cell 2024-05-17 13:36:21 +05:30
2 changed files with 5 additions and 2 deletions

View File

@@ -401,7 +401,10 @@ pub(crate) fn format_source(
// Format the cell. // Format the cell.
let formatted = let formatted =
format_module_source(unformatted, options.clone()).map_err(|err| { format_module_source(unformatted, options.clone()).map_err(|err| {
if let FormatModuleError::ParseError(err) = err { if let FormatModuleError::ParseError(mut err) = err {
// Offset the error location by the start offset of the cell to report
// the correct cell index.
err.location += start;
DisplayParseError::from_source_kind( DisplayParseError::from_source_kind(
err, err,
path.map(Path::to_path_buf), path.map(Path::to_path_buf),

View File

@@ -253,7 +253,7 @@ impl Display for DisplayParseError {
ErrorLocation::Cell(cell, location) => { ErrorLocation::Cell(cell, location) => {
write!( write!(
f, f,
"{cell}{colon}{row}{colon}{column}{colon} {inner}", "cell {cell}{colon}{row}{colon}{column}{colon} {inner}",
cell = cell, cell = cell,
row = location.row, row = location.row,
column = location.column, column = location.column,