void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { PsiFile file = parameters.getOriginalFile(); Project project = file.getProject(); Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document == null) return; Supplier<Iterable<Change>> changesSupplier = document.getUserData(CommitMessage.CHANGES_SUPPLIER_KEY); if (changesSupplier == null) return; result.stopHere(); int count = parameters.getInvocationCount(); Iterator<Change> changeIterator = changesSupplier.get().iterator(); if (!changeIterator.hasNext()) return; String prefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters); if (count == 0 && prefix.length() < 5) { result.restartCompletionOnPrefixChange(StandardPatterns.string().withLength(5)); return; } CompletionResultSet resultSet = result.caseInsensitive().withPrefixMatcher( count == 0 ? new PlainPrefixMatcher(prefix, true) : new CamelHumpMatcher(prefix)); CompletionResultSet prefixed = result.withPrefixMatcher(new PlainPrefixMatcher(prefix, count == 0)); while (changeIterator.hasNext()) { ProgressManager.checkCanceled(); Change change = changeIterator.next(); FilePath beforePath = ChangesUtil.getBeforePath(change); FilePath afterPath = ChangesUtil.getAfterPath(change); if (afterPath != null) { addFilePathName(project, resultSet, afterPath, false); addLanguageSpecificElements(project, count, prefixed, afterPath); } if (beforePath != null) { if (afterPath == null || !beforePath.getName().equals(afterPath.getName())) { addFilePathName(project, resultSet, beforePath, true); } } } }