private static Optional<String> getCommentOnLine(String documentContent, int lineEndOffset) {
        int prevLine = documentContent.lastIndexOf("\n", lineEndOffset - 1);

        // note: if prevLine == -1 (not found), we should correctly extract from offset 0
        String possibleCommentString = documentContent.substring(prevLine + 1, lineEndOffset).trim();

        if (!possibleCommentString.startsWith("#")) return Optional.empty();
        return Optional.of(possibleCommentString);
    }
Helper to check if a comment exists and extract it from a line
@param documentContent
@param lineEndOffset offset at which the \n following this line occurs
@return the string containing the comment, not including leading or trailing whitespace if found
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/lsp/schema/hover/SchemaHover.java