public static @Nullable RangeMarker insertTemporary(int endOffset, Document document, String temporary) {
    CharSequence chars = document.getCharsSequence();
    if (endOffset < chars.length() && Character.isJavaIdentifierPart(chars.charAt(endOffset))) {
      document.insertString(endOffset, temporary);
      RangeMarker toDelete = document.createRangeMarker(endOffset, endOffset + 1);
      toDelete.setGreedyToLeft(true);
      toDelete.setGreedyToRight(true);
      return toDelete;
    }
    return null;
  }
public static @Nullable RangeMarker insertTemporary(int endOffset, Document document, String temporary)