Skip to content

Commit f6c1dd6

Browse files
committed
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 <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 53e0aa8 commit f6c1dd6

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

gopls/internal/regtest/watch_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ func _() {
375375
package a
376376
`
377377
t.Run("close then delete", func(t *testing.T) {
378-
runner.Run(t, pkg, func(t *testing.T, env *Env) {
378+
withOptions(EditorConfig{
379+
VerboseOutput: true,
380+
}).run(t, pkg, func(t *testing.T, env *Env) {
379381
env.OpenFile("a/a.go")
380382
env.OpenFile("a/a_unneeded.go")
381383
env.Await(
@@ -407,7 +409,9 @@ package a
407409
})
408410

409411
t.Run("delete then close", func(t *testing.T) {
410-
runner.Run(t, pkg, func(t *testing.T, env *Env) {
412+
withOptions(EditorConfig{
413+
VerboseOutput: true,
414+
}).run(t, pkg, func(t *testing.T, env *Env) {
411415
env.OpenFile("a/a.go")
412416
env.OpenFile("a/a_unneeded.go")
413417
env.Await(

internal/lsp/cache/load.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (s *snapshot) load(ctx context.Context, scopes ...interface{}) error {
8181
panic(fmt.Sprintf("unknown scope type %T", scope))
8282
}
8383
switch scope.(type) {
84-
case viewLoadScope:
84+
case viewLoadScope, moduleLoadScope:
8585
containsDir = true
8686
}
8787
}

internal/lsp/fake/editor.go

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ type EditorConfig struct {
9595
// Whether to send the current process ID, for testing data that is joined to
9696
// the PID. This can only be set by one test.
9797
SendPID bool
98+
99+
VerboseOutput bool
98100
}
99101

100102
// NewEditor Creates a new Editor.
@@ -212,6 +214,10 @@ func (e *Editor) configuration() map[string]interface{} {
212214
config["allExperiments"] = true
213215
}
214216

217+
if e.Config.VerboseOutput {
218+
config["verboseOutput"] = true
219+
}
220+
215221
// TODO(rFindley): uncomment this if/when diagnostics delay is on by
216222
// default... and probably change to the new settings name.
217223
// config["experimentalDiagnosticsDelay"] = "10ms"

0 commit comments

Comments
 (0)