mirror of
https://github.com/golang/go.git
synced 2025-05-05 07:33:00 +00:00
internal/lsp: add config flag to hide debugging output
Add a new "verboseOutput" config flag (defaults to "false") to enable verbose go/packages and imports output. Previously this output was always present. The go/packages output would dump out the entire (humongous) "go list" JSON response which would lock up my editor for a second whenever something triggered a go/packages call. The imports output would produce a bunch of "gopathwalk" debug messages that aren't useful in general and in particular add noisy output to tests. Change-Id: Ie4693d074cb84f1397e0e51d7346dc9391bd1278 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205138 Reviewed-by: Koichi Shiraishi <zchee.io@gmail.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
818555187f
commit
ea203083f5
6
internal/lsp/cache/view.go
vendored
6
internal/lsp/cache/view.go
vendored
@ -128,7 +128,9 @@ func (v *view) Config(ctx context.Context) *packages.Config {
|
||||
panic("go/packages must not be used to parse files")
|
||||
},
|
||||
Logf: func(format string, args ...interface{}) {
|
||||
log.Print(ctx, fmt.Sprintf(format, args...))
|
||||
if v.options.VerboseOutput {
|
||||
log.Print(ctx, fmt.Sprintf(format, args...))
|
||||
}
|
||||
},
|
||||
Tests: true,
|
||||
}
|
||||
@ -186,7 +188,7 @@ func (v *view) buildProcessEnv(ctx context.Context) (*imports.ProcessEnv, error)
|
||||
log.Print(ctx, fmt.Sprintf(format, args...))
|
||||
},
|
||||
LocalPrefix: v.options.LocalPrefix,
|
||||
Debug: true,
|
||||
Debug: v.options.VerboseOutput,
|
||||
}
|
||||
for _, kv := range cfg.Env {
|
||||
split := strings.Split(kv, "=")
|
||||
|
@ -108,6 +108,8 @@ type Options struct {
|
||||
|
||||
// LocalPrefix is used to specify goimports's -local behavior.
|
||||
LocalPrefix string
|
||||
|
||||
VerboseOutput bool
|
||||
}
|
||||
|
||||
type CompletionOptions struct {
|
||||
@ -289,6 +291,9 @@ func (o *Options) set(name string, value interface{}) OptionResult {
|
||||
}
|
||||
o.LocalPrefix = localPrefix
|
||||
|
||||
case "verboseOutput":
|
||||
result.setBool(&o.VerboseOutput)
|
||||
|
||||
// Deprecated settings.
|
||||
case "wantSuggestedFixes":
|
||||
result.State = OptionDeprecated
|
||||
|
Loading…
x
Reference in New Issue
Block a user