This website requires JavaScript.
Explore
Help
Register
Sign In
qbit
/
go
Watch
1
Star
0
Fork
0
You've already forked go
mirror of
https://github.com/golang/go
synced
2024-11-19 10:24:43 -07:00
Code
Releases
Activity
73c4c875f0
go
/
internal
/
lsp
/
testdata
/
imports
/
remove_imports.go.golden
7 lines
68 B
Plaintext
Raw
Normal View
History
Unescape
Escape
internal/lsp/source: don't format the whole file when adding imports We want people to add imports as they need them. That means we probably don't want adding an import to reformat your whole file while you're in the middle of editing it. Unfortunately, the AST package doesn't offer any help with this -- there's no good way to get a diff out of it. Instead, we apply the changes, then diff a subset of the file. Picking that subset is tricky, see the code for details. Also delete a dead function, Imports, which should have been unused but was still being called in tests. Fixes golang/go#30843. Change-Id: I09a5344e910f65510003c4006ea5b11657922315 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205678 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-05 15:33:19 -07:00
-- goimports --
internal/lsp: add some basic tests for imports This change adds a few simple tests for the goimports behavior of gopls. There are still missing cases for non-standard library, but this is a good start. Change-Id: I2f9bc2cc876dcabf81413384b83fa3508517adf0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/179918 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-31 20:42:59 -06:00
package imports //@import("package")
func _() {
internal/lsp: do not format the file on import organization Updates golang/go#30843 Updates golang/go#35114 Change-Id: Id3f66d20b1ada9e53298b2370214b23b87bb0680 Reviewed-on: https://go-review.googlesource.com/c/tools/+/204557 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-31 12:29:49 -06:00
}
internal/lsp/source: don't format the whole file when adding imports We want people to add imports as they need them. That means we probably don't want adding an import to reformat your whole file while you're in the middle of editing it. Unfortunately, the AST package doesn't offer any help with this -- there's no good way to get a diff out of it. Instead, we apply the changes, then diff a subset of the file. Picking that subset is tricky, see the code for details. Also delete a dead function, Imports, which should have been unused but was still being called in tests. Fixes golang/go#30843. Change-Id: I09a5344e910f65510003c4006ea5b11657922315 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205678 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-05 15:33:19 -07:00
Copy Permalink