File changes made by Qoder IDEA plugin are reverted when the file is already open in the editor

(The content is generated by Qoder, too)

Issue Description

When a file is already open in the IntelliJ IDEA editor, modifications made through Qoder’s search_replace tool appear to succeed (showing successful line changes in the tool output), but the changes are not actually persisted to the file on disk. The file content remains unchanged or reverts to its original state. This causes silent failure of code modifications without any error indication.

Steps to Reproduce

  1. Open a Java file in IntelliJ IDEA editor
  2. Keep the file open in the editor tab
  3. Use Qoder plugin to modify the file via search_replace tool
  4. Observe that the tool reports success (e.g., “edit file by search_replace success, file path: …, line changes: +X added, -Y removed”)
  5. Check the actual file content - the changes are missing or reverted
  6. Read the file using read_file tool - shows original content, not the modified version

Expected Behavior

When search_replace succeeds, the file modifications should be:

  • Actually written to disk
  • Visible in the IDEA editor
  • Persisted when reading the file again
  • Reflected in git status/diff

The file should update regardless of whether it’s currently open in the editor.

Actual Behavior

  • search_replace tool reports successful modification with correct line counts
  • File content on disk remains unchanged (reverted to original state)
  • Editor still shows the old content
  • Subsequent read_file shows the original content, not the modified version
  • Changes are silently lost without any error message
  • User has to manually redo the work or close the file before making changes

Workaround: Close the file in IDEA editor before using Qoder’s file modification tools, or manually reload the file after changes.

Screenshots / Screen Recordings

Operating System

OS: macOS 15.6 (Darwin)
IDE: IntelliJ IDEA 2025.2.3
Shell: /bin/zsh

Current Qoder Version (Menu → About Qoder → Copy)

0.5.4

Thank you very much for your feedback and suggestions. We will reproduce this issue in our local environment and analyze how to optimize and solve it :saluting_face: