[IconPack] Don’t override the .kt file object if the content hasn’t changed#971
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (8)
WalkthroughIcon pack saving now threads an IntelliJ 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tools/idea-plugin/CHANGELOG.md`:
- Line 21: Update the line "[IconPack] The IDE doesn't automatically display new
iconpack object file" in the "### Fixed" section to past-tense wording (e.g.,
reference the issue as resolved) so it reads as a fixed item; locate the exact
line text to replace and change it to a past-tense phrasing such as "[IconPack]
The IDE didn't automatically display new iconpack object file" or "The IDE no
longer automatically displayed new iconpack object file" to match the other
entries in the Fixed section.
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/util/IconPackWriter.kt`:
- Around line 69-76: The current write block always overwrites the file and
swallows exceptions via runCatching.getOrElse; change it to first read existing
content (VfsUtil.loadText(file) after creating/finding file) and compare to the
new content, and only call VfsUtil.saveText(file, content) when different to
avoid touching unchanged .kt files; remove runCatching.getOrElse swallowing and
instead catch exceptions so you log the full Throwable
(Logger.getInstance(IconPackWriter::class.java).error("Failed to save iconpack",
it)) and rethrow or propagate the exception so failures are not reported as
success; keep the logic inside the same writeCommandAction and use the same
symbols (IconPackWriter, VfsUtil.saveText, VfsUtil.loadText, Logger) to locate
edits.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a49f4b4b-e54e-436f-93ba-0f114cb527b9
📒 Files selected for processing (13)
tools/idea-plugin/CHANGELOG.mdtools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/util/IconPackWriter.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackViewModel.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackAction.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackModeState.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ui/ExistingPackEditor.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialPackViewModel.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/model/MaterialPackAction.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/ui/MaterialPackCreation.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/model/NewPackAction.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/ui/NewPackCreation.kttools/idea-plugin/src/main/resources/messages/Valkyrie.properties
2231fce to
38be2ac
Compare
49898287-9b96-4318-b42e-d526a1c48ff6.mov
📝 Changelog
If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs: