how to find the Module of a VirtualFile?

I've a VirtualFileEvent from VirtualFileManager.getInstance.addVirtualFileListener() but I can't trace the Module for the VirtualFile, searching on these forums revealed no
good way, so what's the best way to find the Module? I know the VirtualFile can be outside of a Module, so a null in that case is ok.

1 comment
Comment actions Permalink
final Module module = ModuleUtil.findModuleForFile(virtualFile, project);

If file does not belong to any module in given project, then You will recieve null.


Please sign in to leave a comment.