Skip to content

Commit

Permalink
fix: print column 1-indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 30, 2023
1 parent 7807fac commit c26354d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ impl<'a> DocPrinter<'a> {
}

pub fn format(&self, w: &mut Formatter<'_>) -> FmtResult {
self.format_(w, self.doc_nodes, 0)
self.format_with_indent(w, self.doc_nodes, 0)
}

fn format_(
fn format_with_indent(
&self,
w: &mut Formatter<'_>,
doc_nodes: &[DocNode],
Expand Down Expand Up @@ -92,7 +92,12 @@ impl<'a> DocPrinter<'a> {
"{}",
colors::italic_gray(&format!(
"Defined in {}:{}:{}\n\n",
node.location.filename, node.location.line, node.location.col
node.location.filename,
node.location.line,
// todo(#150): for some reason the column is 0-indexed and the line
// is 1-indexed. Display them both with the same index so that vscode
// goes to the correct column when clicking this.
node.location.col + 1
))
)?;
}
Expand Down

0 comments on commit c26354d

Please sign in to comment.