void (@NotNull CompletionParameters parameters, @NotNull String prefix, @NotNull CompletionResultSet result) { final ProgressManager progressManager = ProgressManager.getInstance(); ProgressIndicator mainIndicator = progressManager.getProgressIndicator(); final ProgressIndicator indicator = mainIndicator != null ? new SensitiveProgressWrapper(mainIndicator) : new EmptyProgressIndicator(); Future<Collection<T>> future = ApplicationManager .getApplication() .executeOnPooledThread(() -> progressManager.runProcess(() -> getItems(prefix, false, parameters), indicator)); while (true) { try { Collection<T> tasks = future.get(100, TimeUnit.MILLISECONDS); if (tasks != null) { addCompletionElements(result, this, tasks, 0); return; } } catch (ProcessCanceledException e) { throw e; } catch (Exception ignore) { } ProgressManager.checkCanceled(); } }