@Test public void addRemainingCompletions() { testHelper.runInReadAction( project -> { TestCompletionResultSet mutate = new TestCompletionResultSet(); List<String> namesToReplace = new ArrayList<>(); namesToReplace.add("one"); namesToReplace.add("other"); new ReplacingConsumer(namesToReplace, mutate, (context, item) -> {}) .addRemainingCompletions(project); assertThat(mutate.elements).hasSize(2); assertThat(mutate.elements.get(0).getLookupString()).isEqualTo("other"); assertThat(mutate.elements.get(1).getLookupString()).isEqualTo("one"); }); }
void addRemainingCompletions(Project project) { for (String qualifiedName : replacedQualifiedNames) { result.addElement( PrioritizedLookupElement.withPriority( SpecLookupElement.create(qualifiedName, project, insertHandler), Integer.MAX_VALUE)); } }
ReplacingConsumer implements Consumer<CompletionResult> { void addRemainingCompletions(Project project) { for (String qualifiedName : replacedQualifiedNames) { result.addElement( PrioritizedLookupElement.withPriority( SpecLookupElement.create(qualifiedName, project, insertHandler), Integer.MAX_VALUE)); } } }
ReplacingConsumer implements Consumer<CompletionResult> { void addRemainingCompletions(Project project) { for (String qualifiedName : replacedQualifiedNames) { result.addElement( PrioritizedLookupElement.withPriority( SpecLookupElement.create(qualifiedName, project, insertHandler), Integer.MAX_VALUE)); } } ReplacingConsumer(
      Collection<String> replacedQualifiedNames,
      CompletionResultSet result,
      InsertHandler<LookupElement> insertHandler); }
ReplacingConsumer implements Consumer<CompletionResult> { void addRemainingCompletions(Project project) { for (String qualifiedName : replacedQualifiedNames) { result.addElement( PrioritizedLookupElement.withPriority( SpecLookupElement.create(qualifiedName, project, insertHandler), Integer.MAX_VALUE)); } } ReplacingConsumer(
      Collection<String> replacedQualifiedNames,
      CompletionResultSet result,
      InsertHandler<LookupElement> insertHandler); @Override void consume(CompletionResult completionResult); }
ReplacingConsumer implements Consumer<CompletionResult> { void addRemainingCompletions(Project project) { for (String qualifiedName : replacedQualifiedNames) { result.addElement( PrioritizedLookupElement.withPriority( SpecLookupElement.create(qualifiedName, project, insertHandler), Integer.MAX_VALUE)); } } ReplacingConsumer(
      Collection<String> replacedQualifiedNames,
      CompletionResultSet result,
      InsertHandler<LookupElement> insertHandler); @Override void consume(CompletionResult completionResult);  }