mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Fix Printer group modes (#6815)
This commit is contained in:
parent
205d234856
commit
e4c13846e3
3 changed files with 80 additions and 67 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::prelude::TagKind;
|
||||
use crate::GroupId;
|
||||
use ruff_text_size::TextRange;
|
||||
use std::error::Error;
|
||||
|
||||
|
@ -86,7 +87,9 @@ pub enum InvalidDocumentError {
|
|||
/// Text
|
||||
/// EndGroup
|
||||
/// ```
|
||||
StartTagMissing { kind: TagKind },
|
||||
StartTagMissing {
|
||||
kind: TagKind,
|
||||
},
|
||||
|
||||
/// Expected a specific start tag but instead is:
|
||||
/// - at the end of the document
|
||||
|
@ -96,6 +99,10 @@ pub enum InvalidDocumentError {
|
|||
expected_start: TagKind,
|
||||
actual: ActualStart,
|
||||
},
|
||||
|
||||
UnknownGroupId {
|
||||
group_id: GroupId,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
|
@ -148,6 +155,9 @@ impl std::fmt::Display for InvalidDocumentError {
|
|||
}
|
||||
}
|
||||
}
|
||||
InvalidDocumentError::UnknownGroupId { group_id } => {
|
||||
std::write!(f, "Encountered unknown group id {group_id:?}. Ensure that the group with the id {group_id:?} exists and that the group is a parent of or comes before the element referring to it.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue