Correctly format abilities with comments

This commit is contained in:
Ayaz Hafiz 2022-10-04 10:03:51 -05:00
parent f145610be0
commit f6c21cc933
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 54 additions and 9 deletions

View file

@ -1257,8 +1257,17 @@ mod ability {
IndentLevel::Exact(wanted) if state.column() > wanted => {
// This demand is not indented correctly
let indent_difference = state.column() as i32 - wanted as i32;
// We might be trying to parse at EOF, at which case the indent level
// will be off, but there is actually nothing left.
let progress = if state.has_reached_end() {
NoProgress
} else {
MadeProgress
};
Err((
MadeProgress,
progress,
EAbility::DemandAlignment(indent_difference, state.pos()),
initial,
))