Vfs listener is not notified.
已回答
Hi,
I tried to use
VirtualFileManager.getInstance().addAsyncFileListener
to listen to VFS change events. But the listener is not getting events unless I save manually by ctrl+s.
I compared with Git which will get changes almost immediately. And I think Git use `addAsyncFileListener` as well.
Does anyone know the reason?
请先登录再写评论。
VFS does not reflect every change in editor.
You can subscribe for DocumentListener multicaster, <editorFactoryDocumentListener implementation=.../>.
But why Git can get events immediately? Does it use `DocumentListener` as well?
Yes it does.
Like you said that VFS does not reflect every change in editor, how does Git can be notified almost immediately?
Like I said, by listening to DocumentListener and some other events (such as explicit notifications after performing vcs actions from IDE).
If you're interested in details, you can track VcsDirtyScopeManager usages, starting with FileStatusManagerImpl.FileStatusManagerDocumentListener and VcsDirtyScopeVfsListener.