TextRange (@NotNull Caret caret, @NotNull Project project) { ThrowableComputable<TextRange, Exception> computable = () -> { return ReadAction.compute(() -> { return doSelectWord(caret, project); }); }; try { return ProgressManager.getInstance().runProcessWithProgressSynchronously(computable, EditorBundle.message("select.word.progress"), true, project); } catch (ProcessCanceledException pce) { return null; } catch (Exception e) { LOG.error("Cannot select word at given offset", e); return null; } }