fix: preserve tab indentation when modifying modules - #179
xianjianlf2 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe parser now uses the configured or detected tab width. Recast line joining preserves indentation metadata. A regression test verifies tab indentation when adding a Vite plugin. ChangesTab indentation preservation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The indentation fix is covered by regression tests and no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #179 +/- ##
==========================================
- Coverage 93.54% 86.50% -7.04%
==========================================
Files 25 27 +2
Lines 1797 882 -915
Branches 335 278 -57
==========================================
- Hits 1681 763 -918
+ Misses 115 102 -13
- Partials 1 17 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #34.
Adding a Vite plugin to a config indented with one tab currently changes
pluginsto four tabs and emits a mixture of tabs and spaces for the plugin options. The issue's reproducer now keeps one tab forpluginsand two tabs for the nested option.There are two causes:
generateCode()prints using the detected width. Pass the detected width toparseModule()too, preserving an explicit parser override.The regression exercises
addVitePlugin()with both detected indentation and an explicit tab width of 4. Both cases fail on the unchanged base.Validation:
pnpm lintpasses on the clean source tree.pnpm exec vitest run --coverage: 85 tests pass.pnpm buildandpnpm run test:build --run: build succeeds; 85 tests pass against the built output.pnpm exec tsc --noEmit --skipLibCheckpasses. Unmodifiedpnpm typecheckreports the same 7 errors in dependency declarations on both the base and this branch.AI assistance: OpenAI Codex assisted with diagnosis, implementation, and testing.
Summary by CodeRabbit
Bug Fixes
Tests