From bc9cd159c589d9f78867aaeb5c70867c58e24e61 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 11 Dec 2023 16:28:05 -0500 Subject: [PATCH] gopls/internal/settings: remove MemoryMode option It has had no effect for some time. Fixes golang/go#46902 Change-Id: I429121614a00210cc1053d2031eeb994de18e02c Reviewed-on: https://go-review.googlesource.com/c/tools/+/548739 LUCI-TryBot-Result: Go LUCI Reviewed-by: Robert Findley Auto-Submit: Alan Donovan --- gopls/doc/settings.md | 16 +++------------- gopls/internal/settings/api_json.go | 15 ++++----------- gopls/internal/settings/default.go | 1 - gopls/internal/settings/settings.go | 24 +++--------------------- 4 files changed, 10 insertions(+), 46 deletions(-) diff --git a/gopls/doc/settings.md b/gopls/doc/settings.md index 4ded2904c82..95ca4988adb 100644 --- a/gopls/doc/settings.md +++ b/gopls/doc/settings.md @@ -85,23 +85,13 @@ is the part of the file name after the final dot.) Default: `[]`. -#### **memoryMode** *enum* +#### **memoryMode** *string* **This setting is experimental and may be deleted.** -memoryMode controls the tradeoff `gopls` makes between memory usage and -correctness. +obsolete, no effect -Values other than `Normal` are untested and may break in surprising ways. - -Must be one of: - -* `"DegradeClosed"`: In DegradeClosed mode, `gopls` will collect less information about -packages without open files. As a result, features like Find -References and Rename will miss results in such packages. -* `"Normal"` - -Default: `"Normal"`. +Default: `""`. #### **expandWorkspaceToModule** *bool* diff --git a/gopls/internal/settings/api_json.go b/gopls/internal/settings/api_json.go index fe5e5710a32..e9c2d6340d8 100644 --- a/gopls/internal/settings/api_json.go +++ b/gopls/internal/settings/api_json.go @@ -34,17 +34,10 @@ var GeneratedAPIJSON = &APIJSON{ Hierarchy: "build", }, { - Name: "memoryMode", - Type: "enum", - Doc: "memoryMode controls the tradeoff `gopls` makes between memory usage and\ncorrectness.\n\nValues other than `Normal` are untested and may break in surprising ways.\n", - EnumValues: []EnumValue{ - { - Value: "\"DegradeClosed\"", - Doc: "`\"DegradeClosed\"`: In DegradeClosed mode, `gopls` will collect less information about\npackages without open files. As a result, features like Find\nReferences and Rename will miss results in such packages.\n", - }, - {Value: "\"Normal\""}, - }, - Default: "\"Normal\"", + Name: "memoryMode", + Type: "string", + Doc: "obsolete, no effect\n", + Default: "\"\"", Status: "experimental", Hierarchy: "build", }, diff --git a/gopls/internal/settings/default.go b/gopls/internal/settings/default.go index 46859b3754e..87192e01603 100644 --- a/gopls/internal/settings/default.go +++ b/gopls/internal/settings/default.go @@ -62,7 +62,6 @@ func DefaultOptions(overrides ...func(*Options)) *Options { UserOptions: UserOptions{ BuildOptions: BuildOptions{ ExpandWorkspaceToModule: true, - MemoryMode: ModeNormal, DirectoryFilters: []string{"-**/node_modules"}, TemplateExtensions: []string{}, StandaloneTags: []string{"ignore"}, diff --git a/gopls/internal/settings/settings.go b/gopls/internal/settings/settings.go index d906bbed49a..c13d37310d3 100644 --- a/gopls/internal/settings/settings.go +++ b/gopls/internal/settings/settings.go @@ -175,11 +175,8 @@ type BuildOptions struct { // is the part of the file name after the final dot.) TemplateExtensions []string - // MemoryMode controls the tradeoff `gopls` makes between memory usage and - // correctness. - // - // Values other than `Normal` are untested and may break in surprising ways. - MemoryMode MemoryMode `status:"experimental"` + // obsolete, no effect + MemoryMode string `status:"experimental"` // ExpandWorkspaceToModule instructs `gopls` to adjust the scope of the // workspace to find the best available module root. `gopls` first looks for @@ -661,16 +658,6 @@ const ( Structured HoverKind = "Structured" ) -type MemoryMode string - -const ( - ModeNormal MemoryMode = "Normal" - // In DegradeClosed mode, `gopls` will collect less information about - // packages without open files. As a result, features like Find - // References and Rename will miss results in such packages. - ModeDegradeClosed MemoryMode = "DegradeClosed" -) - type VulncheckMode string const ( @@ -941,12 +928,7 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{}) o.DirectoryFilters = filters case "memoryMode": - if s, ok := result.asOneOf( - string(ModeNormal), - string(ModeDegradeClosed), - ); ok { - o.MemoryMode = MemoryMode(s) - } + result.deprecated("") case "completionDocumentation": result.setBool(&o.CompletionDocumentation) case "usePlaceholders":