diff --git a/topics/basics/architectural_overview/virtual_file.md b/topics/basics/architectural_overview/virtual_file.md index f361be630..b1bfb4a31 100644 --- a/topics/basics/architectural_overview/virtual_file.md +++ b/topics/basics/architectural_overview/virtual_file.md @@ -1,6 +1,6 @@ [//]: # (title: Virtual Files) - + A [`VirtualFile`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java) (VF) is the IntelliJ Platform's representation of a file in a [Virtual File System (VFS)](virtual_file_system.md). @@ -12,18 +12,18 @@ Contents of a `VirtualFile` are treated as a stream of bytes, but concepts like ## How do I get a virtual file? -From an action -: `e.getData(PlatformDataKeys.VIRTUAL_FILE)` or `e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)` for multiple selection +#### From an Action +`e.getData(PlatformDataKeys.VIRTUAL_FILE)` or `e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)` for multiple selection -From a path in the local file system: -: - `LocalFileSystem.getInstance().findFileByIoFile()` +#### From Path in Local File System +- `LocalFileSystem.getInstance().findFileByIoFile()` - `VirtualFileManager.findFileByNioPath()`/`refreshAndFindFileByNioPath()` (2020.2 and later) -From a PSI file -: `psiFile.getVirtualFile()` (may return `null` if the PSI file exists only in memory) +#### From a PSI File +`psiFile.getVirtualFile()` (may return `null` if the PSI file exists only in memory) -From a document -: `FileDocumentManager.getInstance().getFile()` +#### From a Document +`FileDocumentManager.getInstance().getFile()` ## What can I do with it? @@ -91,4 +91,4 @@ To hook into operations performed in the local file system (for example, when de ## What are the rules for working with VFS? -See [Virtual File System](virtual_file_system.md) for a detailed description of the VFS architecture and usage guidelines. \ No newline at end of file +See [Virtual File System](virtual_file_system.md) for a detailed description of the VFS architecture and usage guidelines.