Skip to content

Commit

Permalink
Fix line and column indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jul 30, 2024
1 parent 3d6e6ce commit 07e46fa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/turbopack-mdx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,21 @@ impl MdxTransformedAsset {
Err(err) => {
let loc = Vc::cell(err.place.map(|p| {
let (start, end) = match *p {
// markdown's positions are 1-indexed, SourcePos is 0-indexed
markdown::message::Place::Position(p) => (
SourcePos {
line: p.start.line,
column: p.start.column,
line: p.start.line - 1,
column: p.start.column - 1,
},
SourcePos {
line: p.end.line,
column: p.end.column,
line: p.end.line - 1,
column: p.end.column - 1,
},
),
markdown::message::Place::Point(p) => {
let p = SourcePos {
line: p.line,
column: p.column,
line: p.line - 1,
column: p.column - 1,
};
(p, p)
}
Expand Down

0 comments on commit 07e46fa

Please sign in to comment.