internal/lsp/cache: suppress Load log spam
moduleLoadScope triggers a load of many packages, just like
viewLoadScope, and should not log each loaded package.
Change-Id: Ifd59b41a496da8eb57421f948b9327519e82d2ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/268538
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/gopls/internal/regtest/watch_test.go b/gopls/internal/regtest/watch_test.go
index 3b5b69d..9786480 100644
--- a/gopls/internal/regtest/watch_test.go
+++ b/gopls/internal/regtest/watch_test.go
@@ -375,7 +375,9 @@
package a
`
t.Run("close then delete", func(t *testing.T) {
- runner.Run(t, pkg, func(t *testing.T, env *Env) {
+ withOptions(EditorConfig{
+ VerboseOutput: true,
+ }).run(t, pkg, func(t *testing.T, env *Env) {
env.OpenFile("a/a.go")
env.OpenFile("a/a_unneeded.go")
env.Await(
@@ -407,7 +409,9 @@
})
t.Run("delete then close", func(t *testing.T) {
- runner.Run(t, pkg, func(t *testing.T, env *Env) {
+ withOptions(EditorConfig{
+ VerboseOutput: true,
+ }).run(t, pkg, func(t *testing.T, env *Env) {
env.OpenFile("a/a.go")
env.OpenFile("a/a_unneeded.go")
env.Await(
diff --git a/internal/lsp/cache/load.go b/internal/lsp/cache/load.go
index 9eed1c4..8009df1 100644
--- a/internal/lsp/cache/load.go
+++ b/internal/lsp/cache/load.go
@@ -81,7 +81,7 @@
panic(fmt.Sprintf("unknown scope type %T", scope))
}
switch scope.(type) {
- case viewLoadScope:
+ case viewLoadScope, moduleLoadScope:
containsDir = true
}
}
diff --git a/internal/lsp/fake/editor.go b/internal/lsp/fake/editor.go
index fed01ec..12b9b1c 100644
--- a/internal/lsp/fake/editor.go
+++ b/internal/lsp/fake/editor.go
@@ -95,6 +95,8 @@
// Whether to send the current process ID, for testing data that is joined to
// the PID. This can only be set by one test.
SendPID bool
+
+ VerboseOutput bool
}
// NewEditor Creates a new Editor.
@@ -212,6 +214,10 @@
config["allExperiments"] = true
}
+ if e.Config.VerboseOutput {
+ config["verboseOutput"] = true
+ }
+
// TODO(rFindley): uncomment this if/when diagnostics delay is on by
// default... and probably change to the new settings name.
// config["experimentalDiagnosticsDelay"] = "10ms"