Skip to content

Commit ab067fe

Browse files
committed
migrate all index key collectors to project filtering ones
1 parent 67bcad1 commit ab067fe

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/fr/adrienbrault/idea/symfony2plugin/stubs/ContainerCollectionResolver.java

+13-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.intellij.openapi.project.Project;
55
import com.intellij.psi.search.GlobalSearchScope;
66
import com.intellij.util.indexing.FileBasedIndexImpl;
7-
import fr.adrienbrault.idea.symfony2plugin.Symfony2InterfacesUtil;
87
import fr.adrienbrault.idea.symfony2plugin.config.component.parser.ParameterServiceParser;
98
import fr.adrienbrault.idea.symfony2plugin.dic.ContainerParameter;
109
import fr.adrienbrault.idea.symfony2plugin.dic.ContainerService;
@@ -147,7 +146,10 @@ public Map<String, ContainerService> getServices() {
147146
}
148147

149148
if(this.sources.contains(Source.INDEX)) {
150-
for(String serviceName: FileBasedIndexImpl.getInstance().getAllKeys(ServicesDefinitionStubIndex.KEY, project)) {
149+
SymfonyProcessors.CollectProjectUniqueKeysStrong projectUniqueKeysStrong = new SymfonyProcessors.CollectProjectUniqueKeysStrong(project, ServicesDefinitionStubIndex.KEY, this.services.keySet());
150+
FileBasedIndexImpl.getInstance().processAllKeys(ServicesDefinitionStubIndex.KEY, projectUniqueKeysStrong, project);
151+
152+
for(String serviceName: projectUniqueKeysStrong.getResult()) {
151153

152154
// we have higher priority on compiler, which already has safe value
153155
if(!this.services.containsKey(serviceName)) {
@@ -239,7 +241,9 @@ private Set<String> getNames() {
239241
}
240242

241243
if(this.sources.contains(Source.INDEX)) {
242-
serviceNames.addAll(FileBasedIndexImpl.getInstance().getAllKeys(ServicesDefinitionStubIndex.KEY, project));
244+
SymfonyProcessors.CollectProjectUniqueKeysStrong projectUniqueKeysStrong = new SymfonyProcessors.CollectProjectUniqueKeysStrong(project, ServicesDefinitionStubIndex.KEY, serviceNames);
245+
FileBasedIndexImpl.getInstance().processAllKeys(ServicesDefinitionStubIndex.KEY, projectUniqueKeysStrong, project);
246+
serviceNames.addAll(projectUniqueKeysStrong.getResult());
243247
}
244248

245249
return serviceNames;
@@ -314,8 +318,10 @@ private Map<String, ContainerParameter> getParameters() {
314318
}
315319

316320
if(this.sources.contains(Source.INDEX)) {
321+
SymfonyProcessors.CollectProjectUniqueKeysStrong projectUniqueKeysStrong = new SymfonyProcessors.CollectProjectUniqueKeysStrong(project, ContainerParameterStubIndex.KEY, this.containerParameterMap.keySet());
322+
FileBasedIndexImpl.getInstance().processAllKeys(ContainerParameterStubIndex.KEY, projectUniqueKeysStrong, project);
317323

318-
for(String parameterName: FileBasedIndexImpl.getInstance().getAllKeys(ContainerParameterStubIndex.KEY, project)) {
324+
for(String parameterName: projectUniqueKeysStrong.getResult()) {
319325

320326
// indexes is weak stuff, dont overwrite compiled ones
321327
if(!this.containerParameterMap.containsKey(parameterName)) {
@@ -354,7 +360,9 @@ private Set<String> getNames() {
354360
}
355361

356362
if(this.sources.contains(Source.INDEX)) {
357-
parameterNames.addAll(FileBasedIndexImpl.getInstance().getAllKeys(ContainerParameterStubIndex.KEY, project));
363+
SymfonyProcessors.CollectProjectUniqueKeysStrong projectUniqueKeysStrong = new SymfonyProcessors.CollectProjectUniqueKeysStrong(project, ContainerParameterStubIndex.KEY, parameterNames);
364+
FileBasedIndexImpl.getInstance().processAllKeys(ContainerParameterStubIndex.KEY, projectUniqueKeysStrong, project);
365+
parameterNames.addAll(projectUniqueKeysStrong.getResult());
358366
}
359367

360368
return parameterNames;

src/fr/adrienbrault/idea/symfony2plugin/translation/dict/TranslationUtil.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import com.intellij.util.Processor;
1313
import com.intellij.util.indexing.FileBasedIndexImpl;
1414
import com.jetbrains.php.PhpIndex;
15+
import fr.adrienbrault.idea.symfony2plugin.stubs.SymfonyProcessors;
16+
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.ServicesDefinitionStubIndex;
1517
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.YamlTranslationStubIndex;
1618
import fr.adrienbrault.idea.symfony2plugin.translation.TranslationIndex;
1719
import fr.adrienbrault.idea.symfony2plugin.translation.TranslatorLookupElement;
@@ -181,8 +183,11 @@ public static List<LookupElement> getTranslationDomainLookupElements(Project pro
181183
lookupElements.add(new TranslatorLookupElement(domainKey, domainKey));
182184
}
183185

186+
SymfonyProcessors.CollectProjectUniqueKeysStrong projectUniqueKeysStrong = new SymfonyProcessors.CollectProjectUniqueKeysStrong(project, YamlTranslationStubIndex.KEY, domainList);
187+
FileBasedIndexImpl.getInstance().processAllKeys(YamlTranslationStubIndex.KEY, projectUniqueKeysStrong, project);
188+
184189
// attach index domains as weak one
185-
for(String domainKey: FileBasedIndexImpl.getInstance().getAllKeys(YamlTranslationStubIndex.KEY, project)) {
190+
for(String domainKey: projectUniqueKeysStrong.getResult()) {
186191
if(!domainList.contains(domainKey)) {
187192
lookupElements.add(new TranslatorLookupElement(domainKey, domainKey, true));
188193
}

0 commit comments

Comments
 (0)