Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fr.adrienbrault.idea.symfony2plugin.extension;

import org.jetbrains.annotations.NotNull;

/**
* @author Daniel Espendiller <daniel@espendiller.net>
*/
public interface ServiceParameterCollector {
/**
* Warning expect high traffic, collector needs to be highly optimized
*/
void collectIds(@NotNull ServiceParameterCollectorParameter.Id parameter);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package fr.adrienbrault.idea.symfony2plugin.extension;

import com.intellij.openapi.project.Project;
import fr.adrienbrault.idea.symfony2plugin.dic.ContainerParameter;
import fr.adrienbrault.idea.symfony2plugin.dic.container.SerializableService;
import fr.adrienbrault.idea.symfony2plugin.dic.container.ServiceInterface;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;

/**
* @author Daniel Espendiller <daniel@espendiller.net>
*/
public class ServiceParameterCollectorParameter {
public static class Id {

@NotNull
private final Project project;

@NotNull
private final Collection<ContainerParameter> ids;

public Id(@NotNull Project project, @NotNull Collection<ContainerParameter> ids) {
this.project = project;
this.ids = ids;
}

@NotNull
public Project getProject() {
return project;
}

public void add(@NotNull ContainerParameter id) {
this.ids.add(id);
}

public void addAll(@NotNull Collection<ContainerParameter> names) {
this.ids.addAll(names);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import fr.adrienbrault.idea.symfony2plugin.dic.container.ServiceSerializable;
import fr.adrienbrault.idea.symfony2plugin.dic.container.dict.ContainerBuilderCall;
import fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollectorParameter;
import fr.adrienbrault.idea.symfony2plugin.extension.ServiceParameterCollector;
import fr.adrienbrault.idea.symfony2plugin.extension.ServiceParameterCollectorParameter;
import fr.adrienbrault.idea.symfony2plugin.stubs.cache.FileIndexCaches;
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.ContainerBuilderStubIndex;
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.ContainerParameterStubIndex;
Expand Down Expand Up @@ -41,6 +43,10 @@ public class ContainerCollectionResolver {
"fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollector"
);

private static final ExtensionPointName<fr.adrienbrault.idea.symfony2plugin.extension.ServiceParameterCollector> EXTENSIONS_PARAMETER = new ExtensionPointName<>(
"fr.adrienbrault.idea.symfony2plugin.extension.ServiceParameterCollector"
);

public static Collection<String> getServiceNames(@NotNull Project project) {
return ServiceCollector.create(project).getNames();
}
Expand Down Expand Up @@ -456,6 +462,21 @@ private Map<String, ContainerParameter> getParameters() {
this.containerParameterMap.put(parameterName, new ContainerParameter(parameterName, true));
}

// Extension points
ServiceParameterCollectorParameter.Id parameter = null;
Collection<ContainerParameter> exps = new ArrayList<>();
for (ServiceParameterCollector parameterCollector : EXTENSIONS_PARAMETER.getExtensions()) {
if(parameter == null) {
parameter = new ServiceParameterCollectorParameter.Id(project, exps);
}

parameterCollector.collectIds(parameter);
}

for (ContainerParameter extParameter: exps) {
this.containerParameterMap.put(extParameter.getName(), extParameter);
}

return this.containerParameterMap;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@
<extensionPoint name="extension.RoutingLoader" interface="fr.adrienbrault.idea.symfony2plugin.extension.RoutingLoader"/>
<extensionPoint name="extension.CompiledServiceBuilderFactory" interface="fr.adrienbrault.idea.symfony2plugin.extension.CompiledServiceBuilderFactory"/>
<extensionPoint name="extension.ServiceCollector" interface="fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollector"/>
<extensionPoint name="extension.ServiceParameterCollector" interface="fr.adrienbrault.idea.symfony2plugin.extension.ServiceParameterCollector"/>
<extensionPoint name="extension.ServiceDefinitionLocator" interface="fr.adrienbrault.idea.symfony2plugin.extension.ServiceDefinitionLocator"/>
<extensionPoint name="extension.TwigVariableCollector" interface="fr.adrienbrault.idea.symfony2plugin.templating.variable.TwigFileVariableCollector"/>
</extensionPoints>
Expand Down