Package diff supports a pluggable diff algorithm.
- func ApplyEdits(before string, edits TextEdit) string
- func SortTextEdits(d TextEdit)
- type ComputeEdits
- type Hunk
- type Line
- type OpKind
- type TextEdit
- type Unified
func ApplyEdits ¶
ApplyEdits applies the set of edits to the before and returns the resulting content. It may panic or produce garbage if the edits are not valid for the provided before content.
type ComputeEdits ¶
ComputeEdits is the type for a function that produces a set of edits that convert from the before content to the after content.
Hunk represents a contiguous set of line edits to apply.
Line represents a single line operation to apply as part of a Hunk.
type OpKind int
OpKind is used to denote the type of operation a line represents.
const ( // Delete is the operation kind for a line that is present in the input // but not in the output. Delete OpKind = iota // Insert is the operation kind for a line that is new in the output. Insert // Equal is the operation kind for a line that is the same in the input and // output, often used to provide context around edited lines. Equal )
TextEdit represents a change to a section of a document. The text within the specified span should be replaced by the supplied new text.
Unified represents a set of edits as a unified diff.
ToUnified takes a file contents and a sequence of edits, and calculates a unified diff that represents those edits.
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/charlievieth/tools/xint/lsp/diff"
|Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/charlievieth/tools/xint/lsp/diff"|
Package myers implements the Myers diff algorithm.
|Package myers implements the Myers diff algorithm.|