gopls/doc: improve enum value documentation

Add a new field to the options JSON, EnumValues. Use it to automatically
generate the documentation for enums. Fix the displayed type to be
"enum" rather than the full-qualified Go type name.

To make this easy, I changed the various enum constants to be strings,
with values matching their configuration values. It may be possible to
automatically parse them in the future, but we can get to that later.

The documentation for hoverKind's private values is a little janky. I
didn't want to build a way to hide them. We can hardcode it if we really
care.

Updates golang/go#33544.

Change-Id: Ia5cc958e347d5ff041068c57726d530809bb0f70
Reviewed-on: https://go-review.googlesource.com/c/tools/+/256358
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@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/generate.go b/gopls/doc/generate.go
index 5948101..fb282f3 100644
--- a/gopls/doc/generate.go
+++ b/gopls/doc/generate.go
@@ -47,10 +47,11 @@
 }
 
 type option struct {
-	Name    string
-	Type    string
-	Doc     string
-	Default string
+	Name       string
+	Type       string
+	Doc        string
+	EnumValues []string
+	Default    string
 }
 
 func rewriteDoc(doc []byte, categories map[string][]option) ([]byte, error) {
@@ -67,7 +68,14 @@
 func rewriteSection(doc []byte, categories map[string][]option, category string) ([]byte, error) {
 	section := bytes.NewBuffer(nil)
 	for _, opt := range categories[category] {
-		fmt.Fprintf(section, "### **%v** *%v*\n%v\nDefault: `%v`.\n", opt.Name, opt.Type, opt.Doc, opt.Default)
+		var enumValues string
+		if len(opt.EnumValues) > 0 {
+			enumValues = "Must be one of:\n\n"
+			for _, val := range opt.EnumValues {
+				enumValues += fmt.Sprintf(" * `%v`\n", val)
+			}
+		}
+		fmt.Fprintf(section, "### **%v** *%v*\n%v%v\n\nDefault: `%v`.\n", opt.Name, opt.Type, opt.Doc, enumValues, opt.Default)
 	}
 	re := regexp.MustCompile(fmt.Sprintf(`(?s)<!-- BEGIN %v.* -->\n(.*?)<!-- END %v.* -->`, category, category))
 	idx := re.FindSubmatchIndex(doc)
diff --git a/gopls/doc/settings.md b/gopls/doc/settings.md
index 2524861..5b771b1 100644
--- a/gopls/doc/settings.md
+++ b/gopls/doc/settings.md
@@ -23,27 +23,30 @@
 It is applied to queries like `go list`, which is used when discovering files.
 The most common use is to set `-tags`.
 
+
 Default: `[]`.
 ### **env** *[]string*
 env adds environment variables to external commands run by `gopls`, most notably `go list`.
 
+
 Default: `[]`.
-### **hoverKind** *golang.org/x/tools/internal/lsp/source.HoverKind*
+### **hoverKind** *enum*
 hoverKind controls the information that appears in the hover text.
-It must be one of:
-* `"NoDocumentation"`
-* `"SynopsisDocumentation"`
-* `"FullDocumentation"`
+SingleLine and Structured are intended for use only by authors of editor plugins.
+Must be one of:
 
-Authors of editor clients may wish to handle hover text differently, and so might use different settings. The options below are not intended for use by anyone other than the authors of editor plugins.
+ * `"FullDocumentation"`
+ * `"NoDocumentation"`
+ * `"SingleLine"`
+ * `"Structured"`
+ * `"SynopsisDocumentation"`
 
-* `"SingleLine"`
-* `"Structured"`
 
 Default: `"FullDocumentation"`.
 ### **usePlaceholders** *bool*
 placeholders enables placeholders for function parameters or struct fields in completion responses.
 
+
 Default: `false`.
 ### **linkTarget** *string*
 linkTarget controls where documentation links go.
@@ -54,15 +57,18 @@
 
 If company chooses to use its own `godoc.org`, its address can be used as well.
 
+
 Default: `"pkg.go.dev"`.
 ### **local** *string*
 local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after 3rd-party packages.
 It should be the prefix of the import path whose imports should be grouped separately.
 
+
 Default: `""`.
 ### **gofumpt** *bool*
 gofumpt indicates if we should run gofumpt formatting.
 
+
 Default: `false`.
 <!-- END User: DO NOT MANUALLY EDIT THIS SECTION -->
 
@@ -86,7 +92,8 @@
 ...
 ```
 
-Default: `null`.
+
+Default: `{}`.
 ### **codelens** *map[string]bool*
 overrides the enabled/disabled state of various code lenses. Currently, we
 support several code lenses:
@@ -108,14 +115,17 @@
 }
 ```
 
+
 Default: `{"gc_details":false,"generate":true,"regenerate_cgo":true,"tidy":true,"upgrade_dependency":true,"vendor":true}`.
 ### **completionDocumentation** *bool*
 completionDocumentation enables documentation with completion results.
 
+
 Default: `true`.
 ### **completeUnimported** *bool*
 completeUnimported enables completion for packages that you do not currently import.
 
+
 Default: `true`.
 ### **deepCompletion** *bool*
 deepCompletion If true, this turns on the ability to return completions from deep inside relevant entities, rather than just the locally accessible ones.
@@ -139,75 +149,91 @@
 
 At the location of the `<>` in this program, deep completion would suggest the result `x.str`.
 
-Default: `true`.
-### **matcher** *golang.org/x/tools/internal/lsp/source.Matcher*
-matcher sets the algorithm that is used when calculating completion candidates. Must be one of:
 
-* `"fuzzy"`
-* `"caseSensitive"`
-* `"caseInsensitive"`
+Default: `true`.
+### **matcher** *enum*
+matcher sets the algorithm that is used when calculating completion candidates.
+Must be one of:
+
+ * `"CaseInsensitive"`
+ * `"CaseSensitive"`
+ * `"Fuzzy"`
+
 
 Default: `"Fuzzy"`.
 ### **annotations** *map[string]bool*
 annotations suppress various kinds of optimization diagnostics
 that would be reported by the gc_details command.
-  noNilcheck suppresses display of nilchecks.
-  noEscape suppresses escape choices.
-  noInline suppresses inlining choices.
-  noBounds suppresses bounds checking diagnositcs.
+ * noNilcheck suppresses display of nilchecks.
+ * noEscape suppresses escape choices.
+ * noInline suppresses inlining choices.
+ * noBounds suppresses bounds checking diagnostics.
 
-Default: `null`.
+
+Default: `{}`.
 ### **staticcheck** *bool*
 staticcheck enables additional analyses from staticcheck.io.
 
+
 Default: `false`.
-### **symbolMatcher** *golang.org/x/tools/internal/lsp/source.SymbolMatcher*
-symbolMatcher sets the algorithm that is used when finding workspace symbols. Must be one of:
+### **symbolMatcher** *enum*
+symbolMatcher sets the algorithm that is used when finding workspace symbols.
+Must be one of:
 
-* `"fuzzy"`
-* `"caseSensitive"`
-* `"caseInsensitive"`
+ * `"CaseInsensitive"`
+ * `"CaseSensitive"`
+ * `"Fuzzy"`
 
-Default: `"SymbolFuzzy"`.
-### **symbolStyle** *golang.org/x/tools/internal/lsp/source.SymbolStyle*
-symbolStyle specifies what style of symbols to return in symbol requests. Must be one of:
 
-* `"full"`
-* `"dynamic"`
-* `"package"`
+Default: `"Fuzzy"`.
+### **symbolStyle** *enum*
+symbolStyle specifies what style of symbols to return in symbol requests.
+Must be one of:
 
-Default: `"PackageQualifiedSymbols"`.
+ * `"Dynamic"`
+ * `"Full"`
+ * `"Package"`
+
+
+Default: `"Package"`.
 ### **linksInHover** *bool*
 linksInHover toggles the presence of links to documentation in hover.
 
+
 Default: `true`.
 ### **tempModfile** *bool*
 tempModfile controls the use of the -modfile flag in Go 1.14.
 
-Default: `true`.
-### **importShortcut** *golang.org/x/tools/internal/lsp/source.ImportShortcut*
-importShortcut specifies whether import statements should link to
-documentation or go to definitions. Must be one of:
 
-* `"both"`
-* `"link"`
-* `"definition"`
+Default: `true`.
+### **importShortcut** *enum*
+importShortcut specifies whether import statements should link to
+documentation or go to definitions.
+Must be one of:
+
+ * `"Both"`
+ * `"Definition"`
+ * `"Link"`
+
 
 Default: `"Both"`.
 ### **verboseWorkDoneProgress** *bool*
 verboseWorkDoneProgress controls whether the LSP server should send
 progress reports for all work done outside the scope of an RPC.
 
+
 Default: `false`.
 ### **expandWorkspaceToModule** *bool*
 expandWorkspaceToModule instructs `gopls` to expand the scope of the workspace to include the
 modules containing the workspace folders. Set this to false to avoid loading
 your entire module. This is particularly useful for those working in a monorepo.
 
+
 Default: `true`.
 ### **experimentalWorkspaceModule** *bool*
 experimentalWorkspaceModule opts a user into the experimental support
 for multi-module workspaces.
 
+
 Default: `false`.
 <!-- END Experimental: DO NOT MANUALLY EDIT THIS SECTION -->
diff --git a/internal/lsp/source/enums_string.go b/internal/lsp/source/enums_string.go
deleted file mode 100644
index f963ffc..0000000
--- a/internal/lsp/source/enums_string.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Code generated by "stringer -output enums_string.go -type ImportShortcut,HoverKind,Matcher,SymbolMatcher,SymbolStyle"; DO NOT EDIT.
-
-package source
-
-import "strconv"
-
-func _() {
-	// An "invalid array index" compiler error signifies that the constant values have changed.
-	// Re-run the stringer command to generate them again.
-	var x [1]struct{}
-	_ = x[Both-0]
-	_ = x[Link-1]
-	_ = x[Definition-2]
-}
-
-const _ImportShortcut_name = "BothLinkDefinition"
-
-var _ImportShortcut_index = [...]uint8{0, 4, 8, 18}
-
-func (i ImportShortcut) String() string {
-	if i < 0 || i >= ImportShortcut(len(_ImportShortcut_index)-1) {
-		return "ImportShortcut(" + strconv.FormatInt(int64(i), 10) + ")"
-	}
-	return _ImportShortcut_name[_ImportShortcut_index[i]:_ImportShortcut_index[i+1]]
-}
-func _() {
-	// An "invalid array index" compiler error signifies that the constant values have changed.
-	// Re-run the stringer command to generate them again.
-	var x [1]struct{}
-	_ = x[SingleLine-0]
-	_ = x[NoDocumentation-1]
-	_ = x[SynopsisDocumentation-2]
-	_ = x[FullDocumentation-3]
-	_ = x[Structured-4]
-}
-
-const _HoverKind_name = "SingleLineNoDocumentationSynopsisDocumentationFullDocumentationStructured"
-
-var _HoverKind_index = [...]uint8{0, 10, 25, 46, 63, 73}
-
-func (i HoverKind) String() string {
-	if i < 0 || i >= HoverKind(len(_HoverKind_index)-1) {
-		return "HoverKind(" + strconv.FormatInt(int64(i), 10) + ")"
-	}
-	return _HoverKind_name[_HoverKind_index[i]:_HoverKind_index[i+1]]
-}
-func _() {
-	// An "invalid array index" compiler error signifies that the constant values have changed.
-	// Re-run the stringer command to generate them again.
-	var x [1]struct{}
-	_ = x[Fuzzy-0]
-	_ = x[CaseInsensitive-1]
-	_ = x[CaseSensitive-2]
-}
-
-const _Matcher_name = "FuzzyCaseInsensitiveCaseSensitive"
-
-var _Matcher_index = [...]uint8{0, 5, 20, 33}
-
-func (i Matcher) String() string {
-	if i < 0 || i >= Matcher(len(_Matcher_index)-1) {
-		return "Matcher(" + strconv.FormatInt(int64(i), 10) + ")"
-	}
-	return _Matcher_name[_Matcher_index[i]:_Matcher_index[i+1]]
-}
-func _() {
-	// An "invalid array index" compiler error signifies that the constant values have changed.
-	// Re-run the stringer command to generate them again.
-	var x [1]struct{}
-	_ = x[SymbolFuzzy-0]
-	_ = x[SymbolCaseInsensitive-1]
-	_ = x[SymbolCaseSensitive-2]
-}
-
-const _SymbolMatcher_name = "SymbolFuzzySymbolCaseInsensitiveSymbolCaseSensitive"
-
-var _SymbolMatcher_index = [...]uint8{0, 11, 32, 51}
-
-func (i SymbolMatcher) String() string {
-	if i < 0 || i >= SymbolMatcher(len(_SymbolMatcher_index)-1) {
-		return "SymbolMatcher(" + strconv.FormatInt(int64(i), 10) + ")"
-	}
-	return _SymbolMatcher_name[_SymbolMatcher_index[i]:_SymbolMatcher_index[i+1]]
-}
-func _() {
-	// An "invalid array index" compiler error signifies that the constant values have changed.
-	// Re-run the stringer command to generate them again.
-	var x [1]struct{}
-	_ = x[PackageQualifiedSymbols-0]
-	_ = x[FullyQualifiedSymbols-1]
-	_ = x[DynamicSymbols-2]
-}
-
-const _SymbolStyle_name = "PackageQualifiedSymbolsFullyQualifiedSymbolsDynamicSymbols"
-
-var _SymbolStyle_index = [...]uint8{0, 23, 44, 58}
-
-func (i SymbolStyle) String() string {
-	if i < 0 || i >= SymbolStyle(len(_SymbolStyle_index)-1) {
-		return "SymbolStyle(" + strconv.FormatInt(int64(i), 10) + ")"
-	}
-	return _SymbolStyle_name[_SymbolStyle_index[i]:_SymbolStyle_index[i+1]]
-}
diff --git a/internal/lsp/source/genopts/generate.go b/internal/lsp/source/genopts/generate.go
index 887fc4e..8b76a2a 100644
--- a/internal/lsp/source/genopts/generate.go
+++ b/internal/lsp/source/genopts/generate.go
@@ -93,10 +93,11 @@
 }
 
 type option struct {
-	Name    string
-	Type    string
-	Doc     string
-	Default string
+	Name       string
+	Type       string
+	Doc        string
+	EnumValues []string
+	Default    string
 }
 
 func loadOptions(category reflect.Value, pkg *packages.Package) ([]option, error) {
@@ -117,13 +118,15 @@
 		return nil, fmt.Errorf("no file for opts type %v", optsType)
 	}
 
+	enums := loadEnums(pkg)
+
 	var opts []option
 	optsStruct := optsType.Type().Underlying().(*types.Struct)
 	for i := 0; i < optsStruct.NumFields(); i++ {
 		// The types field gives us the type.
 		typesField := optsStruct.Field(i)
 		path, _ := astutil.PathEnclosingInterval(file, typesField.Pos(), typesField.Pos())
-		if len(path) < 1 {
+		if len(path) < 2 {
 			return nil, fmt.Errorf("could not find AST node for field %v", typesField)
 		}
 		// The AST field gives us the doc.
@@ -138,34 +141,54 @@
 			return nil, fmt.Errorf("could not find reflect field for %v", typesField.Name())
 		}
 
-		// Format the default value. String values should look like strings. Other stuff should look like JSON literals.
-		var defString string
-		switch def := reflectField.Interface().(type) {
-		case fmt.Stringer:
-			defString = `"` + def.String() + `"`
-		case string:
-			defString = `"` + def + `"`
-		default:
-			defString = fmt.Sprint(def)
+		// Format the default value. VSCode exposes settings as JSON, so showing them as JSON is reasonable.
+		// Nil values format as "null" so print them as hardcoded empty values.
+		def := reflectField.Interface()
+		defBytes, err := json.Marshal(def)
+		if err != nil {
+			return nil, err
 		}
-		if reflectField.Kind() == reflect.Map {
-			b, err := json.Marshal(reflectField.Interface())
-			if err != nil {
-				return nil, err
+
+		switch reflectField.Type().Kind() {
+		case reflect.Map:
+			if reflectField.IsNil() {
+				defBytes = []byte("{}")
 			}
-			defString = string(b)
+		case reflect.Slice:
+			if reflectField.IsNil() {
+				defBytes = []byte("[]")
+			}
+		}
+
+		typ := typesField.Type().String()
+		if _, ok := enums[typesField.Type()]; ok {
+			typ = "enum"
 		}
 
 		opts = append(opts, option{
-			Name:    lowerFirst(typesField.Name()),
-			Type:    typesField.Type().String(),
-			Doc:     lowerFirst(astField.Doc.Text()),
-			Default: defString,
+			Name:       lowerFirst(typesField.Name()),
+			Type:       typ,
+			Doc:        lowerFirst(astField.Doc.Text()),
+			Default:    string(defBytes),
+			EnumValues: enums[typesField.Type()],
 		})
 	}
 	return opts, nil
 }
 
+func loadEnums(pkg *packages.Package) map[types.Type][]string {
+	enums := map[types.Type][]string{}
+	for _, name := range pkg.Types.Scope().Names() {
+		obj := pkg.Types.Scope().Lookup(name)
+		cnst, ok := obj.(*types.Const)
+		if !ok {
+			continue
+		}
+		enums[obj.Type()] = append(enums[obj.Type()], cnst.Val().ExactString())
+	}
+	return enums
+}
+
 func lowerFirst(x string) string {
 	if x == "" {
 		return x
diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go
index ffcfb1d..6342ba0 100644
--- a/internal/lsp/source/options.go
+++ b/internal/lsp/source/options.go
@@ -59,7 +59,6 @@
 	defaultOptions *Options
 )
 
-//go:generate go run golang.org/x/tools/cmd/stringer -output enums_string.go -type ImportShortcut,HoverKind,Matcher,SymbolMatcher,SymbolStyle
 //go:generate go run golang.org/x/tools/internal/lsp/source/genopts -output options_json.go
 
 // DefaultOptions is the options that are used for Gopls execution independent
@@ -120,8 +119,10 @@
 				CompleteUnimported:      true,
 				CompletionDocumentation: true,
 				DeepCompletion:          true,
+				ImportShortcut:          Both,
 				Matcher:                 Fuzzy,
 				SymbolMatcher:           SymbolFuzzy,
+				SymbolStyle:             PackageQualifiedSymbols,
 			},
 			Hooks: Hooks{
 				ComputeEdits:         myers.ComputeEdits,
@@ -179,15 +180,7 @@
 	Env []string
 
 	// HoverKind controls the information that appears in the hover text.
-	// It must be one of:
-	// * `"NoDocumentation"`
-	// * `"SynopsisDocumentation"`
-	// * `"FullDocumentation"`
-	//
-	// Authors of editor clients may wish to handle hover text differently, and so might use different settings. The options below are not intended for use by anyone other than the authors of editor plugins.
-	//
-	// * `"SingleLine"`
-	// * `"Structured"`
+	// SingleLine and Structured are intended for use only by authors of editor plugins.
 	HoverKind HoverKind
 
 	// Placeholders enables placeholders for function parameters or struct fields in completion responses.
@@ -291,36 +284,24 @@
 	// At the location of the `<>` in this program, deep completion would suggest the result `x.str`.
 	DeepCompletion bool
 
-	// Matcher sets the algorithm that is used when calculating completion candidates. Must be one of:
-	//
-	// * `"fuzzy"`
-	// * `"caseSensitive"`
-	// * `"caseInsensitive"`
+	// Matcher sets the algorithm that is used when calculating completion candidates.
 	Matcher Matcher
 
 	// Annotations suppress various kinds of optimization diagnostics
 	// that would be reported by the gc_details command.
-	//   noNilcheck suppresses display of nilchecks.
-	//   noEscape suppresses escape choices.
-	//   noInline suppresses inlining choices.
-	//   noBounds suppresses bounds checking diagnositcs.
+	//  * noNilcheck suppresses display of nilchecks.
+	//  * noEscape suppresses escape choices.
+	//  * noInline suppresses inlining choices.
+	//  * noBounds suppresses bounds checking diagnostics.
 	Annotations map[string]bool
 
 	// Staticcheck enables additional analyses from staticcheck.io.
 	Staticcheck bool
 
-	// SymbolMatcher sets the algorithm that is used when finding workspace symbols. Must be one of:
-	//
-	// * `"fuzzy"`
-	// * `"caseSensitive"`
-	// * `"caseInsensitive"`
+	// SymbolMatcher sets the algorithm that is used when finding workspace symbols.
 	SymbolMatcher SymbolMatcher
 
-	// SymbolStyle specifies what style of symbols to return in symbol requests. Must be one of:
-	//
-	// * `"full"`
-	// * `"dynamic"`
-	// * `"package"`
+	// SymbolStyle specifies what style of symbols to return in symbol requests.
 	SymbolStyle SymbolStyle
 
 	// LinksInHover toggles the presence of links to documentation in hover.
@@ -330,11 +311,7 @@
 	TempModfile bool
 
 	// ImportShortcut specifies whether import statements should link to
-	// documentation or go to definitions. Must be one of:
-	//
-	// * `"both"`
-	// * `"link"`
-	// * `"definition"`
+	// documentation or go to definitions.
 	ImportShortcut ImportShortcut
 
 	// VerboseWorkDoneProgress controls whether the LSP server should send
@@ -370,12 +347,12 @@
 	LiteralCompletions bool
 }
 
-type ImportShortcut int
+type ImportShortcut string
 
 const (
-	Both ImportShortcut = iota
-	Link
-	Definition
+	Both       ImportShortcut = "Both"
+	Link       ImportShortcut = "Link"
+	Definition ImportShortcut = "Definition"
 )
 
 func (s ImportShortcut) ShowLinks() bool {
@@ -386,44 +363,44 @@
 	return s == Both || s == Definition
 }
 
-type Matcher int
+type Matcher string
 
 const (
-	Fuzzy = Matcher(iota)
-	CaseInsensitive
-	CaseSensitive
+	Fuzzy           Matcher = "Fuzzy"
+	CaseInsensitive Matcher = "CaseInsensitive"
+	CaseSensitive   Matcher = "CaseSensitive"
 )
 
-type SymbolMatcher int
+type SymbolMatcher string
 
 const (
-	SymbolFuzzy = SymbolMatcher(iota)
-	SymbolCaseInsensitive
-	SymbolCaseSensitive
+	SymbolFuzzy           SymbolMatcher = "Fuzzy"
+	SymbolCaseInsensitive SymbolMatcher = "CaseInsensitive"
+	SymbolCaseSensitive   SymbolMatcher = "CaseSensitive"
 )
 
-type SymbolStyle int
+type SymbolStyle string
 
 const (
-	PackageQualifiedSymbols = SymbolStyle(iota)
-	FullyQualifiedSymbols
-	DynamicSymbols
+	PackageQualifiedSymbols SymbolStyle = "Package"
+	FullyQualifiedSymbols   SymbolStyle = "Full"
+	DynamicSymbols          SymbolStyle = "Dynamic"
 )
 
-type HoverKind int
+type HoverKind string
 
 const (
-	SingleLine = HoverKind(iota)
-	NoDocumentation
-	SynopsisDocumentation
-	FullDocumentation
+	SingleLine            HoverKind = "SingleLine"
+	NoDocumentation       HoverKind = "NoDocumentation"
+	SynopsisDocumentation HoverKind = "SynopsisDocumentation"
+	FullDocumentation     HoverKind = "FullDocumentation"
 
 	// Structured is an experimental setting that returns a structured hover format.
 	// This format separates the signature from the documentation, so that the client
 	// can do more manipulation of these fields.
 	//
 	// This should only be used by clients that support this behavior.
-	Structured
+	Structured HoverKind = "Structured"
 )
 
 type OptionResults []OptionResult
diff --git a/internal/lsp/source/options_json.go b/internal/lsp/source/options_json.go
index f6c7e06..f0a1259 100755
--- a/internal/lsp/source/options_json.go
+++ b/internal/lsp/source/options_json.go
@@ -2,4 +2,4 @@
 
 package source
 
-const OptionsJson = "{\"Debugging\":[{\"Name\":\"verboseOutput\",\"Type\":\"bool\",\"Doc\":\"verboseOutput enables additional debug logging.\\n\",\"Default\":\"false\"},{\"Name\":\"completionBudget\",\"Type\":\"time.Duration\",\"Doc\":\"completionBudget is the soft latency goal for completion requests. Most\\nrequests finish in a couple milliseconds, but in some cases deep\\ncompletions can take much longer. As we use up our budget we\\ndynamically reduce the search scope to ensure we return timely\\nresults. Zero means unlimited.\\n\",\"Default\":\"\\\"100ms\\\"\"},{\"Name\":\"literalCompletions\",\"Type\":\"bool\",\"Doc\":\"literalCompletions controls whether literal candidates such as\\n\\\"\\u0026someStruct{}\\\" are offered. Tests disable this flag to simplify\\ntheir expected values.\\n\",\"Default\":\"true\"}],\"Experimental\":[{\"Name\":\"analyses\",\"Type\":\"map[string]bool\",\"Doc\":\"analyses specify analyses that the user would like to enable or disable.\\nA map of the names of analysis passes that should be enabled/disabled.\\nA full list of analyzers that gopls uses can be found [here](analyzers.md)\\n\\nExample Usage:\\n```json5\\n...\\n\\\"analyses\\\": {\\n  \\\"unreachable\\\": false, // Disable the unreachable analyzer.\\n  \\\"unusedparams\\\": true  // Enable the unusedparams analyzer.\\n}\\n...\\n```\\n\",\"Default\":\"null\"},{\"Name\":\"codelens\",\"Type\":\"map[string]bool\",\"Doc\":\"overrides the enabled/disabled state of various code lenses. Currently, we\\nsupport several code lenses:\\n\\n* `generate`: run `go generate` as specified by a `//go:generate` directive.\\n* `upgrade_dependency`: upgrade a dependency listed in a `go.mod` file.\\n* `test`: run `go test -run` for a test func.\\n* `gc_details`: Show the gc compiler's choices for inline analysis and escaping.\\n\\nExample Usage:\\n```json5\\n\\\"gopls\\\": {\\n...\\n  \\\"codelens\\\": {\\n    \\\"generate\\\": false,  // Don't run `go generate`.\\n    \\\"gc_details\\\": true  // Show a code lens toggling the display of gc's choices.\\n  }\\n...\\n}\\n```\\n\",\"Default\":\"{\\\"gc_details\\\":false,\\\"generate\\\":true,\\\"regenerate_cgo\\\":true,\\\"tidy\\\":true,\\\"upgrade_dependency\\\":true,\\\"vendor\\\":true}\"},{\"Name\":\"completionDocumentation\",\"Type\":\"bool\",\"Doc\":\"completionDocumentation enables documentation with completion results.\\n\",\"Default\":\"true\"},{\"Name\":\"completeUnimported\",\"Type\":\"bool\",\"Doc\":\"completeUnimported enables completion for packages that you do not currently import.\\n\",\"Default\":\"true\"},{\"Name\":\"deepCompletion\",\"Type\":\"bool\",\"Doc\":\"deepCompletion If true, this turns on the ability to return completions from deep inside relevant entities, rather than just the locally accessible ones.\\n\\nConsider this example:\\n\\n```go\\npackage main\\n\\nimport \\\"fmt\\\"\\n\\ntype wrapString struct {\\n    str string\\n}\\n\\nfunc main() {\\n    x := wrapString{\\\"hello world\\\"}\\n    fmt.Printf(\\u003c\\u003e)\\n}\\n```\\n\\nAt the location of the `\\u003c\\u003e` in this program, deep completion would suggest the result `x.str`.\\n\",\"Default\":\"true\"},{\"Name\":\"matcher\",\"Type\":\"golang.org/x/tools/internal/lsp/source.Matcher\",\"Doc\":\"matcher sets the algorithm that is used when calculating completion candidates. Must be one of:\\n\\n* `\\\"fuzzy\\\"`\\n* `\\\"caseSensitive\\\"`\\n* `\\\"caseInsensitive\\\"`\\n\",\"Default\":\"\\\"Fuzzy\\\"\"},{\"Name\":\"annotations\",\"Type\":\"map[string]bool\",\"Doc\":\"annotations suppress various kinds of optimization diagnostics\\nthat would be reported by the gc_details command.\\n  noNilcheck suppresses display of nilchecks.\\n  noEscape suppresses escape choices.\\n  noInline suppresses inlining choices.\\n  noBounds suppresses bounds checking diagnositcs.\\n\",\"Default\":\"null\"},{\"Name\":\"staticcheck\",\"Type\":\"bool\",\"Doc\":\"staticcheck enables additional analyses from staticcheck.io.\\n\",\"Default\":\"false\"},{\"Name\":\"symbolMatcher\",\"Type\":\"golang.org/x/tools/internal/lsp/source.SymbolMatcher\",\"Doc\":\"symbolMatcher sets the algorithm that is used when finding workspace symbols. Must be one of:\\n\\n* `\\\"fuzzy\\\"`\\n* `\\\"caseSensitive\\\"`\\n* `\\\"caseInsensitive\\\"`\\n\",\"Default\":\"\\\"SymbolFuzzy\\\"\"},{\"Name\":\"symbolStyle\",\"Type\":\"golang.org/x/tools/internal/lsp/source.SymbolStyle\",\"Doc\":\"symbolStyle specifies what style of symbols to return in symbol requests. Must be one of:\\n\\n* `\\\"full\\\"`\\n* `\\\"dynamic\\\"`\\n* `\\\"package\\\"`\\n\",\"Default\":\"\\\"PackageQualifiedSymbols\\\"\"},{\"Name\":\"linksInHover\",\"Type\":\"bool\",\"Doc\":\"linksInHover toggles the presence of links to documentation in hover.\\n\",\"Default\":\"true\"},{\"Name\":\"tempModfile\",\"Type\":\"bool\",\"Doc\":\"tempModfile controls the use of the -modfile flag in Go 1.14.\\n\",\"Default\":\"true\"},{\"Name\":\"importShortcut\",\"Type\":\"golang.org/x/tools/internal/lsp/source.ImportShortcut\",\"Doc\":\"importShortcut specifies whether import statements should link to\\ndocumentation or go to definitions. Must be one of:\\n\\n* `\\\"both\\\"`\\n* `\\\"link\\\"`\\n* `\\\"definition\\\"`\\n\",\"Default\":\"\\\"Both\\\"\"},{\"Name\":\"verboseWorkDoneProgress\",\"Type\":\"bool\",\"Doc\":\"verboseWorkDoneProgress controls whether the LSP server should send\\nprogress reports for all work done outside the scope of an RPC.\\n\",\"Default\":\"false\"},{\"Name\":\"expandWorkspaceToModule\",\"Type\":\"bool\",\"Doc\":\"expandWorkspaceToModule instructs `gopls` to expand the scope of the workspace to include the\\nmodules containing the workspace folders. Set this to false to avoid loading\\nyour entire module. This is particularly useful for those working in a monorepo.\\n\",\"Default\":\"true\"},{\"Name\":\"experimentalWorkspaceModule\",\"Type\":\"bool\",\"Doc\":\"experimentalWorkspaceModule opts a user into the experimental support\\nfor multi-module workspaces.\\n\",\"Default\":\"false\"}],\"User\":[{\"Name\":\"buildFlags\",\"Type\":\"[]string\",\"Doc\":\"buildFlags is the set of flags passed on to the build system when invoked.\\nIt is applied to queries like `go list`, which is used when discovering files.\\nThe most common use is to set `-tags`.\\n\",\"Default\":\"[]\"},{\"Name\":\"env\",\"Type\":\"[]string\",\"Doc\":\"env adds environment variables to external commands run by `gopls`, most notably `go list`.\\n\",\"Default\":\"[]\"},{\"Name\":\"hoverKind\",\"Type\":\"golang.org/x/tools/internal/lsp/source.HoverKind\",\"Doc\":\"hoverKind controls the information that appears in the hover text.\\nIt must be one of:\\n* `\\\"NoDocumentation\\\"`\\n* `\\\"SynopsisDocumentation\\\"`\\n* `\\\"FullDocumentation\\\"`\\n\\nAuthors of editor clients may wish to handle hover text differently, and so might use different settings. The options below are not intended for use by anyone other than the authors of editor plugins.\\n\\n* `\\\"SingleLine\\\"`\\n* `\\\"Structured\\\"`\\n\",\"Default\":\"\\\"FullDocumentation\\\"\"},{\"Name\":\"usePlaceholders\",\"Type\":\"bool\",\"Doc\":\"placeholders enables placeholders for function parameters or struct fields in completion responses.\\n\",\"Default\":\"false\"},{\"Name\":\"linkTarget\",\"Type\":\"string\",\"Doc\":\"linkTarget controls where documentation links go.\\nIt might be one of:\\n\\n* `\\\"godoc.org\\\"`\\n* `\\\"pkg.go.dev\\\"`\\n\\nIf company chooses to use its own `godoc.org`, its address can be used as well.\\n\",\"Default\":\"\\\"pkg.go.dev\\\"\"},{\"Name\":\"local\",\"Type\":\"string\",\"Doc\":\"local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after 3rd-party packages.\\nIt should be the prefix of the import path whose imports should be grouped separately.\\n\",\"Default\":\"\\\"\\\"\"},{\"Name\":\"gofumpt\",\"Type\":\"bool\",\"Doc\":\"gofumpt indicates if we should run gofumpt formatting.\\n\",\"Default\":\"false\"}]}"
+const OptionsJson = "{\"Debugging\":[{\"Name\":\"verboseOutput\",\"Type\":\"bool\",\"Doc\":\"verboseOutput enables additional debug logging.\\n\",\"EnumValues\":null,\"Default\":\"false\"},{\"Name\":\"completionBudget\",\"Type\":\"time.Duration\",\"Doc\":\"completionBudget is the soft latency goal for completion requests. Most\\nrequests finish in a couple milliseconds, but in some cases deep\\ncompletions can take much longer. As we use up our budget we\\ndynamically reduce the search scope to ensure we return timely\\nresults. Zero means unlimited.\\n\",\"EnumValues\":null,\"Default\":\"100000000\"},{\"Name\":\"literalCompletions\",\"Type\":\"bool\",\"Doc\":\"literalCompletions controls whether literal candidates such as\\n\\\"\\u0026someStruct{}\\\" are offered. Tests disable this flag to simplify\\ntheir expected values.\\n\",\"EnumValues\":null,\"Default\":\"true\"}],\"Experimental\":[{\"Name\":\"analyses\",\"Type\":\"map[string]bool\",\"Doc\":\"analyses specify analyses that the user would like to enable or disable.\\nA map of the names of analysis passes that should be enabled/disabled.\\nA full list of analyzers that gopls uses can be found [here](analyzers.md)\\n\\nExample Usage:\\n```json5\\n...\\n\\\"analyses\\\": {\\n  \\\"unreachable\\\": false, // Disable the unreachable analyzer.\\n  \\\"unusedparams\\\": true  // Enable the unusedparams analyzer.\\n}\\n...\\n```\\n\",\"EnumValues\":null,\"Default\":\"{}\"},{\"Name\":\"codelens\",\"Type\":\"map[string]bool\",\"Doc\":\"overrides the enabled/disabled state of various code lenses. Currently, we\\nsupport several code lenses:\\n\\n* `generate`: run `go generate` as specified by a `//go:generate` directive.\\n* `upgrade_dependency`: upgrade a dependency listed in a `go.mod` file.\\n* `test`: run `go test -run` for a test func.\\n* `gc_details`: Show the gc compiler's choices for inline analysis and escaping.\\n\\nExample Usage:\\n```json5\\n\\\"gopls\\\": {\\n...\\n  \\\"codelens\\\": {\\n    \\\"generate\\\": false,  // Don't run `go generate`.\\n    \\\"gc_details\\\": true  // Show a code lens toggling the display of gc's choices.\\n  }\\n...\\n}\\n```\\n\",\"EnumValues\":null,\"Default\":\"{\\\"gc_details\\\":false,\\\"generate\\\":true,\\\"regenerate_cgo\\\":true,\\\"tidy\\\":true,\\\"upgrade_dependency\\\":true,\\\"vendor\\\":true}\"},{\"Name\":\"completionDocumentation\",\"Type\":\"bool\",\"Doc\":\"completionDocumentation enables documentation with completion results.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"completeUnimported\",\"Type\":\"bool\",\"Doc\":\"completeUnimported enables completion for packages that you do not currently import.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"deepCompletion\",\"Type\":\"bool\",\"Doc\":\"deepCompletion If true, this turns on the ability to return completions from deep inside relevant entities, rather than just the locally accessible ones.\\n\\nConsider this example:\\n\\n```go\\npackage main\\n\\nimport \\\"fmt\\\"\\n\\ntype wrapString struct {\\n    str string\\n}\\n\\nfunc main() {\\n    x := wrapString{\\\"hello world\\\"}\\n    fmt.Printf(\\u003c\\u003e)\\n}\\n```\\n\\nAt the location of the `\\u003c\\u003e` in this program, deep completion would suggest the result `x.str`.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"matcher\",\"Type\":\"enum\",\"Doc\":\"matcher sets the algorithm that is used when calculating completion candidates.\\n\",\"EnumValues\":[\"\\\"CaseInsensitive\\\"\",\"\\\"CaseSensitive\\\"\",\"\\\"Fuzzy\\\"\"],\"Default\":\"\\\"Fuzzy\\\"\"},{\"Name\":\"annotations\",\"Type\":\"map[string]bool\",\"Doc\":\"annotations suppress various kinds of optimization diagnostics\\nthat would be reported by the gc_details command.\\n * noNilcheck suppresses display of nilchecks.\\n * noEscape suppresses escape choices.\\n * noInline suppresses inlining choices.\\n * noBounds suppresses bounds checking diagnostics.\\n\",\"EnumValues\":null,\"Default\":\"{}\"},{\"Name\":\"staticcheck\",\"Type\":\"bool\",\"Doc\":\"staticcheck enables additional analyses from staticcheck.io.\\n\",\"EnumValues\":null,\"Default\":\"false\"},{\"Name\":\"symbolMatcher\",\"Type\":\"enum\",\"Doc\":\"symbolMatcher sets the algorithm that is used when finding workspace symbols.\\n\",\"EnumValues\":[\"\\\"CaseInsensitive\\\"\",\"\\\"CaseSensitive\\\"\",\"\\\"Fuzzy\\\"\"],\"Default\":\"\\\"Fuzzy\\\"\"},{\"Name\":\"symbolStyle\",\"Type\":\"enum\",\"Doc\":\"symbolStyle specifies what style of symbols to return in symbol requests.\\n\",\"EnumValues\":[\"\\\"Dynamic\\\"\",\"\\\"Full\\\"\",\"\\\"Package\\\"\"],\"Default\":\"\\\"Package\\\"\"},{\"Name\":\"linksInHover\",\"Type\":\"bool\",\"Doc\":\"linksInHover toggles the presence of links to documentation in hover.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"tempModfile\",\"Type\":\"bool\",\"Doc\":\"tempModfile controls the use of the -modfile flag in Go 1.14.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"importShortcut\",\"Type\":\"enum\",\"Doc\":\"importShortcut specifies whether import statements should link to\\ndocumentation or go to definitions.\\n\",\"EnumValues\":[\"\\\"Both\\\"\",\"\\\"Definition\\\"\",\"\\\"Link\\\"\"],\"Default\":\"\\\"Both\\\"\"},{\"Name\":\"verboseWorkDoneProgress\",\"Type\":\"bool\",\"Doc\":\"verboseWorkDoneProgress controls whether the LSP server should send\\nprogress reports for all work done outside the scope of an RPC.\\n\",\"EnumValues\":null,\"Default\":\"false\"},{\"Name\":\"expandWorkspaceToModule\",\"Type\":\"bool\",\"Doc\":\"expandWorkspaceToModule instructs `gopls` to expand the scope of the workspace to include the\\nmodules containing the workspace folders. Set this to false to avoid loading\\nyour entire module. This is particularly useful for those working in a monorepo.\\n\",\"EnumValues\":null,\"Default\":\"true\"},{\"Name\":\"experimentalWorkspaceModule\",\"Type\":\"bool\",\"Doc\":\"experimentalWorkspaceModule opts a user into the experimental support\\nfor multi-module workspaces.\\n\",\"EnumValues\":null,\"Default\":\"false\"}],\"User\":[{\"Name\":\"buildFlags\",\"Type\":\"[]string\",\"Doc\":\"buildFlags is the set of flags passed on to the build system when invoked.\\nIt is applied to queries like `go list`, which is used when discovering files.\\nThe most common use is to set `-tags`.\\n\",\"EnumValues\":null,\"Default\":\"[]\"},{\"Name\":\"env\",\"Type\":\"[]string\",\"Doc\":\"env adds environment variables to external commands run by `gopls`, most notably `go list`.\\n\",\"EnumValues\":null,\"Default\":\"[]\"},{\"Name\":\"hoverKind\",\"Type\":\"enum\",\"Doc\":\"hoverKind controls the information that appears in the hover text.\\nSingleLine and Structured are intended for use only by authors of editor plugins.\\n\",\"EnumValues\":[\"\\\"FullDocumentation\\\"\",\"\\\"NoDocumentation\\\"\",\"\\\"SingleLine\\\"\",\"\\\"Structured\\\"\",\"\\\"SynopsisDocumentation\\\"\"],\"Default\":\"\\\"FullDocumentation\\\"\"},{\"Name\":\"usePlaceholders\",\"Type\":\"bool\",\"Doc\":\"placeholders enables placeholders for function parameters or struct fields in completion responses.\\n\",\"EnumValues\":null,\"Default\":\"false\"},{\"Name\":\"linkTarget\",\"Type\":\"string\",\"Doc\":\"linkTarget controls where documentation links go.\\nIt might be one of:\\n\\n* `\\\"godoc.org\\\"`\\n* `\\\"pkg.go.dev\\\"`\\n\\nIf company chooses to use its own `godoc.org`, its address can be used as well.\\n\",\"EnumValues\":null,\"Default\":\"\\\"pkg.go.dev\\\"\"},{\"Name\":\"local\",\"Type\":\"string\",\"Doc\":\"local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after 3rd-party packages.\\nIt should be the prefix of the import path whose imports should be grouped separately.\\n\",\"EnumValues\":null,\"Default\":\"\\\"\\\"\"},{\"Name\":\"gofumpt\",\"Type\":\"bool\",\"Doc\":\"gofumpt indicates if we should run gofumpt formatting.\\n\",\"EnumValues\":null,\"Default\":\"false\"}]}"