static int getLineEndOffsetByTotalOffset(Document document, int offset) {
    int line = document.getLineNumber(offset);
    return document.getLineEndOffset(line);
  }
static int getLineEndOffsetByTotalOffset(Document document, int offset)