diff --git a/crates/ty_test/src/assertion.rs b/crates/ty_test/src/assertion.rs index 7ec39482f8..4bd0637347 100644 --- a/crates/ty_test/src/assertion.rs +++ b/crates/ty_test/src/assertion.rs @@ -363,9 +363,9 @@ impl std::fmt::Display for ErrorAssertion<'_> { /// A parsed and validated `# hover:` assertion comment. #[derive(Debug)] pub(crate) struct HoverAssertion<'a> { - /// The column where the down arrow appears in the assertion comment. + /// The zero-based column where the down arrow appears in the assertion comment. /// This indicates the position in the next line where we should hover. - pub(crate) column: OneIndexed, + pub(crate) column: usize, /// The expected type at the hover position. pub(crate) expected_type: &'a str, @@ -381,13 +381,10 @@ impl<'a> HoverAssertion<'a> { } // Find the down arrow position in the full comment to determine the column - let arrow_position = full_comment + let column = full_comment .find('↓') .ok_or(HoverAssertionParseError::MissingDownArrow)?; - // Column is 1-indexed, and the arrow position is 0-indexed - let column = OneIndexed::from_zero_indexed(arrow_position); - Ok(Self { column, expected_type, diff --git a/crates/ty_test/src/hover.rs b/crates/ty_test/src/hover.rs index 43aa67e6f3..a037162a07 100644 --- a/crates/ty_test/src/hover.rs +++ b/crates/ty_test/src/hover.rs @@ -110,9 +110,7 @@ pub(crate) fn generate_hover_outputs( let target_line_start = lines.line_start(target_line, &source); // Calculate the hover position from the column in the parsed assertion - // Column is 1-indexed, so convert to 0-indexed for TextSize - let hover_offset = - target_line_start + TextSize::try_from(hover.column.get() - 1).unwrap(); + let hover_offset = target_line_start + TextSize::try_from(hover.column).unwrap(); // Get the inferred type at that position let Some(inferred_type) = infer_type_at_position(db, file, hover_offset) else {