Skip to content

remove paid / deprecated extensions from public repository #1958

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
@@ -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
@@ -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;
}

Original file line number Diff line number Diff line change
@@ -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");
@@ -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));
}
}
}
}
}

@@ -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);
}
});
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;
@@ -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 <[email protected]>
*/
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(),
@@ -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;
}

/**
Original file line number Diff line number Diff line change
@@ -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;
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>