Make code block eval resilient to indentation (#29633)

This reduces spurious failures in the eval.

Release Notes:

- N/A
This commit is contained in:
Richard Feldman 2025-04-29 22:13:13 -04:00 committed by GitHub
parent 75a9ed164b
commit d566864891
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 21 deletions

View file

@ -6,12 +6,21 @@ pub struct PathWithRange {
pub range: Option<Range<LineCol>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct LineCol {
pub line: u32,
pub col: Option<u32>,
}
impl std::fmt::Debug for LineCol {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.col {
Some(col) => write!(f, "L{}:{}", self.line, col),
None => write!(f, "L{}", self.line),
}
}
}
impl LineCol {
pub fn new(str: impl AsRef<str>) -> Option<Self> {
let str = str.as_ref();