void (boolean isCompletionRunning) { Editor editor = getEditor(context); LookupEx lookup = LookupManager.getActiveLookup(editor); if (lookup != null && !lookupListenerInited.get()) { lookup.addLookupListener(new LookupListener() { @Override public void firstElementShown() { span.get().setAttribute("firstElementShown", System.currentTimeMillis() - completionTimeStarted.get()); } }); lookupListenerInited.set(true); } if (!isCompletionRunning && !CompletionServiceImpl.isPhase(CompletionPhase.CommittingDocuments.class) && !span.isNull()) { if (CompletionServiceImpl.getCurrentCompletionProgressIndicator() == null) { String description = "CompletionServiceImpl.getCurrentCompletionProgressIndicator() is null on " + CompletionServiceImpl.getCompletionPhase(); span.get().setStatus(StatusCode.ERROR, description); actionCallback.reject(description); } else { List<LookupElement> items = CompletionServiceImpl.getCurrentCompletionProgressIndicator().getLookup().getItems(); int size = items.size(); span.get().setAttribute("number", size); span.get().end(); scope.get().close(); context.message("Number of elements: " + size, getLine()); Path dir = getCompletionItemsDir(); if (dir != null) { dumpCompletionVariants(items, dir); } actionCallback.setDone(); } Disposer.dispose(listenerDisposable); } }