internal/lsp/source: move diagnosticsDelay out of experimental

This option has been enabled by default for a while now: remove it from
'experimental' to 'advanced'.

Change-Id: Id8116bf7b8976204a61fe1bbf9dc0b8bd69c68d1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/309271
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@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:
Rob Findley 2021-04-11 15:07:42 -04:00 committed by Robert Findley
parent 71eae3a1b4
commit febfa9d67f
5 changed files with 18 additions and 16 deletions

View File

@ -308,11 +308,11 @@ Can contain any of:
Default: `{"bounds":true,"escape":true,"inline":true,"nil":true}`.
##### **experimentalDiagnosticsDelay** *time.Duration*
##### **diagnosticsDelay** *time.Duration*
**This setting is experimental and may be deleted.**
**This is an advanced setting and should not be configured by most `gopls` users.**
experimentalDiagnosticsDelay controls the amount of time that gopls waits
diagnosticsDelay controls the amount of time that gopls waits
after the most recent file modification before computing deep diagnostics.
Simple diagnostics (parsing and type-checking) are always run immediately
on recently modified packages.

View File

@ -108,9 +108,9 @@ func (s *Server) diagnoseSnapshot(snapshot source.Snapshot, changedURIs []span.U
ctx, done := event.Start(ctx, "Server.diagnoseSnapshot", tag.Snapshot.Of(snapshot.ID()))
defer done()
delay := snapshot.View().Options().ExperimentalDiagnosticsDelay
delay := snapshot.View().Options().DiagnosticsDelay
if delay > 0 {
// Experimental 2-phase diagnostics.
// 2-phase diagnostics.
//
// The first phase just parses and checks packages that have been
// affected by file modifications (no analysis).

View File

@ -256,9 +256,7 @@ func (e *Editor) configuration() map[string]interface{} {
config["importShortcut"] = e.Config.ImportShortcut
}
// TODO(rFindley): change to the new settings name once it is no longer
// designated experimental.
config["experimentalDiagnosticsDelay"] = "10ms"
config["diagnosticsDelay"] = "10ms"
// ExperimentalWorkspaceModule is only set as a mode, not a configuration.
return config

View File

@ -627,16 +627,16 @@ var GeneratedAPIJSON = &APIJSON{
Hierarchy: "ui.diagnostic",
},
{
Name: "experimentalDiagnosticsDelay",
Name: "diagnosticsDelay",
Type: "time.Duration",
Doc: "experimentalDiagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n",
Doc: "diagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n",
EnumKeys: EnumKeys{
ValueType: "",
Keys: nil,
},
EnumValues: nil,
Default: "\"250ms\"",
Status: "experimental",
Status: "advanced",
Hierarchy: "ui.diagnostic",
},
{

View File

@ -112,7 +112,7 @@ func DefaultOptions() *Options {
},
UIOptions: UIOptions{
DiagnosticOptions: DiagnosticOptions{
ExperimentalDiagnosticsDelay: 250 * time.Millisecond,
DiagnosticsDelay: 250 * time.Millisecond,
Annotations: map[Annotation]bool{
Bounds: true,
Escape: true,
@ -377,13 +377,13 @@ type DiagnosticOptions struct {
// that should be reported by the gc_details command.
Annotations map[Annotation]bool `status:"experimental"`
// ExperimentalDiagnosticsDelay controls the amount of time that gopls waits
// DiagnosticsDelay controls the amount of time that gopls waits
// after the most recent file modification before computing deep diagnostics.
// Simple diagnostics (parsing and type-checking) are always run immediately
// on recently modified packages.
//
// This option must be set to a valid duration string, for example `"250ms"`.
ExperimentalDiagnosticsDelay time.Duration `status:"experimental"`
DiagnosticsDelay time.Duration `status:"advanced"`
// ExperimentalWatchedFileDelay controls the amount of time that gopls waits
// for additional workspace/didChangeWatchedFiles notifications to arrive,
@ -929,8 +929,12 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{})
case "experimentalTemplateSupport":
result.setBool(&o.ExperimentalTemplateSupport)
case "experimentalDiagnosticsDelay":
result.setDuration(&o.ExperimentalDiagnosticsDelay)
case "experimentalDiagnosticsDelay", "diagnosticsDelay":
if name == "experimentalDiagnosticsDelay" {
result.State = OptionDeprecated
result.Replacement = "diagnosticsDelay"
}
result.setDuration(&o.DiagnosticsDelay)
case "experimentalWatchedFileDelay":
result.setDuration(&o.ExperimentalWatchedFileDelay)