String (@NotNull Editor editor) { List<TagInfo> points = new ArrayList<>(); points.add(new TagInfo<>(editor.getCaretModel().getOffset(), true, "caret")); if (editor.getSelectionModel().hasSelection()) { points.add(new TagInfo<>(editor.getSelectionModel().getSelectionStart(), true, "selection")); points.add(new TagInfo<>(editor.getSelectionModel().getSelectionEnd(), false, "selection")); } return insertTagsInText(points, editor.getDocument().getText(), (TagInfo t) -> null); }