use of com.intellij.psi.tree.IReparseableLeafElementType in project intellij-community by JetBrains.
the class PomModelImpl method tryReparseOneLeaf.
@Nullable
private static Runnable tryReparseOneLeaf(@NotNull FileElement treeElement, @NotNull CharSequence newText, @NotNull TextRange changedPsiRange) {
final LeafElement leaf = treeElement.findLeafElementAt(changedPsiRange.getStartOffset());
IElementType leafType = leaf == null ? null : leaf.getElementType();
if (!(leafType instanceof IReparseableLeafElementType))
return null;
CharSequence newLeafText = getLeafChangedText(leaf, treeElement, newText, changedPsiRange);
//noinspection unchecked
final ASTNode copy = newLeafText == null ? null : ((IReparseableLeafElementType) leafType).reparseLeaf(leaf, newLeafText);
return copy == null ? null : () -> leaf.getTreeParent().replaceChild(leaf, copy);
}
Aggregations