From eba63d9dba40d79e4f5ad37e232fbf11e1a2fabc Mon Sep 17 00:00:00 2001 From: Viktor Sidochenko Date: Thu, 24 Oct 2019 14:50:12 +0700 Subject: [PATCH] Resolve fragments only if needed --- .../plugins/cucumber/steps/AbstractCucumberExtension.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gherkin-tag/src/org/jetbrains/plugins/cucumber/steps/AbstractCucumberExtension.java b/gherkin-tag/src/org/jetbrains/plugins/cucumber/steps/AbstractCucumberExtension.java index 52e211b..3cfb1f1 100644 --- a/gherkin-tag/src/org/jetbrains/plugins/cucumber/steps/AbstractCucumberExtension.java +++ b/gherkin-tag/src/org/jetbrains/plugins/cucumber/steps/AbstractCucumberExtension.java @@ -30,7 +30,10 @@ public List resolveStep(@NotNull final PsiElement element) { } final List result = new ArrayList<>(); - result.addAll(getFragment(stepVariant, module)); + boolean isFragment = element instanceof GherkinStep && ((GherkinStep) element).findDefinitions().stream().allMatch(AbstractStepDefinition::isFragment); + if (isFragment) { + result.addAll(getFragment(stepVariant, module)); + } result.addAll(getStepDefinitions(stepVariant, element, module)); result.addAll(getTagEntities(stepVariant, element, module));