Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove paid / deprecated extensions from public repository #1958

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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
Expand Up @@ -262,12 +262,10 @@ public static void visitRenderTemplateFunctions(@NotNull PsiElement context, @No
private static class TemplateRenderPsiRecursiveElementWalkingVisitor extends PsiRecursiveElementWalkingVisitor {
private final PsiElement context;
private final Consumer<Triple<String, PhpNamedElement, FunctionReference>> consumer;
private Set<String> methods;

TemplateRenderPsiRecursiveElementWalkingVisitor(PsiElement context, Consumer<Triple<String, PhpNamedElement, FunctionReference>> consumer) {
this.context = context;
this.consumer = consumer;
methods = null;
}

@Override
Expand Down Expand Up @@ -312,22 +310,7 @@ private void visitMethodReference(@NotNull MethodReference methodReference) {
return;
}

// init methods once per file
if(methods == null) {
methods = new HashSet<>();

PluginConfigurationExtension[] extensions = Symfony2ProjectComponent.PLUGIN_CONFIGURATION_EXTENSION.getExtensions();
if(extensions.length > 0) {
PluginConfigurationExtensionParameter pluginConfiguration = new PluginConfigurationExtensionParameter(context.getProject());
for (PluginConfigurationExtension extension : extensions) {
extension.invokePluginConfiguration(pluginConfiguration);
}

methods.addAll(pluginConfiguration.getTemplateUsageMethod());
}
}

if(!methods.contains(methodName) && !methodName.toLowerCase().contains("render")) {
if (!methodName.toLowerCase().contains("render")) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ public enum NamespaceType {
"fr.adrienbrault.idea.symfony2plugin.extension.TwigNamespaceExtension"
);

public static final ExtensionPointName<TwigFileUsage> TWIG_FILE_USAGE_EXTENSIONS = new ExtensionPointName<>(
"fr.adrienbrault.idea.symfony2plugin.extension.TwigFileUsage"
);

private static final Key<CachedValue<Map<String, Set<VirtualFile>>>> TEMPLATE_CACHE_TWIG = new Key<>("TEMPLATE_CACHE_TWIG");

private static final Key<CachedValue<Map<String, Set<VirtualFile>>>> TEMPLATE_CACHE_ALL = new Key<>("TEMPLATE_CACHE_ALL");
Expand Down Expand Up @@ -2373,14 +2369,6 @@ public static void visitTemplateIncludes(@NotNull PsiElement psiElement, @NotNul
}
}
}

for (TwigFileUsage extension : TWIG_FILE_USAGE_EXTENSIONS.getExtensions()) {
if (extension.isIncludeTemplate(psiElement)) {
for (String template : extension.getIncludeTemplate(psiElement)) {
consumer.consume(new TemplateInclude(psiElement, template, TemplateInclude.TYPE.INCLUDE));
}
}
}
}
}

Expand Down Expand Up @@ -2833,16 +2821,6 @@ public void visitElement(PsiElement element) {
}
}

for (TwigFileUsage extension : TWIG_FILE_USAGE_EXTENSIONS.getExtensions()) {
if (!extension.isExtendsTemplate(element)) {
continue;
}

for (String template : extension.getExtendsTemplate(element)) {
consumer.consume(Pair.create(TwigUtil.normalizeTemplateName(template), element));
}
}

super.visitElement(element);
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fr.adrienbrault.idea.symfony2plugin.translation.dict;

import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -51,14 +50,12 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @author Daniel Espendiller <daniel@espendiller.net>
*/
public class TranslationUtil {
private static final ExtensionPointName<TranslatorProvider> TRANSLATION_PROVIDER = new ExtensionPointName<>("fr.adrienbrault.idea.symfony2plugin.extension.TranslatorProvider");
public static final TranslatorProvider[] INTERNAL_TRANSLATOR_PROVIDERS = new TranslatorProvider[]{
private static final TranslatorProvider[] INTERNAL_TRANSLATOR_PROVIDERS = new TranslatorProvider[]{
new CompiledContainerTranslatorProvider(),
new CompiledTranslatorProvider(),
new IndexTranslatorProvider(),
Expand Down Expand Up @@ -399,10 +396,7 @@ public static Set<String> getPlaceholderFromTranslation(@NotNull String text) {

@NotNull
private static TranslatorProvider[] getTranslationProviders() {
return Stream.concat(
Arrays.stream(INTERNAL_TRANSLATOR_PROVIDERS),
Arrays.stream(TRANSLATION_PROVIDER.getExtensions())
).toArray(TranslatorProvider[]::new);
return INTERNAL_TRANSLATOR_PROVIDERS;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ private boolean hasFileExtendsTag(@NotNull PsiElement element) {
if (child instanceof TwigExtendsTag) {
return true;
}

for (TwigFileUsage extension : TwigUtil.TWIG_FILE_USAGE_EXTENSIONS.getExtensions()) {
if (extension.isExtendsTemplate(child)) {
return true;
}
}
}

return false;
Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/META-INF/pay.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<!-- All feature that are only available via valid plugin license (paid) -->
<idea-plugin url="https://www.jetbrains.com/idea">

<extensionPoints>
<extensionPoint dynamic="true" name="extension.PluginConfigurationExtension" interface="fr.adrienbrault.idea.symfony2plugin.extension.PluginConfigurationExtension"/>
<extensionPoint dynamic="true" name="extension.TwigFileUsage" interface="fr.adrienbrault.idea.symfony2plugin.extension.TwigFileUsage"/>
<extensionPoint dynamic="true" name="extension.TranslatorProvider" interface="fr.adrienbrault.idea.symfony2plugin.extension.TranslatorProvider"/>

</extensionPoints>

</idea-plugin>