use of com.thoughtworks.gauge.language.psi.SpecDetail 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.SpecDetail in project Intellij-Plugin by getgauge.
the class DynamicArgCompletionProvider method addCompletions.
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
SpecDetail specDetail = PsiTreeUtil.getChildOfType(parameters.getOriginalFile(), SpecDetail.class);
if (specDetail == null)
return;
SpecTable table = specDetail.getDataTable();
if (table != null) {
List<String> headers = table.getTableHeader().getHeaders();
for (String header : headers) {
LookupElementBuilder item = LookupElementBuilder.create(header);
resultSet.addElement(item);
}
}
}
Aggregations