类型 CodeDiffResult

API 文档由 Go 源码生成,内容为英文。

type CodeDiffResult struct {
	Left  []string
	Right []string
	Rows  []CodeDiffRow
	Stats CodeDiffStats
}

CodeDiffResult contains the split sources and their aligned rows.

构造函数

DiffCodeLines#

func DiffCodeLines(left, right string) CodeDiffResult

DiffCodeLines computes a bounded, deterministic line comparison. Common prefixes and suffixes are handled directly. Unique lines anchor recursive subdivisions; a region without anchors (every line repeats, as in a CSV, a log or a hosts file) gets a shortest edit script when its edit distance is small, and is otherwise represented as paired removals and additions. If the work budget or recursion depth is exhausted, the remaining region is emitted as one coarse change instead of blocking the caller for an unbounded time.