void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { PsiFile file = parameters.getOriginalFile(); TextCompletionProvider provider = TextCompletionUtil.getProvider(file); if (provider == null) return; if (parameters.getInvocationCount() == 0 && !Boolean.TRUE.equals(file.getUserData(TextCompletionUtil.AUTO_POPUP_KEY))) { return; } String advertisement = provider.getAdvertisement(); if (advertisement != null) { result.addLookupAdvertisement(advertisement); } String text = file.getText(); int offset = Math.min(text.length(), parameters.getOffset()); String prefix = provider.getPrefix(text, offset); if (prefix == null) return; CompletionResultSet activeResult = provider.applyPrefixMatcher(result, prefix); provider.fillCompletionVariants(parameters, prefix, activeResult); }