diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/asset/AssetDirectoryReader.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/asset/AssetDirectoryReader.java index c7c503223..33d27f2f0 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/asset/AssetDirectoryReader.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/asset/AssetDirectoryReader.java @@ -54,6 +54,25 @@ private static Collection getProjectAssetRoot(@NotNull Project proj paths.add("public"); // latest Symfony structure paths.add("web"); // old Symfony structure + // find asset mapper files + for (VirtualFile file : FilenameIndex.getVirtualFilesByName("installed.php", GlobalSearchScope.allScope(project))) { + // composer + VirtualFile parent = file.getParent(); + if (parent == null || !"vendor".equals(parent.getName())) { + continue; + } + + VirtualFile assetFolder = parent.getParent(); + if (assetFolder == null) { + continue; + } + + String relativePath = VfsUtil.getRelativePath(assetFolder, ProjectUtil.getProjectDir(project), '/'); + if (relativePath != null) { + paths.add(relativePath); + } + } + return paths.stream() .map(path -> VfsUtil.findRelativeFile(ProjectUtil.getProjectDir(project), path.split("/"))) .filter(Objects::nonNull)