Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crates/source_map_parser/src/context_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn lookup_context_from_sourcemap(
}
Some(ContextSnippet {
src,
line: origin_line,
line: origin_line + 1,
column: origin_col,
context,
})
Expand Down
6 changes: 3 additions & 3 deletions crates/source_map_parser/src/token_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn generate_source_map_token_from_map(
}
if let Some(token) = source_map.lookup_token(line - 1, column) {
Some(SourceMapToken {
line: token.get_src_line() as u32,
line: token.get_src_line() + 1,
column: token.get_src_col() as u32,
source_code: token.get_source_view().map(|v| v.source().to_string()),
src: token.get_source().map(|s| s.to_string()),
Expand Down Expand Up @@ -210,7 +210,7 @@ pub fn generate_context_token_from_map(
for ln in start..=end {
let raw = lines.get(ln as usize).cloned().unwrap_or("").to_string();
token.source_code.push(SourceCode {
line: ln,
line: ln + 1,
is_stack_line: ln == origin_line,
raw,
});
Expand All @@ -234,7 +234,7 @@ mod tests {
fn test_get_stack_source_single_line() {
let sm = simple_sm("a.js", "fn()\\n");
let tok = get_stack_source(&sm, 1, 0, None).expect("token");
assert_eq!(tok.line, 0); // original line
assert_eq!(tok.line, 1); // original line
assert_eq!(tok.source_code.len(), 1);
}

Expand Down
Loading