Skip to content

[IconPack] Don’t override the .kt file object if the content hasn’t changed#971

Merged
egorikftp merged 1 commit into
mainfrom
bug/idea/idea-api-export
May 1, 2026
Merged

[IconPack] Don’t override the .kt file object if the content hasn’t changed#971
egorikftp merged 1 commit into
mainfrom
bug/idea/idea-api-export

Conversation

@egorikftp

@egorikftp egorikftp commented May 1, 2026

Copy link
Copy Markdown
Member
49898287-9b96-4318-b42e-d526a1c48ff6.mov

📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6317596a-e08d-4f77-a265-1dac5d89b969

📥 Commits

Reviewing files that changed from the base of the PR and between 2231fce and 38be2ac.

📒 Files selected for processing (13)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/util/IconPackWriter.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackModeState.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ui/ExistingPackEditor.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/model/MaterialPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/ui/MaterialPackCreation.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/model/NewPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/ui/NewPackCreation.kt
  • tools/idea-plugin/src/main/resources/messages/Valkyrie.properties
✅ Files skipped from review due to trivial changes (2)
  • tools/idea-plugin/src/main/resources/messages/Valkyrie.properties
  • tools/idea-plugin/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/ui/MaterialPackCreation.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/model/MaterialPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ui/ExistingPackEditor.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/ui/NewPackCreation.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackModeState.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/util/IconPackWriter.kt

Walkthrough

Icon pack saving now threads an IntelliJ Project through the pipeline: IconPackWriter.savePack is a suspend function accepting Project and uses explicit VFS writes inside a write command action instead of SDK helpers or async refresh. SavePack actions were changed from parameterless singletons to data classes carrying Project (and isModified for existing packs). ViewModels forward the project; UI reads it from LocalProject.current. ExistingPackEditState now stores initialInputFieldState and exposes isModified. CHANGELOG updated with unchanged-file and file-visibility entries.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically summarizes the main change: preventing override of .kt files when content hasn't changed, which directly matches the primary modification across all changed files.
Description check ✅ Passed The PR description includes a link to the closed issue (#965), identifies user-facing changes, and appropriately checks the IntelliJ Plugin changelog as required by the template.
Linked Issues check ✅ Passed The code changes fully implement the objective from issue #965 by introducing content comparison logic and conditional file writing to prevent unnecessary overrides when content is unchanged.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #965's objective: modifying the icon pack save flow to track file modification state and conditionally update .kt files only when content differs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/idea/idea-api-export

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b922dd0 and 2231fce.

📒 Files selected for processing (13)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/util/IconPackWriter.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/model/ExistingPackModeState.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ui/ExistingPackEditor.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/model/MaterialPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/ui/MaterialPackCreation.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/model/NewPackAction.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/ui/NewPackCreation.kt
  • tools/idea-plugin/src/main/resources/messages/Valkyrie.properties

Comment thread tools/idea-plugin/CHANGELOG.md Outdated
@egorikftp egorikftp force-pushed the bug/idea/idea-api-export branch from 2231fce to 38be2ac Compare May 1, 2026 09:54
@egorikftp egorikftp merged commit 817277d into main May 1, 2026
3 checks passed
@egorikftp egorikftp deleted the bug/idea/idea-api-export branch May 1, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IDEA Plugin] [IconPack] Don't override kt file if content not changed

1 participant