From febfa9d67f03c73c4a6b416bbe3a15abdeeb51b9 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Sun, 11 Apr 2021 15:07:42 -0400 Subject: [PATCH] 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 Run-TryBot: Robert Findley gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Rebecca Stambler --- gopls/doc/settings.md | 6 +++--- internal/lsp/diagnostics.go | 4 ++-- internal/lsp/fake/editor.go | 4 +--- internal/lsp/source/api_json.go | 6 +++--- internal/lsp/source/options.go | 14 +++++++++----- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gopls/doc/settings.md b/gopls/doc/settings.md index 063e63c906..5be569f862 100644 --- a/gopls/doc/settings.md +++ b/gopls/doc/settings.md @@ -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. diff --git a/internal/lsp/diagnostics.go b/internal/lsp/diagnostics.go index ead469e85c..d3f8c8ad40 100644 --- a/internal/lsp/diagnostics.go +++ b/internal/lsp/diagnostics.go @@ -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). diff --git a/internal/lsp/fake/editor.go b/internal/lsp/fake/editor.go index c270e05c8a..61867d592f 100644 --- a/internal/lsp/fake/editor.go +++ b/internal/lsp/fake/editor.go @@ -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 diff --git a/internal/lsp/source/api_json.go b/internal/lsp/source/api_json.go index 8cae980eec..9accafa8d5 100755 --- a/internal/lsp/source/api_json.go +++ b/internal/lsp/source/api_json.go @@ -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", }, { diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go index 1d703366a4..c78bab0c43 100644 --- a/internal/lsp/source/options.go +++ b/internal/lsp/source/options.go @@ -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)