mirror of https://github.com/golang/go.git
diff.TextEdit (now called simply Edit) no longer has a Span, and no longer depends on the span package, which is really part of gopls. Instead, it records only start/end byte offsets within an (implied) file. The diff algorithms have been simplified to avoid the need to map offsets to line/column numbers (e.g. using a token.File). All the conditions actually needed by the logic can be derived by local string operations on the source text. This change will allow us to move the span package into the gopls module. I was expecting that gopls would want to define its own Span-augmented TextEdit type but, surprisingly, diff.Edit is quite convenient to use throughout the entire repo: in all places in gopls that manipulate Edits, the implied file is obvious. In most cases, less conversion boilerplate is required than before. API Notes: - diff.TextEdit -> Edit (it needn't be text) - diff.ApplyEdits -> Apply - source.protocolEditsFromSource is now private Change-Id: I4d7cef078dfbd189b4aef477f845db320af6c5f6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/436781 Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> |
||
|---|---|---|
| .. | ||
| diff.go | ||
| diff_test.go | ||