tools: golang.org/x/tools/internal/lsp/diff Index | Files

package diff

import "golang.org/x/tools/internal/lsp/diff"

Package diff implements the Myers diff algorithm.

Index

Package Files

diff.go unified.go

func ApplyEdits Uses

func ApplyEdits(a []string, operations []*Op) []string

func SplitLines Uses

func SplitLines(text string) []string

type Hunk Uses

type Hunk struct {
    FromLine int
    ToLine   int
    Lines    []Line
}

type Line Uses

type Line struct {
    Kind    OpKind
    Content string
}

type Op Uses

type Op struct {
    Kind    OpKind
    Content []string // content from b
    I1, I2  int      // indices of the line in a
    J1      int      // indices of the line in b, J2 implied by len(Content)
}

func Operations Uses

func Operations(a, b []string) []*Op

Operations returns the list of operations to convert a into b, consolidating operations for multiple lines and not including equal lines.

type OpKind Uses

type OpKind int
const (
    Delete OpKind = iota
    Insert
    Equal
)

func (OpKind) String Uses

func (k OpKind) String() string

type Unified Uses

type Unified struct {
    From, To string
    Hunks    []*Hunk
}

func ToUnified Uses

func ToUnified(from, to string, lines []string, ops []*Op) Unified

func (Unified) Format Uses

func (u Unified) Format(f fmt.State, r rune)

Package diff imports 2 packages (graph) and is imported by 4 packages. Updated 2019-07-19. Refresh now. Tools for package owners.