use of com.thoughtworks.gauge.language.psi.SpecStep in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageForMethodParameter.
@Test
public void TestIsImplicitUsageForMethodParameter() throws Exception {
ModuleHelper helper = mock(ModuleHelper.class);
SpecStep element = mock(SpecStepImpl.class);
PsiParameter parameter = mock(PsiParameterImpl.class);
when(parameter.getDeclarationScope()).thenReturn(element);
when(helper.isGaugeModule(parameter)).thenReturn(true);
boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(parameter);
assertTrue(isUsed);
}
use of com.thoughtworks.gauge.language.psi.SpecStep in project Intellij-Plugin by getgauge.
the class StaticArgCompletionProvider method addCompletions.
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
PsiFile specFile = parameters.getOriginalFile();
SpecDetail specDetail = PsiTreeUtil.getChildOfType(specFile, SpecDetail.class);
List<SpecStep> stepsInFile = new ArrayList<>();
addContextSteps(specDetail, stepsInFile);
addStepsInScenarios(specFile, stepsInFile);
Set<String> staticArgs = getArgsFromSteps(stepsInFile);
for (String arg : staticArgs) {
if (arg != null) {
LookupElementBuilder item = LookupElementBuilder.create(arg);
resultSet.addElement(item);
}
}
}
use of com.thoughtworks.gauge.language.psi.SpecStep in project Intellij-Plugin by getgauge.
the class StaticArgCompletionProvider method getArgsFromSteps.
private Set<String> getArgsFromSteps(List<SpecStep> steps) {
Set<String> staticArgs = new HashSet<>();
for (SpecStep step : steps) {
List<SpecStaticArg> args = step.getStaticArgList();
args.stream().filter(arg -> arg.getText() != null).forEach((arg) -> staticArgs.add(arg.getText()));
}
return staticArgs;
}
use of com.thoughtworks.gauge.language.psi.SpecStep in project Intellij-Plugin by getgauge.
the class SpecInspectionProviderTest method testGetElementReturnsStep.
@Test
public void testGetElementReturnsStep() throws Exception {
SpecStep step = mock(SpecStep.class);
PsiElement element = new SpecInspectionProvider().getElement(step);
assertEquals(step, element);
}
Aggregations