1
0
mirror of https://github.com/golang/go synced 2024-11-18 17:14:45 -07:00
go/internal/lsp/regtest
Rob Findley 49e4010bbf internal/lsp/regtest: implement formatting and organizeImports
Add two new fake editor commands: Formatting and OrganizeImports, which
delegate to textDocument/formatting and textDocument/codeAction
respectively. Use this in simple regtests, as well as on save.

Implementing this required fixing a broken assumption about text edits
in the editor: previously these edits were incrementally mutating the
buffer, but the correct implementation should simultaneously mutate the
buffer (i.e., all positions in an edit set refer to the starting buffer
state). This never mattered before because we were only operating on one
edit at a time.

Updates golang/go#36879

Change-Id: I6dec343c4e202288fa20c26df2fbafe9340a1bce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221539
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rohan Challa <rohan@golang.org>
2020-03-02 19:16:53 +00:00
..
definition_test.go internal/lsp/regtest: remove calls to t.Parallel() 2020-02-27 18:46:34 +00:00
diagnostics_test.go internal/lsp/regtest: remove calls to t.Parallel() 2020-02-27 18:46:34 +00:00
env.go internal/lsp/regtest: consolidate Env wrappers 2020-03-02 19:06:06 +00:00
formatting_test.go internal/lsp/regtest: implement formatting and organizeImports 2020-03-02 19:16:53 +00:00
reg_test.go internal/lsp/regtest: clean-up and more error handling 2020-02-25 19:00:36 +00:00
shared_test.go internal/lsp/regtest: remove calls to t.Parallel() 2020-02-27 18:46:34 +00:00
wrappers.go internal/lsp/regtest: implement formatting and organizeImports 2020-03-02 19:16:53 +00:00