def METHOD_NAME(diff, eol_chars):
    # To keep things simple our text edits will be line based.
    # We will also return the edits uncompacted, meaning a
    # line replacement will come in as a line remove followed
    # by a line add instead of a line replace.
    text_edits = []
    # keep track of line number since additions
    # don't include the line number it's being added
    # to in diffs. lsp is 0-indexed so we'll start with -1
    prev_line_no = -1
    for change in diff.changes:
        if change.old and change.new:
            # old and new are the same line, no change
            # diffs are 1-indexed
            prev_line_no = change.old - 1
        elif change.new:
            # addition
            text_edits.append({
                'range': {
                    'start': {
                        'line': prev_line_no + 1,
                        'character': 0
                    },
                    'end': {
                        'line': prev_line_no + 1,
                        'character': 0
                    }
                },
                'newText': change.line + eol_chars
            })
        elif change.old:
            # remove
            lsp_line_no = change.old - 1
            text_edits.append({
                'range': {
                    'start': {
                        'line': lsp_line_no,
                        'character': 0
                    },
                    'end': {
                        # From LSP spec:
                        # If you want to specify a range that contains a line
                        # including the line ending character(s) then use an
                        # end position denoting the start of the next line.
                        'line': lsp_line_no + 1,
                        'character': 0
                    }
                },
                'newText': ''
            })
            prev_line_no = lsp_line_no
    return text_edits