mirror of https://github.com/golang/go.git
gopls/internal/lsp/source: make "chatty" diagnostics the default
This CL changes the default behavior of gopls to always publish diagnostics for new file versions. In practice, this avoids stale diagnostics in multiple LSP clients (golang/go#54983 has more details). After this change, TestDownloadDeps was failing because it asserted on the non-existence of published diagnostics. Update the test to treat an empty diagnostic set the same as an unreceived diagnostic set. Fixes golang/go#54983 Change-Id: I41ed2f859b748e14585e7feb53702d3f38dcd599 Reviewed-on: https://go-review.googlesource.com/c/tools/+/429935 Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
7e129ca5ef
commit
ec743893cd
|
|
@ -164,6 +164,7 @@ func DefaultOptions() *Options {
|
|||
CompleteUnimported: true,
|
||||
CompletionDocumentation: true,
|
||||
DeepCompletion: true,
|
||||
ChattyDiagnostics: true,
|
||||
},
|
||||
Hooks: Hooks{
|
||||
ComputeEdits: myers.ComputeEdits,
|
||||
|
|
@ -587,11 +588,6 @@ type InternalOptions struct {
|
|||
// ChattyDiagnostics controls whether to report file diagnostics for each
|
||||
// file change. If unset, gopls only reports diagnostics when they change, or
|
||||
// when a file is opened or closed.
|
||||
//
|
||||
// TODO(rfindley): is seems that for many clients this should be true by
|
||||
// default. For example, coc.nvim seems to get confused if diagnostics are
|
||||
// not re-published. Switch the default to true after some period of internal
|
||||
// testing.
|
||||
ChattyDiagnostics bool
|
||||
}
|
||||
|
||||
|
|
@ -824,7 +820,6 @@ func (o *Options) EnableAllExperiments() {
|
|||
o.ExperimentalUseInvalidMetadata = true
|
||||
o.ExperimentalWatchedFileDelay = 50 * time.Millisecond
|
||||
o.NewDiff = "checked"
|
||||
o.ChattyDiagnostics = true
|
||||
}
|
||||
|
||||
func (o *Options) enableAllExperimentMaps() {
|
||||
|
|
|
|||
|
|
@ -1189,8 +1189,8 @@ func main() {
|
|||
)
|
||||
env.ApplyQuickFixes("main.go", d.Diagnostics)
|
||||
env.Await(
|
||||
EmptyDiagnostics("main.go"),
|
||||
NoDiagnostics("go.mod"),
|
||||
EmptyOrNoDiagnostics("main.go"),
|
||||
EmptyOrNoDiagnostics("go.mod"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue