tool window plugin: IDEA Doesn't see changes that was made

Answered

I am currently facing an issue with JetBrains IntelliJ IDEA, where it does not seem to detect changes my plugin make in real-time. Specifically, when plugin switch between branches (using jgit) or make edits, IntelliJ IDEA does not reflect these changes immediately unless I switch to another window and then return to IntelliJ IDEA.

Could you please provide guidance on how to manually refresh IntelliJ IDEA to ensure it recognizes such changes promptly?

0
4 comments

Hi Roman,

Please clarify the issue. What APIs do you use? What are implementations?

It sounds most likely that Virtual File System is not refreshed after your changes, but it's hard to help without details.

If it is about VFS, take a look at https://plugins.jetbrains.com/docs/intellij/virtual-file-system.html.

0

Hi Karol,

My plugin uses org.eclipse.jgit to change branches inside an open project, but IDEA doesn't see that this branch has been changed. I think you are sure about VFS, but how can I send a project update message after checkout to another branch?

0

I don't know jgit library, but I would try invoking VFS refresh after you switch branches with jgit. Information about how to refresh VFS is on the page I linked.

0

Thanks!
I found solution for me - refreshing after switch helps (but .git should be refreshed  additionally). 

Example code with fix:

val fileSystem = LocalFileSystem.getInstance()
val virtualFile: VirtualFile? = fileSystem.findFileByPath(repo.path)
val virtualFileGit: VirtualFile? = fileSystem.findFileByPath("${repo.path}/.git}")
repo.createCommit("Save message")
gitUtil.checkout(repo, branchName)
repo.resetLastCommitsWithMessage("Save message")
virtualFile?.refresh(false, true)
virtualFileGit?.refresh(false, true)
0

Please sign in to leave a comment.