go/internal
Alan Donovan d96b2388c6 internal/diff: simplify API, break span dependency
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>
2022-10-05 20:32:15 +00:00
..
analysisinternal gopls/.../fillstruct: support generic types 2022-09-30 19:58:05 +00:00
apidiff all: gofmt 2022-04-12 17:53:17 +00:00
bug gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
diff internal/diff: simplify API, break span dependency 2022-10-05 20:32:15 +00:00
event gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
fakenet internal/fakenet: add a fake network connection 2020-05-27 14:27:59 +00:00
fastwalk all: remove redundant type conversion 2022-09-07 17:33:19 +00:00
fuzzy gopls/.../fillstruct: support generic types 2022-09-30 19:58:05 +00:00
gocommand go/packages: issue error if 'go list' on PATH is too new 2022-09-28 14:34:08 +00:00
gopathwalk internal/gopathwalk: remove unnecessary call to os.Lstat 2022-03-31 05:33:07 +00:00
imports internal/imports: update stdlib index for 1.19 2022-08-10 17:41:25 +00:00
jsonrpc2 all: use constant to avoid repeated definitions 2022-09-19 15:32:23 +00:00
jsonrpc2_v2 gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
loopclosure go/analysis/passes/loopclosure: experiment with checking t.Run+Parallel 2022-09-20 22:09:32 +00:00
memoize internal/memoize: fix race in Store.Promise 2022-07-28 15:35:11 +00:00
packagesinternal x/tools/go/packages: on Go 1.19+, explicitly ask for -json fields needed 2022-04-19 17:08:06 +00:00
persistent internal/lsp/cache: use GetHandle not Bind for 5 URI-keyed maps 2022-07-07 16:57:02 +00:00
proxydir all: remove version-specific test files 2020-05-28 17:13:50 +00:00
span internal/diff: simplify API, break span dependency 2022-10-05 20:32:15 +00:00
stack all: gofmt 2022-04-12 17:53:17 +00:00
testenv internal: remove pre-go1.12 conditionally compiled files 2022-05-05 16:48:28 +00:00
tool internal/tool: implement structured help command 2022-05-04 22:58:41 +00:00
typeparams x/tools/internal/typeparams: use regexp to match wanted result 2022-09-02 19:06:05 +00:00
typesinternal internal/typesinternal: update typesinternal for 1.18 2022-02-22 16:42:18 +00:00
xcontext