use of com.thoughtworks.gauge.language.psi.ConceptStaticArg in project Intellij-Plugin by getgauge.
the class ConceptStaticArgCompletionProvider method addCompletions.
@Override
protected void addCompletions(CompletionParameters parameters, ProcessingContext processingContext, CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
Collection<ConceptStaticArg> staticArgs = PsiTreeUtil.collectElementsOfType(parameters.getOriginalFile(), ConceptStaticArg.class);
for (ConceptStaticArg arg : staticArgs) {
if (arg != null) {
String text = arg.getText().replaceFirst("\"", "");
String textWithoutQuotes = text.substring(0, text.length() - 1);
if (!textWithoutQuotes.equals(""))
resultSet.addElement(LookupElementBuilder.create(textWithoutQuotes));
}
}
}
Aggregations