diff

package
v0.0.0-...-57c1bf3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package diff implements the Myers diff algorithm.

Package diff supports a pluggable diff algorithm.

Index

Constants

This section is empty.

Variables

View Source
var (
	ComputeEdits func(uri span.URI, before, after string) []TextEdit
	ApplyEdits   func(before string, edits []TextEdit) string
	ToUnified    func(from, to string, before string, edits []TextEdit) string
)

Functions

func ApplyEdits

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

func SortTextEdits

func SortTextEdits(d []TextEdit)

Types

type Op

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

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

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

func (OpKind) String

func (k OpKind) String() string

type TextEdit

type TextEdit struct {
	Span    span.Span
	NewText string
}

TextEdit represents a change to a section of a document. The text within the specified span should be replaced by the supplied new text.

Directories

Path Synopsis
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/Andyfoo/golang/x/tools/internal/lsp/diff"
Package difftest supplies a set of tests that will operate on any implementation of a diff algorithm as exposed by "github.com/Andyfoo/golang/x/tools/internal/lsp/diff"
Package myers implements the Myers diff algorithm.
Package myers implements the Myers diff algorithm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL