LightweightHint (Project project, Editor editor, @HintText String text) { LightweightHint[] result = {null}; EditorHintListener listener = new EditorHintListener() { @Override public void hintShown(@NotNull Editor editor, @NotNull LightweightHint hint, int flags, @NotNull HintHint hintInfo) { result[0] = hint; } }; SimpleMessageBusConnection connection = project.getMessageBus().simpleConnect(); try { connection.subscribe(EditorHintListener.TOPIC, listener); assert text != null; myEmptyCompletionNotifier.showIncompleteHint(editor, text, DumbService.isDumb(project)); } finally { connection.disconnect(); } return result[0]; }