Skip to content

Commit

Permalink
remove paid / deprecated extensions from public repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed Jun 4, 2022
1 parent 9b05fc2 commit 8975aab
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 59 deletions.
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 <[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(),
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>

0 comments on commit 8975aab

Please sign in to comment.