Search in sources :

Example 1 with ConceptStaticArg

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));
        }
    }
}
Also used : ConceptStaticArg(com.thoughtworks.gauge.language.psi.ConceptStaticArg) PlainPrefixMatcher(com.intellij.codeInsight.completion.PlainPrefixMatcher)

Aggregations

PlainPrefixMatcher (com.intellij.codeInsight.completion.PlainPrefixMatcher)1 ConceptStaticArg (com.thoughtworks.gauge.language.psi.ConceptStaticArg)1