Skip to content

Commit

Permalink
Fix location comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bradlarsen committed Nov 20, 2024
1 parent 8375040 commit 6709c75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/noseyparker/src/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ impl LocationMapping {
/// Panics if the given `OffsetSpan` is not valid for this `LocationMapping`.
pub fn get_source_span(&self, span: &OffsetSpan) -> SourceSpan {
let start = self.offset_to_source[span.start];
let end = self.offset_to_source[span.end.saturating_sub(1)]; // XXX: is this right?
// let end = self.offset_to_source[span.end];
let end_idx = span.end.saturating_sub(1);

// FIXME: The end index is not calculated correctly here! It currently includes the line terminator
let end = self.offset_to_source[end_idx];
SourceSpan { start, end }
}
}
Expand Down

0 comments on commit 6709c75

Please sign in to comment.