Make code block eval resilient to indentation (#29633)
This reduces spurious failures in the eval. Release Notes: - N/A
This commit is contained in:
parent
75a9ed164b
commit
d566864891
3 changed files with 34 additions and 21 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue