Skip to content

Commit

Permalink
virtual_file_system: mention AsyncFileListener
Browse files Browse the repository at this point in the history
  • Loading branch information
YannCebron committed Jun 3, 2019
1 parent 9f8933b commit cc3f237
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion basics/virtual_file_system.md
Expand Up @@ -55,7 +55,8 @@ Synchronous refreshes can cause deadlocks in some cases, depending on which lock

All changes happening in the virtual file system, either as a result of refresh operations or caused by user's actions, are reported as _virtual file system events_. VFS events are always fired in the event dispatch thread, and in a write action.

The most efficient way to listen to VFS events is to implement the `BulkFileListener` interface and to subscribe with it to the [VirtualFileManager.VFS_CHANGES](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java)<!--#L34--> topic.
The most efficient way to listen to VFS events is to implement the `BulkFileListener` interface and to subscribe with it to the [VirtualFileManager.VFS_CHANGES](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java)<!--#L34--> topic.
A non-blocking variant `AsyncFileListener` is also available in 2019.2 or later.

This API gives you all the changes detected during the refresh operation in one list, and lets you process them in batch. Alternatively, you can implement the `VirtualFileListener` interface and register it using [VirtualFileManager.addVirtualFileListener()](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java)<!--#L113-->. This will let you process the events one by one.

Expand Down

0 comments on commit cc3f237

Please sign in to comment.