use of com.intellij.codeInsight.completion.PlainPrefixMatcher 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);
}
}
}
use of com.intellij.codeInsight.completion.PlainPrefixMatcher in project intellij-community by JetBrains.
the class ListTemplatesHandler method showTemplatesLookup.
private static void showTemplatesLookup(final Project project, final Editor editor, final PsiFile file, @NotNull Map<TemplateImpl, String> matchingTemplates, @NotNull MultiMap<String, CustomLiveTemplateLookupElement> customTemplatesLookupElements) {
LookupImpl lookup = (LookupImpl) LookupManager.getInstance(project).createLookup(editor, LookupElement.EMPTY_ARRAY, "", new TemplatesArranger());
for (Map.Entry<TemplateImpl, String> entry : matchingTemplates.entrySet()) {
TemplateImpl template = entry.getKey();
lookup.addItem(createTemplateElement(template), new PlainPrefixMatcher(StringUtil.notNullize(entry.getValue())));
}
for (Map.Entry<String, Collection<CustomLiveTemplateLookupElement>> entry : customTemplatesLookupElements.entrySet()) {
for (CustomLiveTemplateLookupElement lookupElement : entry.getValue()) {
lookup.addItem(lookupElement, new PlainPrefixMatcher(entry.getKey()));
}
}
showLookup(lookup, file);
}
use of com.intellij.codeInsight.completion.PlainPrefixMatcher 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));
}
}
}
use of com.intellij.codeInsight.completion.PlainPrefixMatcher in project Intellij-Plugin by getgauge.
the class ConceptDynamicArgCompletionProvider method addCompletions.
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
Collection<ConceptDynamicArg> args = PsiTreeUtil.collectElementsOfType(parameters.getOriginalFile(), ConceptDynamicArg.class);
for (ConceptDynamicArg arg : args) {
LookupElementBuilder item = LookupElementBuilder.create(arg.getText().replaceAll("<|>", ""));
resultSet.addElement(item);
}
}
Aggregations