19
19
import org .jetbrains .annotations .NotNull ;
20
20
21
21
import java .util .ArrayList ;
22
+ import java .util .List ;
22
23
23
24
public class SymfonyBundleFileCompletionProvider extends CompletionProvider <CompletionParameters > {
24
25
25
- private String path ;
26
+ private String [] paths ;
26
27
27
- public SymfonyBundleFileCompletionProvider (String path ) {
28
- this .path = path ;
28
+ public SymfonyBundleFileCompletionProvider (String ... paths ) {
29
+ this .paths = paths ;
29
30
}
30
31
31
32
@ Override
@@ -38,22 +39,12 @@ protected void addCompletions(@NotNull CompletionParameters completionParameters
38
39
PhpIndex phpIndex = PhpIndex .getInstance (completionParameters .getPosition ().getProject ());
39
40
40
41
SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil (phpIndex );
41
- ArrayList <BundleFile > bundleFiles = new ArrayList <BundleFile >();
42
+ List <BundleFile > bundleFiles = new ArrayList <BundleFile >();
42
43
43
44
for (SymfonyBundle symfonyBundle : symfonyBundleUtil .getBundles ()) {
44
-
45
- VirtualFile virtualFile = symfonyBundle .getRelative (this .path );
46
- if (virtualFile != null ) {
47
- final BundleContentIterator bundleContentIterator = new BundleContentIterator (symfonyBundle , bundleFiles , completionParameters .getPosition ().getProject ());
48
- VfsUtil .visitChildrenRecursively (virtualFile , new VirtualFileVisitor () {
49
- @ Override
50
- public boolean visitFile (@ NotNull VirtualFile virtualFile ) {
51
- bundleContentIterator .processFile (virtualFile );
52
- return super .visitFile (virtualFile );
53
- }
54
- });
45
+ for (String path : this .paths ) {
46
+ visitPath (completionParameters , bundleFiles , symfonyBundle , path );
55
47
}
56
-
57
48
}
58
49
59
50
for (BundleFile bundleFile : bundleFiles ) {
@@ -62,13 +53,31 @@ public boolean visitFile(@NotNull VirtualFile virtualFile) {
62
53
63
54
}
64
55
56
+ private void visitPath (CompletionParameters completionParameters , List <BundleFile > bundleFiles , SymfonyBundle symfonyBundle , String path ) {
57
+
58
+ VirtualFile virtualFile = symfonyBundle .getRelative (path );
59
+ if (virtualFile == null ) {
60
+ return ;
61
+ }
62
+
63
+ final BundleContentIterator bundleContentIterator = new BundleContentIterator (symfonyBundle , bundleFiles , completionParameters .getPosition ().getProject ());
64
+ VfsUtil .visitChildrenRecursively (virtualFile , new VirtualFileVisitor () {
65
+ @ Override
66
+ public boolean visitFile (@ NotNull VirtualFile virtualFile ) {
67
+ bundleContentIterator .processFile (virtualFile );
68
+ return super .visitFile (virtualFile );
69
+ }
70
+ });
71
+
72
+ }
73
+
65
74
private class BundleContentIterator implements ContentIterator {
66
75
67
76
private SymfonyBundle symfonyBundle ;
68
- private ArrayList <BundleFile > bundleFiles ;
77
+ private List <BundleFile > bundleFiles ;
69
78
private Project project ;
70
79
71
- public BundleContentIterator (SymfonyBundle symfonyBundle , ArrayList <BundleFile > bundleFiles , Project project ) {
80
+ public BundleContentIterator (SymfonyBundle symfonyBundle , List <BundleFile > bundleFiles , Project project ) {
72
81
this .symfonyBundle = symfonyBundle ;
73
82
this .bundleFiles = bundleFiles ;
74
83
this .project = project ;
0 commit comments