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>
diff --git a/gopls/doc/settings.md b/gopls/doc/settings.md
index 063e63c..5be569f 100644
--- a/gopls/doc/settings.md
+++ b/gopls/doc/settings.md
@@ -308,11 +308,11 @@
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.
diff --git a/internal/lsp/diagnostics.go b/internal/lsp/diagnostics.go
index ead469e..d3f8c8a 100644
--- a/internal/lsp/diagnostics.go
+++ b/internal/lsp/diagnostics.go
@@ -108,9 +108,9 @@
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).
diff --git a/internal/lsp/fake/editor.go b/internal/lsp/fake/editor.go
index c270e05..61867d5 100644
--- a/internal/lsp/fake/editor.go
+++ b/internal/lsp/fake/editor.go
@@ -256,9 +256,7 @@
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
diff --git a/internal/lsp/source/api_json.go b/internal/lsp/source/api_json.go
index 8cae980..9accafa 100755
--- a/internal/lsp/source/api_json.go
+++ b/internal/lsp/source/api_json.go
@@ -627,16 +627,16 @@
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",
},
{
diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go
index 1d70336..c78bab0 100644
--- a/internal/lsp/source/options.go
+++ b/internal/lsp/source/options.go
@@ -112,7 +112,7 @@
},
UIOptions: UIOptions{
DiagnosticOptions: DiagnosticOptions{
- ExperimentalDiagnosticsDelay: 250 * time.Millisecond,
+ DiagnosticsDelay: 250 * time.Millisecond,
Annotations: map[Annotation]bool{
Bounds: true,
Escape: true,
@@ -377,13 +377,13 @@
// 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 @@
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)