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>
This commit is contained in:
Heschi Kreinick 2020-11-09 16:10:15 -05:00
parent 53e0aa8268
commit f6c1dd6914
3 changed files with 13 additions and 3 deletions

View File

@ -375,7 +375,9 @@ func _() {
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 @@ package a
})
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(

View File

@ -81,7 +81,7 @@ func (s *snapshot) load(ctx context.Context, scopes ...interface{}) error {
panic(fmt.Sprintf("unknown scope type %T", scope))
}
switch scope.(type) {
case viewLoadScope:
case viewLoadScope, moduleLoadScope:
containsDir = true
}
}

View File

@ -95,6 +95,8 @@ type EditorConfig struct {
// 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 @@ func (e *Editor) configuration() map[string]interface{} {
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"