def insert_contextual_comment(buf, (row, col)):
    if row == 1:
        return insert_file_comment(buf, (row, col))

    line_props = LineProperties(buf[row - 1])
    if line_props.is_diffscuss:
        return reply_to_comment(buf, (row, col))
    elif line_props.is_diff_meta:
        row, col = find_range(buf, (row, col))
        return insert_comment(buf, (row, col))

    return insert_comment(buf, (row, col))


### Showing source
Inserts a comment based on the current context: file-level if the cursor is
dataset/ETHPy150Open hut8labs/diffscuss/diffscuss/support/editor.py/insert_contextual_comment