Skip to content
Merged
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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ before_install:
- "export ORG_GRADLE_PROJECT_annotationPluginVersion=${ANNOTATION_PLUGIN_VERSION}"

env:
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2019.1.3" PHP_PLUGIN_VERSION="191.7141.52" TWIG_PLUGIN_VERSION="191.6183.95" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" DQL_PLUGIN_VERSION="191.5849.16"
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2019.2" PHP_PLUGIN_VERSION="192.5728.108" TWIG_PLUGIN_VERSION="192.5728.26" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" DQL_PLUGIN_VERSION="192.5728.12"

script:
Expand Down
82 changes: 26 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,67 +31,37 @@ targetCompatibility = 1.8

apply plugin: 'org.jetbrains.intellij'

if (ideaVersion == "IU-2019.1.3") {
intellij {
version ideaVersion
updateSinceUntilBuild false
plugins = [
"com.jetbrains.php:${phpPluginVersion}",
"com.jetbrains.twig:${twigPluginVersion}",
"com.jetbrains.php.dql:${dqlPluginVersion}",
"de.espend.idea.php.annotation:${annotationPluginVersion}",
"de.espend.idea.php.toolbox:${toolboxPluginVersion}",
'coverage',
'webDeployment',
'yaml',
'CSS',
'java-i18n',
'properties',
'xpath'
]
pluginName 'Symfony Support'

// Can't instantiate configurable for PHP Toolbox
// at de.espend.idea.php.toolbox.ui.application.ToolboxApplicationForm.<init>(ToolboxApplicationForm.java:26)
tasks {
"buildSearchableOptions" {
enabled = false
}
}
}
} else {
intellij {
version ideaVersion
updateSinceUntilBuild false
plugins = [
"com.jetbrains.php:${phpPluginVersion}",
"com.jetbrains.twig:${twigPluginVersion}",
"com.jetbrains.php.dql:${dqlPluginVersion}",
"de.espend.idea.php.annotation:${annotationPluginVersion}",
"de.espend.idea.php.toolbox:${toolboxPluginVersion}",
'coverage',
'webDeployment',
'yaml',
'CSS',
'java-i18n',
'properties',
'xpath',
'java'
]
pluginName 'Symfony Support'

// Can't instantiate configurable for PHP Toolbox
// at de.espend.idea.php.toolbox.ui.application.ToolboxApplicationForm.<init>(ToolboxApplicationForm.java:26)
tasks {
"buildSearchableOptions" {
enabled = false
}
intellij {
version ideaVersion
updateSinceUntilBuild false
plugins = [
"com.jetbrains.php:${phpPluginVersion}",
"com.jetbrains.twig:${twigPluginVersion}",
"com.jetbrains.php.dql:${dqlPluginVersion}",
"de.espend.idea.php.annotation:${annotationPluginVersion}",
"de.espend.idea.php.toolbox:${toolboxPluginVersion}",
'coverage',
'webDeployment',
'yaml',
'CSS',
'java-i18n',
'properties',
'xpath',
'java'
]
pluginName 'Symfony Support'

// Can't instantiate configurable for PHP Toolbox
// at de.espend.idea.php.toolbox.ui.application.ToolboxApplicationForm.<init>(ToolboxApplicationForm.java:26)
tasks {
"buildSearchableOptions" {
enabled = false
}
}
}

patchPluginXml {
sinceBuild '191'
sinceBuild '192'
changeNotes = htmlFixer('src/main/resources/META-INF/change-notes.html')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ public DataIndexer<String, Set<String>, FileContent> getIndexer() {
}

for(PsiElement psiElement : PsiTreeUtil.getChildrenOfAnyType(psiFile, TwigExtendsTag.class, TwigCompositeElement.class)) {
if (psiElement instanceof TwigExtendsTag) {
// {% extends 'foo.html.twig' %}
for (String templateName : TwigUtil.getTwigExtendsTagTemplates((TwigExtendsTag) psiElement)) {
blocks.putIfAbsent("extends", new HashSet<>());
blocks.get("extends").add(TwigUtil.normalizeTemplateName(templateName));
}
} else if(psiElement instanceof TwigCompositeElement) {
if(psiElement instanceof TwigCompositeElement) {
// {% use 'foo.html.twig' %}
if(psiElement.getNode().getElementType() == TwigElementTypes.TAG) {
psiElement.acceptChildren(new PsiRecursiveElementWalkingVisitor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.intellij.util.indexing.FileBasedIndex;
import com.jetbrains.twig.TwigFile;
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.TwigBlockIndexExtension;
import fr.adrienbrault.idea.symfony2plugin.stubs.indexes.TwigExtendsStubIndex;
import fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -52,20 +53,21 @@ private static void visitParentFiles(@NotNull PsiFile file, int depth, Collectio
}

Set<VirtualFile> myVirtualFiles = new HashSet<>();
Set<String> templates = new HashSet<>();

for (String s : new String[]{"extends", "use"}) {
Set<String> templates = new HashSet<>();
FileBasedIndex.getInstance()
.getValues(TwigBlockIndexExtension.KEY, "use", GlobalSearchScope.fileScope(file))
.forEach(templates::addAll);

FileBasedIndex.getInstance()
.getValues(TwigBlockIndexExtension.KEY, s, GlobalSearchScope.fileScope(file))
.forEach(templates::addAll);
FileBasedIndex.getInstance()
.getFileData(TwigExtendsStubIndex.KEY, file.getVirtualFile(), file.getProject())
.forEach((templateName, aVoid) -> templates.add(templateName));

for (String template : templates) {
for (VirtualFile virtualFile : TwigUtil.getTemplateFiles(file.getProject(), template)) {
if (!virtualFiles.contains(virtualFile)) {
myVirtualFiles.add(virtualFile);
virtualFiles.add(virtualFile);
}
for (String template : templates) {
for (VirtualFile virtualFile : TwigUtil.getTemplateFiles(file.getProject(), template)) {
if (!virtualFiles.contains(virtualFile)) {
myVirtualFiles.add(virtualFile);
virtualFiles.add(virtualFile);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public void testThatValuesAreInIndex() {
assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "block", value -> !value.contains("right_teaser"));
assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "block", value -> !value.contains("foobar_print_embed"));

assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "extends", value -> value.contains("extends/foo.html.twig"));
assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "use", value -> value.contains("use/foo.html.twig"));

assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "extends", value -> !value.contains("embed_extends/foo.html.twig"));
assertIndexContainsKeyWithValue(TwigBlockIndexExtension.KEY, "use", value -> !value.contains("embed_use/foo.html.twig"));
}
}