diff --git a/base/src/com/google/idea/blaze/base/qsync/QuerySyncAsyncFileListener.java b/base/src/com/google/idea/blaze/base/qsync/QuerySyncAsyncFileListener.java index 2c5ec566988..88b9924c8ce 100644 --- a/base/src/com/google/idea/blaze/base/qsync/QuerySyncAsyncFileListener.java +++ b/base/src/com/google/idea/blaze/base/qsync/QuerySyncAsyncFileListener.java @@ -30,10 +30,10 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.AsyncFileListener; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent; import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; import com.intellij.openapi.vfs.newvfs.events.VFileMoveEvent; +import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent; import java.nio.file.Path; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -83,6 +83,13 @@ private ImmutableList filterForProject( } private boolean requiresSync(VFileEvent event) { + if (event instanceof VFileCreateEvent || event instanceof VFileMoveEvent) { + return true; + } else if (event instanceof VFilePropertyChangeEvent + && ((VFilePropertyChangeEvent) event).getPropertyName().equals("name")) { + return true; + } + VirtualFile vf = event.getFile(); if (vf == null) { return false; @@ -92,17 +99,6 @@ private boolean requiresSync(VFileEvent event) { return true; } - if (event instanceof VFileCreateEvent || event instanceof VFileMoveEvent) { - return true; - } - - if (event instanceof VFileContentChangeEvent) { - // TODO: Check if file is not already part of graph - if (((VFileContentChangeEvent) event).getOldLength() == 0) { - return true; - } - } - return false; }