From c26354dedf3f0b906e905c90e22329edf024c364 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 30 Oct 2023 12:44:00 -0400 Subject: [PATCH] fix: print column 1-indexed --- src/printer.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index afa2a708..deca90dd 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -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], @@ -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 )) )?; }