fix: yaml linting panic fixes#10287
Conversation
|
WalkthroughThe YAML lexer's flow collection handling now manages indentation breaches more gracefully. When flow collection content exits the parent block scope at nested depth, the lexer emits the "Insufficient indentation in flow collection" diagnostic exactly once, restores the cursor position, and continues processing trivia. Only when at root depth does it break from the loop. Test expectations were updated to reflect the new tokenisation behaviour in nested flow collections. Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
It would be great if we added a new file that covers the offending code that causes the panic. At the moment it's only a bunch of changes to existing files |
Summary
This PR addresses lexar panics surfaced from #8330 as well as adding indentation diagnostics which were coupled with the panic test scenerios.
AI Disclosure: I paired on this ticket with Claude Code; this is a human cutting the PR.
Umbrella Linting Issue #2365
Test Plan
REPORT_PRETTIER=1 cargo test -p biome_yaml_formatter --test prettier_tests"implicit block key": ["implicit flow key": value]"implicit block key": ["implicit flow key": value]Insufficient indentation in flow collectionInsufficient indentation in flow collection(matching wording)xyz: [a bc]expected ',' but instead found 'bc'Cases 1 and 2 are the original panics this PR fixes. Case 3 is the new diagnostic this PR adds. Case 4 is documented as a known limitation tracked for follow-up — the lexer doesn't yet support multi-line plain scalars in flow context (
crates/biome_yaml_parser/src/lexer/mod.rs:397has the existing TODO).