fix(core): idempotence formatting html-ish files#9532
Conversation
🦋 Changeset detectedLatest commit: d6f9bcb The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis PR fixes a false-positive change detection issue where Possibly related PRs
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)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_cli/tests/cases/indent_script_and_style.rs (1)
113-117: Consider adding a<style>idempotence fixture as well.Current additions cover script indentation; a style-block case would close the loop on
indentScriptAndStyle.Also applies to: 151-152
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_cli/tests/cases/indent_script_and_style.rs` around lines 113 - 117, Add a second idempotence fixture alongside SVELTE_FILE_ALREADY_FORMATTED that contains a <style> block already formatted with the expected indentScriptAndStyle indentation so the test covers both <script> and <style> idempotence; update the test constant name(s) in crates/biome_cli/tests/cases/indent_script_and_style.rs (e.g., SVELTE_FILE_ALREADY_FORMATTED and the similar constant at lines ~151-152) and ensure the test uses the new <style> fixture when invoking the indentScriptAndStyle behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/biome_cli/tests/cases/indent_script_and_style.rs`:
- Around line 113-117: Add a second idempotence fixture alongside
SVELTE_FILE_ALREADY_FORMATTED that contains a <style> block already formatted
with the expected indentScriptAndStyle indentation so the test covers both
<script> and <style> idempotence; update the test constant name(s) in
crates/biome_cli/tests/cases/indent_script_and_style.rs (e.g.,
SVELTE_FILE_ALREADY_FORMATTED and the similar constant at lines ~151-152) and
ensure the test uses the new <style> fixture when invoking the
indentScriptAndStyle behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ae498607-8851-4ac5-bb1e-f68998383ea9
⛔ Files ignored due to path filters (2)
crates/biome_cli/tests/snapshots/main_cases_indent_script_and_style/check_write_svelte_indent_is_idempotent.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_indent_script_and_style/check_write_vue_indent_is_idempotent.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (11)
.changeset/fix-indent-script-idempotent.mdcrates/biome_cli/tests/cases/indent_script_and_style.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/graphql.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/workspace/server.rs
Summary
Closes #9117
The issue was caused by the loss of indentation when fixing embedded snippets. The fix adds a new parameter passed to
fix_all, which is the indentation required. It's passed when callingfix_allof the embeds.Test Plan
Added new tests
Docs