public static @NotNull ModPsiNavigator asPsiNavigator(@NotNull Editor editor) {
    return new ModPsiNavigator() {
      @Override
      public void select(@NotNull PsiElement element) {
        select(element.getTextRange());
      }

      @Override
      public void select(@NotNull TextRange range) {
        editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
      }

      @Override
      public void moveCaretTo(int offset) {
        editor.getCaretModel().moveToOffset(offset);
      }

      @Override
      public void moveCaretTo(@NotNull PsiElement element) {
        moveCaretTo(element.getTextRange().getStartOffset());
      }

      @Override
      public int getCaretOffset() {
        return editor.getCaretModel().getOffset();
      }
    };
  }
public static @NotNull ModPsiNavigator asPsiNavigator(@NotNull Editor editor)