package settings

import "cuelang.org/go/internal/golangorgx/gopls/settings"

Index

Variables

var GeneratedAPIJSON = &APIJSON{
	Options: map[string][]*OptionJSON{
		"User": {
			{
				Name:      "buildFlags",
				Type:      "[]string",
				Doc:       "" /* 198 byte string literal not displayed */,
				Default:   "[]",
				Hierarchy: "build",
			},
			{
				Name:      "env",
				Type:      "map[string]string",
				Doc:       "env adds environment variables to external commands run by `gopls`, most notably `go list`.\n",
				Default:   "{}",
				Hierarchy: "build",
			},
			{
				Name:      "directoryFilters",
				Type:      "[]string",
				Doc:       "" /* 807 byte string literal not displayed */,
				Default:   "[\"-**/node_modules\"]",
				Hierarchy: "build",
			},
			{
				Name:      "templateExtensions",
				Type:      "[]string",
				Doc:       "" /* 162 byte string literal not displayed */,
				Default:   "[]",
				Hierarchy: "build",
			},
			{
				Name:      "memoryMode",
				Type:      "string",
				Doc:       "obsolete, no effect\n",
				Default:   "\"\"",
				Status:    "experimental",
				Hierarchy: "build",
			},
			{
				Name:      "expandWorkspaceToModule",
				Type:      "bool",
				Doc:       "" /* 481 byte string literal not displayed */,
				Default:   "true",
				Status:    "experimental",
				Hierarchy: "build",
			},
			{
				Name:      "allowModfileModifications",
				Type:      "bool",
				Doc:       "" /* 138 byte string literal not displayed */,
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "build",
			},
			{
				Name:      "allowImplicitNetworkAccess",
				Type:      "bool",
				Doc:       "" /* 164 byte string literal not displayed */,
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "build",
			},
			{
				Name:      "standaloneTags",
				Type:      "[]string",
				Doc:       "" /* 932 byte string literal not displayed */,
				Default:   "[\"ignore\"]",
				Hierarchy: "build",
			},
			{
				Name: "hoverKind",
				Type: "enum",
				Doc:  "" /* 153 byte string literal not displayed */,
				EnumValues: []EnumValue{
					{Value: "\"FullDocumentation\""},
					{Value: "\"NoDocumentation\""},
					{Value: "\"SingleLine\""},
					{
						Value: "\"Structured\"",
						Doc:   "" /* 277 byte string literal not displayed */,
					},
					{Value: "\"SynopsisDocumentation\""},
				},
				Default:   "\"FullDocumentation\"",
				Hierarchy: "ui.documentation",
			},
			{
				Name:      "linkTarget",
				Type:      "string",
				Doc:       "" /* 298 byte string literal not displayed */,
				Default:   "\"pkg.go.dev\"",
				Hierarchy: "ui.documentation",
			},
			{
				Name:      "linksInHover",
				Type:      "bool",
				Doc:       "linksInHover toggles the presence of links to documentation in hover.\n",
				Default:   "true",
				Hierarchy: "ui.documentation",
			},
			{
				Name:      "usePlaceholders",
				Type:      "bool",
				Doc:       "placeholders enables placeholders for function parameters or struct\nfields in completion responses.\n",
				Default:   "false",
				Hierarchy: "ui.completion",
			},
			{
				Name:      "completionBudget",
				Type:      "time.Duration",
				Doc:       "" /* 299 byte string literal not displayed */,
				Default:   "\"100ms\"",
				Status:    "debug",
				Hierarchy: "ui.completion",
			},
			{
				Name: "matcher",
				Type: "enum",
				Doc:  "matcher sets the algorithm that is used when calculating completion\ncandidates.\n",
				EnumValues: []EnumValue{
					{Value: "\"CaseInsensitive\""},
					{Value: "\"CaseSensitive\""},
					{Value: "\"Fuzzy\""},
				},
				Default:   "\"Fuzzy\"",
				Status:    "advanced",
				Hierarchy: "ui.completion",
			},
			{
				Name:      "experimentalPostfixCompletions",
				Type:      "bool",
				Doc:       "experimentalPostfixCompletions enables artificial method snippets\nsuch as \"someSlice.sort!\".\n",
				Default:   "true",
				Status:    "experimental",
				Hierarchy: "ui.completion",
			},
			{
				Name:      "completeFunctionCalls",
				Type:      "bool",
				Doc:       "" /* 252 byte string literal not displayed */,
				Default:   "true",
				Hierarchy: "ui.completion",
			},
			{
				Name: "importShortcut",
				Type: "enum",
				Doc:  "importShortcut specifies whether import statements should link to\ndocumentation or go to definitions.\n",
				EnumValues: []EnumValue{
					{Value: "\"Both\""},
					{Value: "\"Definition\""},
					{Value: "\"Link\""},
				},
				Default:   "\"Both\"",
				Hierarchy: "ui.navigation",
			},
			{
				Name: "symbolMatcher",
				Type: "enum",
				Doc:  "symbolMatcher sets the algorithm that is used when finding workspace symbols.\n",
				EnumValues: []EnumValue{
					{Value: "\"CaseInsensitive\""},
					{Value: "\"CaseSensitive\""},
					{Value: "\"FastFuzzy\""},
					{Value: "\"Fuzzy\""},
				},
				Default:   "\"FastFuzzy\"",
				Status:    "advanced",
				Hierarchy: "ui.navigation",
			},
			{
				Name: "symbolStyle",
				Type: "enum",
				Doc:  "" /* 166 byte string literal not displayed */,
				EnumValues: []EnumValue{
					{
						Value: "\"Dynamic\"",
						Doc:   "" /* 250 byte string literal not displayed */,
					},
					{
						Value: "\"Full\"",
						Doc:   "`\"Full\"` is fully qualified symbols, i.e.\n\"path/to/pkg.Foo.Field\".\n",
					},
					{
						Value: "\"Package\"",
						Doc:   "`\"Package\"` is package qualified symbols i.e.\n\"pkg.Foo.Field\".\n",
					},
				},
				Default:   "\"Dynamic\"",
				Status:    "advanced",
				Hierarchy: "ui.navigation",
			},
			{
				Name: "symbolScope",
				Type: "enum",
				Doc:  "" /* 308 byte string literal not displayed */,
				EnumValues: []EnumValue{
					{
						Value: "\"all\"",
						Doc:   "`\"all\"` matches symbols in any loaded package, including\ndependencies.\n",
					},
					{
						Value: "\"workspace\"",
						Doc:   "`\"workspace\"` matches symbols in workspace packages only.\n",
					},
				},
				Default:   "\"all\"",
				Hierarchy: "ui.navigation",
			},
			{
				Name: "analyses",
				Type: "map[string]bool",
				Doc:  "" /* 488 byte string literal not displayed */,
				EnumKeys: EnumKeys{
					ValueType: "bool",
					Keys: []EnumKey{
						{
							Name:    "\"appends\"",
							Doc:     "" /* 261 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"asmdecl\"",
							Doc:     "report mismatches between assembly files and Go declarations",
							Default: "true",
						},
						{
							Name:    "\"assign\"",
							Doc:     "" /* 190 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"atomic\"",
							Doc:     "" /* 182 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"atomicalign\"",
							Doc:     "check for non-64-bits-aligned arguments to sync/atomic functions",
							Default: "true",
						},
						{
							Name:    "\"bools\"",
							Doc:     "check for common mistakes involving boolean operators",
							Default: "true",
						},
						{
							Name:    "\"buildtag\"",
							Doc:     "check //go:build and // +build directives",
							Default: "true",
						},
						{
							Name:    "\"cgocall\"",
							Doc:     "" /* 386 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"composites\"",
							Doc:     "" /* 440 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"copylocks\"",
							Doc:     "" /* 238 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"deepequalerrors\"",
							Doc:     "" /* 245 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"defers\"",
							Doc:     "" /* 442 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"deprecated\"",
							Doc:     "" /* 243 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"directive\"",
							Doc:     "" /* 614 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"embed\"",
							Doc:     "" /* 298 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"errorsas\"",
							Doc:     "" /* 199 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"fieldalignment\"",
							Doc:     "" /* 1087 byte string literal not displayed */,
							Default: "false",
						},
						{
							Name:    "\"fillreturns\"",
							Doc:     "" /* 434 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"httpresponse\"",
							Doc:     "" /* 473 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"ifaceassert\"",
							Doc:     "" /* 520 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"infertypeargs\"",
							Doc:     "" /* 304 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"loopclosure\"",
							Doc:     "" /* 2264 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"lostcancel\"",
							Doc:     "" /* 289 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"nilfunc\"",
							Doc:     "check for useless comparisons between functions and nil\n\nA useless comparison is one like f == nil as opposed to f() == nil.",
							Default: "true",
						},
						{
							Name:    "\"nilness\"",
							Doc:     "" /* 812 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"nonewvars\"",
							Doc:     "" /* 236 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"noresultvalues\"",
							Doc:     "" /* 263 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"printf\"",
							Doc:     "" /* 1442 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"shadow\"",
							Doc:     "" /* 708 byte string literal not displayed */,
							Default: "false",
						},
						{
							Name:    "\"shift\"",
							Doc:     "check for shifts that equal or exceed the width of the integer",
							Default: "true",
						},
						{
							Name:    "\"simplifycompositelit\"",
							Doc:     "" /* 230 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"simplifyrange\"",
							Doc:     "" /* 315 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"simplifyslice\"",
							Doc:     "" /* 187 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"slog\"",
							Doc:     "" /* 519 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"sortslice\"",
							Doc:     "" /* 167 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"stdmethods\"",
							Doc:     "" /* 750 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"stringintconv\"",
							Doc:     "" /* 629 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"structtag\"",
							Doc:     "" /* 139 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"stubmethods\"",
							Doc:     "" /* 939 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"testinggoroutine\"",
							Doc:     "" /* 501 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"tests\"",
							Doc:     "" /* 380 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"timeformat\"",
							Doc:     "" /* 311 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"undeclaredname\"",
							Doc:     "" /* 314 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unmarshal\"",
							Doc:     "" /* 203 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unreachable\"",
							Doc:     "" /* 214 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unsafeptr\"",
							Doc:     "" /* 396 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unusedparams\"",
							Doc:     "" /* 1217 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unusedresult\"",
							Doc:     "" /* 435 byte string literal not displayed */,
							Default: "true",
						},
						{
							Name:    "\"unusedvariable\"",
							Doc:     "check for unused variables and suggest fixes",
							Default: "false",
						},
						{
							Name:    "\"unusedwrite\"",
							Doc:     "" /* 642 byte string literal not displayed */,
							Default: "false",
						},
						{
							Name:    "\"useany\"",
							Doc:     "check for constraints that could be simplified to \"any\"",
							Default: "false",
						},
					},
				},
				Default:   "{}",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name:      "staticcheck",
				Type:      "bool",
				Doc:       "" /* 161 byte string literal not displayed */,
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name: "annotations",
				Type: "map[string]bool",
				Doc:  "annotations specifies the various kinds of optimization diagnostics\nthat should be reported by the gc_details command.\n",
				EnumKeys: EnumKeys{
					ValueType: "bool",
					Keys: []EnumKey{
						{
							Name:    "\"bounds\"",
							Doc:     "`\"bounds\"` controls bounds checking diagnostics.\n",
							Default: "true",
						},
						{
							Name:    "\"escape\"",
							Doc:     "`\"escape\"` controls diagnostics about escape choices.\n",
							Default: "true",
						},
						{
							Name:    "\"inline\"",
							Doc:     "`\"inline\"` controls diagnostics about inlining choices.\n",
							Default: "true",
						},
						{
							Name:    "\"nil\"",
							Doc:     "`\"nil\"` controls nil checks.\n",
							Default: "true",
						},
					},
				},
				Default:   "{\"bounds\":true,\"escape\":true,\"inline\":true,\"nil\":true}",
				Status:    "experimental",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name: "vulncheck",
				Type: "enum",
				Doc:  "vulncheck enables vulnerability scanning.\n",
				EnumValues: []EnumValue{
					{
						Value: "\"Imports\"",
						Doc:   "" /* 151 byte string literal not displayed */,
					},
					{
						Value: "\"Off\"",
						Doc:   "`\"Off\"`: Disable vulnerability analysis.\n",
					},
				},
				Default:   "\"Off\"",
				Status:    "experimental",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name:      "diagnosticsDelay",
				Type:      "time.Duration",
				Doc:       "" /* 328 byte string literal not displayed */,
				Default:   "\"1s\"",
				Status:    "advanced",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name: "diagnosticsTrigger",
				Type: "enum",
				Doc:  "diagnosticsTrigger controls when to run diagnostics.\n",
				EnumValues: []EnumValue{
					{
						Value: "\"Edit\"",
						Doc:   "`\"Edit\"`: Trigger diagnostics on file edit and save. (default)\n",
					},
					{
						Value: "\"Save\"",
						Doc:   "" /* 146 byte string literal not displayed */,
					},
				},
				Default:   "\"Edit\"",
				Status:    "experimental",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name:      "analysisProgressReporting",
				Type:      "bool",
				Doc:       "" /* 556 byte string literal not displayed */,
				Default:   "true",
				Hierarchy: "ui.diagnostic",
			},
			{
				Name: "hints",
				Type: "map[string]bool",
				Doc:  "" /* 194 byte string literal not displayed */,
				EnumKeys: EnumKeys{Keys: []EnumKey{
					{
						Name:    "\"assignVariableTypes\"",
						Doc:     "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
						Default: "false",
					},
					{
						Name:    "\"compositeLiteralFields\"",
						Doc:     "" /* 133 byte string literal not displayed */,
						Default: "false",
					},
					{
						Name:    "\"compositeLiteralTypes\"",
						Doc:     "" /* 212 byte string literal not displayed */,
						Default: "false",
					},
					{
						Name:    "\"constantValues\"",
						Doc:     "" /* 185 byte string literal not displayed */,
						Default: "false",
					},
					{
						Name:    "\"functionTypeParameters\"",
						Doc:     "" /* 131 byte string literal not displayed */,
						Default: "false",
					},
					{
						Name:    "\"parameterNames\"",
						Doc:     "Enable/disable inlay hints for parameter names:\n```go\n\tparseInt(/* str: */ \"123\", /* radix: */ 8)\n```",
						Default: "false",
					},
					{
						Name:    "\"rangeVariableTypes\"",
						Doc:     "" /* 161 byte string literal not displayed */,
						Default: "false",
					},
				}},
				Default:   "{}",
				Status:    "experimental",
				Hierarchy: "ui.inlayhint",
			},
			{
				Name: "codelenses",
				Type: "map[string]bool",
				Doc:  "" /* 476 byte string literal not displayed */,
				EnumKeys: EnumKeys{
					ValueType: "bool",
					Keys: []EnumKey{
						{
							Name:    "\"gc_details\"",
							Doc:     "Toggle the calculation of gc annotations.",
							Default: "false",
						},
						{
							Name:    "\"generate\"",
							Doc:     "Runs `go generate` for a given directory.",
							Default: "true",
						},
						{
							Name:    "\"regenerate_cgo\"",
							Doc:     "Regenerates cgo definitions.",
							Default: "true",
						},
						{
							Name:    "\"run_govulncheck\"",
							Doc:     "Run vulnerability check (`govulncheck`).",
							Default: "false",
						},
						{
							Name:    "\"test\"",
							Doc:     "Runs `go test` for a specific set of test or benchmark functions.",
							Default: "false",
						},
						{
							Name:    "\"tidy\"",
							Doc:     "Runs `go mod tidy` for a module.",
							Default: "true",
						},
						{
							Name:    "\"upgrade_dependency\"",
							Doc:     "Upgrades a dependency in the go.mod file for a module.",
							Default: "true",
						},
						{
							Name:    "\"vendor\"",
							Doc:     "Runs `go mod vendor` for a module.",
							Default: "true",
						},
					},
				},
				Default:   "{\"gc_details\":false,\"generate\":true,\"regenerate_cgo\":true,\"tidy\":true,\"upgrade_dependency\":true,\"vendor\":true}",
				Hierarchy: "ui",
			},
			{
				Name:      "semanticTokens",
				Type:      "bool",
				Doc:       "semanticTokens controls whether the LSP server will send\nsemantic tokens to the client.\n",
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "ui",
			},
			{
				Name:      "noSemanticString",
				Type:      "bool",
				Doc:       "noSemanticString turns off the sending of the semantic token 'string'\n",
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "ui",
			},
			{
				Name:      "noSemanticNumber",
				Type:      "bool",
				Doc:       "noSemanticNumber  turns off the sending of the semantic token 'number'\n",
				Default:   "false",
				Status:    "experimental",
				Hierarchy: "ui",
			},
			{
				Name:      "local",
				Type:      "string",
				Doc:       "" /* 223 byte string literal not displayed */,
				Default:   "\"\"",
				Hierarchy: "formatting",
			},
			{
				Name:      "gofumpt",
				Type:      "bool",
				Doc:       "gofumpt indicates if we should run gofumpt formatting.\n",
				Default:   "false",
				Hierarchy: "formatting",
			},
			{
				Name:    "verboseOutput",
				Type:    "bool",
				Doc:     "verboseOutput enables additional debug logging.\n",
				Default: "false",
				Status:  "debug",
			},
		},
	},
	Commands: []*CommandJSON{
		{
			Command: "gopls.add_dependency",
			Title:   "Add a dependency",
			Doc:     "Adds a dependency to the go.mod file for a module.",
			ArgDoc:  "" /* 197 byte string literal not displayed */,
		},
		{
			Command: "gopls.add_import",
			Title:   "Add an import",
			Doc:     "" /* 163 byte string literal not displayed */,
			ArgDoc:  "" /* 206 byte string literal not displayed */,
		},
		{
			Command: "gopls.add_telemetry_counters",
			Title:   "Update the given telemetry counters",
			Doc:     "" /* 132 byte string literal not displayed */,
			ArgDoc:  "{\n\t// Names and Values must have the same length.\n\t\"Names\": []string,\n\t\"Values\": []int64,\n}",
		},
		{
			Command:   "gopls.apply_fix",
			Title:     "Apply a fix",
			Doc:       "Applies a fix to a region of source code.",
			ArgDoc:    "" /* 755 byte string literal not displayed */,
			ResultDoc: "" /* 1626 byte string literal not displayed */,
		},
		{
			Command:   "gopls.change_signature",
			Title:     "Perform a \"change signature\" refactoring",
			Doc:       "" /* 143 byte string literal not displayed */,
			ArgDoc:    "" /* 212 byte string literal not displayed */,
			ResultDoc: "" /* 1626 byte string literal not displayed */,
		},
		{
			Command: "gopls.check_upgrades",
			Title:   "Check for upgrades",
			Doc:     "Checks for module upgrades.",
			ArgDoc:  "{\n\t// The go.mod file URI.\n\t\"URI\": string,\n\t// The modules to check.\n\t\"Modules\": []string,\n}",
		},
		{
			Command: "gopls.diagnose_files",
			Title:   "Cause server to publish diagnostics for the specified files.",
			Doc:     "This command is needed by the 'gopls {check,fix}' CLI subcommands.",
			ArgDoc:  "{\n\t\"Files\": []string,\n}",
		},
		{
			Command: "gopls.edit_go_directive",
			Title:   "Run go mod edit -go=version",
			Doc:     "Runs `go mod edit -go=version` for a module.",
			ArgDoc:  "" /* 149 byte string literal not displayed */,
		},
		{
			Command:   "gopls.fetch_vulncheck_result",
			Title:     "Get known vulncheck result",
			Doc:       "Fetch the result of latest vulnerability check (`govulncheck`).",
			ArgDoc:    "{\n\t// The file URI.\n\t\"URI\": string,\n}",
			ResultDoc: "map[cuelang.org/go/internal/golangorgx/gopls/protocol.DocumentURI]*cuelang.org/go/internal/golangorgx/gopls/vulncheck.Result",
		},
		{
			Command: "gopls.gc_details",
			Title:   "Toggle gc_details",
			Doc:     "Toggle the calculation of gc annotations.",
			ArgDoc:  "string",
		},
		{
			Command: "gopls.generate",
			Title:   "Run go generate",
			Doc:     "Runs `go generate` for a given directory.",
			ArgDoc:  "" /* 149 byte string literal not displayed */,
		},
		{
			Command: "gopls.go_get_package",
			Title:   "'go get' a package",
			Doc:     "Runs `go get` to fetch a package.",
			ArgDoc:  "" /* 151 byte string literal not displayed */,
		},
		{
			Command:   "gopls.list_imports",
			Title:     "List imports of a file and its package",
			Doc:       "Retrieve a list of imports in the given Go file, and the package it\nbelongs to.",
			ArgDoc:    "{\n\t// The file URI.\n\t\"URI\": string,\n}",
			ResultDoc: "" /* 271 byte string literal not displayed */,
		},
		{
			Command:   "gopls.list_known_packages",
			Title:     "List known packages",
			Doc:       "Retrieve a list of packages that are importable from the given URI.",
			ArgDoc:    "{\n\t// The file URI.\n\t\"URI\": string,\n}",
			ResultDoc: "" /* 257 byte string literal not displayed */,
		},
		{
			Command: "gopls.maybe_prompt_for_telemetry",
			Title:   "Prompt user to enable telemetry",
			Doc:     "" /* 181 byte string literal not displayed */,
		},
		{
			Command:   "gopls.mem_stats",
			Title:     "Fetch memory statistics",
			Doc:       "" /* 167 byte string literal not displayed */,
			ResultDoc: "{\n\t\"HeapAlloc\": uint64,\n\t\"HeapInUse\": uint64,\n\t\"TotalAlloc\": uint64,\n}",
		},
		{
			Command: "gopls.regenerate_cgo",
			Title:   "Regenerate cgo",
			Doc:     "Regenerates cgo definitions.",
			ArgDoc:  "{\n\t// The file URI.\n\t\"URI\": string,\n}",
		},
		{
			Command: "gopls.remove_dependency",
			Title:   "Remove a dependency",
			Doc:     "Removes a dependency from the go.mod file of a module.",
			ArgDoc:  "" /* 322 byte string literal not displayed */,
		},
		{
			Command: "gopls.reset_go_mod_diagnostics",
			Title:   "Reset go.mod diagnostics",
			Doc:     "Reset diagnostics in the go.mod file of a module.",
			ArgDoc:  "" /* 205 byte string literal not displayed */,
		},
		{
			Command: "gopls.run_go_work_command",
			Title:   "Run `go work [args...]`, and apply the resulting go.work",
			Doc:     "edits to the current go.work file",
			ArgDoc:  "{\n\t\"ViewID\": string,\n\t\"InitFirst\": bool,\n\t\"Args\": []string,\n}",
		},
		{
			Command:   "gopls.run_govulncheck",
			Title:     "Run vulncheck",
			Doc:       "Run vulnerability check (`govulncheck`).",
			ArgDoc:    "" /* 171 byte string literal not displayed */,
			ResultDoc: "" /* 132 byte string literal not displayed */,
		},
		{
			Command: "gopls.run_tests",
			Title:   "Run test(s)",
			Doc:     "Runs `go test` for a specific set of test or benchmark functions.",
			ArgDoc:  "" /* 229 byte string literal not displayed */,
		},
		{
			Command:   "gopls.start_debugging",
			Title:     "Start the gopls debug server",
			Doc:       "Start the gopls debug server if it isn't running, and return the debug\naddress.",
			ArgDoc:    "" /* 815 byte string literal not displayed */,
			ResultDoc: "" /* 658 byte string literal not displayed */,
		},
		{
			Command:   "gopls.start_profile",
			Title:     "Start capturing a profile of gopls' execution",
			Doc:       "" /* 213 byte string literal not displayed */,
			ArgDoc:    "struct{}",
			ResultDoc: "struct{}",
		},
		{
			Command:   "gopls.stop_profile",
			Title:     "Stop an ongoing profile",
			Doc:       "This command is intended for internal use only, by the gopls benchmark\nrunner.",
			ArgDoc:    "struct{}",
			ResultDoc: "{\n\t// File is the profile file name.\n\t\"File\": string,\n}",
		},
		{
			Command: "gopls.test",
			Title:   "Run test(s) (legacy)",
			Doc:     "Runs `go test` for a specific set of test or benchmark functions.",
			ArgDoc:  "string,\n[]string,\n[]string",
		},
		{
			Command: "gopls.tidy",
			Title:   "Run go mod tidy",
			Doc:     "Runs `go mod tidy` for a module.",
			ArgDoc:  "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}",
		},
		{
			Command: "gopls.toggle_gc_details",
			Title:   "Toggle gc_details",
			Doc:     "Toggle the calculation of gc annotations.",
			ArgDoc:  "{\n\t// The file URI.\n\t\"URI\": string,\n}",
		},
		{
			Command: "gopls.update_go_sum",
			Title:   "Update go.sum",
			Doc:     "Updates the go.sum file for a module.",
			ArgDoc:  "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}",
		},
		{
			Command: "gopls.upgrade_dependency",
			Title:   "Upgrade a dependency",
			Doc:     "Upgrades a dependency in the go.mod file for a module.",
			ArgDoc:  "" /* 197 byte string literal not displayed */,
		},
		{
			Command: "gopls.vendor",
			Title:   "Run go mod vendor",
			Doc:     "Runs `go mod vendor` for a module.",
			ArgDoc:  "{\n\t// The file URI.\n\t\"URI\": string,\n}",
		},
		{
			Command:   "gopls.views",
			Title:     "List current Views on the server.",
			Doc:       "This command is intended for use by gopls tests only.",
			ResultDoc: "[]{\n\t\"Type\": string,\n\t\"Root\": string,\n\t\"Folder\": string,\n\t\"EnvOverlay\": []string,\n}",
		},
		{
			Command:   "gopls.workspace_stats",
			Title:     "Fetch workspace statistics",
			Doc:       "" /* 152 byte string literal not displayed */,
			ResultDoc: "" /* 480 byte string literal not displayed */,
		},
	},
	Lenses: []*LensJSON{
		{
			Lens:  "gc_details",
			Title: "Toggle gc_details",
			Doc:   "Toggle the calculation of gc annotations.",
		},
		{
			Lens:  "generate",
			Title: "Run go generate",
			Doc:   "Runs `go generate` for a given directory.",
		},
		{
			Lens:  "regenerate_cgo",
			Title: "Regenerate cgo",
			Doc:   "Regenerates cgo definitions.",
		},
		{
			Lens:  "run_govulncheck",
			Title: "Run vulncheck",
			Doc:   "Run vulnerability check (`govulncheck`).",
		},
		{
			Lens:  "test",
			Title: "Run test(s) (legacy)",
			Doc:   "Runs `go test` for a specific set of test or benchmark functions.",
		},
		{
			Lens:  "tidy",
			Title: "Run go mod tidy",
			Doc:   "Runs `go mod tidy` for a module.",
		},
		{
			Lens:  "upgrade_dependency",
			Title: "Upgrade a dependency",
			Doc:   "Upgrades a dependency in the go.mod file for a module.",
		},
		{
			Lens:  "vendor",
			Title: "Run go mod vendor",
			Doc:   "Runs `go mod vendor` for a module.",
		},
	},
	Analyzers: []*AnalyzerJSON{
		{
			Name:    "appends",
			Doc:     "" /* 261 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/appends",
			Default: true,
		},
		{
			Name:    "asmdecl",
			Doc:     "report mismatches between assembly files and Go declarations",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/asmdecl",
			Default: true,
		},
		{
			Name:    "assign",
			Doc:     "" /* 190 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/assign",
			Default: true,
		},
		{
			Name:    "atomic",
			Doc:     "" /* 182 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/atomic",
			Default: true,
		},
		{
			Name:    "atomicalign",
			Doc:     "check for non-64-bits-aligned arguments to sync/atomic functions",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/atomicalign",
			Default: true,
		},
		{
			Name:    "bools",
			Doc:     "check for common mistakes involving boolean operators",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/bools",
			Default: true,
		},
		{
			Name:    "buildtag",
			Doc:     "check //go:build and // +build directives",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/buildtag",
			Default: true,
		},
		{
			Name:    "cgocall",
			Doc:     "" /* 386 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/cgocall",
			Default: true,
		},
		{
			Name:    "composites",
			Doc:     "" /* 440 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/composite",
			Default: true,
		},
		{
			Name:    "copylocks",
			Doc:     "" /* 238 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/copylocks",
			Default: true,
		},
		{
			Name:    "deepequalerrors",
			Doc:     "" /* 245 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/deepequalerrors",
			Default: true,
		},
		{
			Name:    "defers",
			Doc:     "" /* 442 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/defers",
			Default: true,
		},
		{
			Name:    "deprecated",
			Doc:     "" /* 243 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/deprecated",
			Default: true,
		},
		{
			Name:    "directive",
			Doc:     "" /* 614 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/directive",
			Default: true,
		},
		{
			Name:    "embed",
			Doc:     "" /* 298 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/embeddirective",
			Default: true,
		},
		{
			Name:    "errorsas",
			Doc:     "" /* 199 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/errorsas",
			Default: true,
		},
		{
			Name: "fieldalignment",
			Doc:  "" /* 1087 byte string literal not displayed */,
			URL:  "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/fieldalignment",
		},
		{
			Name:    "fillreturns",
			Doc:     "" /* 434 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/fillreturns",
			Default: true,
		},
		{
			Name:    "httpresponse",
			Doc:     "" /* 473 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/httpresponse",
			Default: true,
		},
		{
			Name:    "ifaceassert",
			Doc:     "" /* 520 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/ifaceassert",
			Default: true,
		},
		{
			Name:    "infertypeargs",
			Doc:     "" /* 304 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/infertypeargs",
			Default: true,
		},
		{
			Name:    "loopclosure",
			Doc:     "" /* 2264 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/loopclosure",
			Default: true,
		},
		{
			Name:    "lostcancel",
			Doc:     "" /* 289 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/lostcancel",
			Default: true,
		},
		{
			Name:    "nilfunc",
			Doc:     "check for useless comparisons between functions and nil\n\nA useless comparison is one like f == nil as opposed to f() == nil.",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/nilfunc",
			Default: true,
		},
		{
			Name:    "nilness",
			Doc:     "" /* 812 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/nilness",
			Default: true,
		},
		{
			Name:    "nonewvars",
			Doc:     "" /* 236 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/nonewvars",
			Default: true,
		},
		{
			Name:    "noresultvalues",
			Doc:     "" /* 263 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/noresultvars",
			Default: true,
		},
		{
			Name:    "printf",
			Doc:     "" /* 1442 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/printf",
			Default: true,
		},
		{
			Name: "shadow",
			Doc:  "" /* 708 byte string literal not displayed */,
			URL:  "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/shadow",
		},
		{
			Name:    "shift",
			Doc:     "check for shifts that equal or exceed the width of the integer",
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/shift",
			Default: true,
		},
		{
			Name:    "simplifycompositelit",
			Doc:     "" /* 230 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/simplifycompositelit",
			Default: true,
		},
		{
			Name:    "simplifyrange",
			Doc:     "" /* 315 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/simplifyrange",
			Default: true,
		},
		{
			Name:    "simplifyslice",
			Doc:     "" /* 187 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/simplifyslice",
			Default: true,
		},
		{
			Name:    "slog",
			Doc:     "" /* 519 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/slog",
			Default: true,
		},
		{
			Name:    "sortslice",
			Doc:     "" /* 167 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/sortslice",
			Default: true,
		},
		{
			Name:    "stdmethods",
			Doc:     "" /* 750 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdmethods",
			Default: true,
		},
		{
			Name:    "stringintconv",
			Doc:     "" /* 629 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stringintconv",
			Default: true,
		},
		{
			Name:    "structtag",
			Doc:     "" /* 139 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/structtag",
			Default: true,
		},
		{
			Name:    "stubmethods",
			Doc:     "" /* 939 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/stubmethods",
			Default: true,
		},
		{
			Name:    "testinggoroutine",
			Doc:     "" /* 501 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/testinggoroutine",
			Default: true,
		},
		{
			Name:    "tests",
			Doc:     "" /* 380 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/tests",
			Default: true,
		},
		{
			Name:    "timeformat",
			Doc:     "" /* 311 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/timeformat",
			Default: true,
		},
		{
			Name:    "undeclaredname",
			Doc:     "" /* 314 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/undeclaredname",
			Default: true,
		},
		{
			Name:    "unmarshal",
			Doc:     "" /* 203 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unmarshal",
			Default: true,
		},
		{
			Name:    "unreachable",
			Doc:     "" /* 214 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unreachable",
			Default: true,
		},
		{
			Name:    "unsafeptr",
			Doc:     "" /* 396 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unsafeptr",
			Default: true,
		},
		{
			Name:    "unusedparams",
			Doc:     "" /* 1217 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/unusedparams",
			Default: true,
		},
		{
			Name:    "unusedresult",
			Doc:     "" /* 435 byte string literal not displayed */,
			URL:     "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unusedresult",
			Default: true,
		},
		{
			Name: "unusedvariable",
			Doc:  "check for unused variables and suggest fixes",
			URL:  "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/unusedvariable",
		},
		{
			Name: "unusedwrite",
			Doc:  "" /* 642 byte string literal not displayed */,
			URL:  "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unusedwrite",
		},
		{
			Name: "useany",
			Doc:  "check for constraints that could be simplified to \"any\"",
			URL:  "https://pkg.go.dev/cuelang.org/go/internal/golangorgx/gopls/analysis/useany",
		},
	},
	Hints: []*HintJSON{
		{
			Name: "assignVariableTypes",
			Doc:  "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
		},
		{
			Name: "compositeLiteralFields",
			Doc:  "" /* 133 byte string literal not displayed */,
		},
		{
			Name: "compositeLiteralTypes",
			Doc:  "" /* 212 byte string literal not displayed */,
		},
		{
			Name: "constantValues",
			Doc:  "" /* 185 byte string literal not displayed */,
		},
		{
			Name: "functionTypeParameters",
			Doc:  "" /* 131 byte string literal not displayed */,
		},
		{
			Name: "parameterNames",
			Doc:  "Enable/disable inlay hints for parameter names:\n```go\n\tparseInt(/* str: */ \"123\", /* radix: */ 8)\n```",
		},
		{
			Name: "rangeVariableTypes",
			Doc:  "" /* 161 byte string literal not displayed */,
		},
	},
}

Types

type APIJSON

type APIJSON struct {
	Options   map[string][]*OptionJSON
	Commands  []*CommandJSON
	Lenses    []*LensJSON
	Analyzers []*AnalyzerJSON
	Hints     []*HintJSON
}

type Analyzer

type Analyzer struct {
	Analyzer *analysis.Analyzer

	// Enabled reports whether the analyzer is enabled. This value can be
	// configured per-analysis in user settings. For staticcheck analyzers,
	// the value of the Staticcheck setting overrides this field.
	//
	// Most clients should use the IsEnabled method.
	Enabled bool

	// ActionKinds is the set of kinds of code action this analyzer produces.
	// If empty, the set is just QuickFix.
	ActionKinds []protocol.CodeActionKind

	// Severity is the severity set for diagnostics reported by this
	// analyzer. If left unset it defaults to Warning.
	//
	// Note: diagnostics with severity protocol.SeverityHint do not show up in
	// the VS Code "problems" tab.
	Severity protocol.DiagnosticSeverity

	// Tag is extra tags (unnecessary, deprecated, etc) for diagnostics
	// reported by this analyzer.
	Tag []protocol.DiagnosticTag
}

Analyzer augments a go/analysis analyzer with additional LSP configuration.

func (Analyzer) IsEnabled

func (a Analyzer) IsEnabled(options *Options) bool

IsEnabled reports whether this analyzer is enabled by the given options.

func (*Analyzer) String

func (a *Analyzer) String() string

type AnalyzerJSON

type AnalyzerJSON struct {
	Name    string
	Doc     string
	URL     string
	Default bool
}

func (*AnalyzerJSON) String

func (a *AnalyzerJSON) String() string

func (*AnalyzerJSON) Write

func (a *AnalyzerJSON) Write(w io.Writer)

type Annotation

type Annotation string
const (
	// Nil controls nil checks.
	Nil Annotation = "nil"

	// Escape controls diagnostics about escape choices.
	Escape Annotation = "escape"

	// Inline controls diagnostics about inlining choices.
	Inline Annotation = "inline"

	// Bounds controls bounds checking diagnostics.
	Bounds Annotation = "bounds"
)

type BuildOptions

type BuildOptions struct {
	// BuildFlags is the set of flags passed on to the build system when invoked.
	// It is applied to queries like `go list`, which is used when discovering files.
	// The most common use is to set `-tags`.
	BuildFlags []string

	// Env adds environment variables to external commands run by `gopls`, most notably `go list`.
	Env map[string]string

	// DirectoryFilters can be used to exclude unwanted directories from the
	// workspace. By default, all directories are included. Filters are an
	// operator, `+` to include and `-` to exclude, followed by a path prefix
	// relative to the workspace folder. They are evaluated in order, and
	// the last filter that applies to a path controls whether it is included.
	// The path prefix can be empty, so an initial `-` excludes everything.
	//
	// DirectoryFilters also supports the `**` operator to match 0 or more directories.
	//
	// Examples:
	//
	// Exclude node_modules at current depth: `-node_modules`
	//
	// Exclude node_modules at any depth: `-**/node_modules`
	//
	// Include only project_a: `-` (exclude everything), `+project_a`
	//
	// Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
	DirectoryFilters []string

	// TemplateExtensions gives the extensions of file names that are treateed
	// as template files. (The extension
	// is the part of the file name after the final dot.)
	TemplateExtensions []string

	// obsolete, no effect
	MemoryMode string `status:"experimental"`

	// ExpandWorkspaceToModule determines which packages are considered
	// "workspace packages" when the workspace is using modules.
	//
	// Workspace packages affect the scope of workspace-wide operations. Notably,
	// gopls diagnoses all packages considered to be part of the workspace after
	// every keystroke, so by setting "ExpandWorkspaceToModule" to false, and
	// opening a nested workspace directory, you can reduce the amount of work
	// gopls has to do to keep your workspace up to date.
	ExpandWorkspaceToModule bool `status:"experimental"`

	// AllowModfileModifications disables -mod=readonly, allowing imports from
	// out-of-scope modules. This option will eventually be removed.
	AllowModfileModifications bool `status:"experimental"`

	// AllowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module
	// downloads rather than requiring user action. This option will eventually
	// be removed.
	AllowImplicitNetworkAccess bool `status:"experimental"`

	// StandaloneTags specifies a set of build constraints that identify
	// individual Go source files that make up the entire main package of an
	// executable.
	//
	// A common example of standalone main files is the convention of using the
	// directive `//go:build ignore` to denote files that are not intended to be
	// included in any package, for example because they are invoked directly by
	// the developer using `go run`.
	//
	// Gopls considers a file to be a standalone main file if and only if it has
	// package name "main" and has a build directive of the exact form
	// "//go:build tag" or "// +build tag", where tag is among the list of tags
	// configured by this setting. Notably, if the build constraint is more
	// complicated than a simple tag (such as the composite constraint
	// `//go:build tag && go1.18`), the file is not considered to be a standalone
	// main file.
	//
	// This setting is only supported when gopls is built with Go 1.16 or later.
	StandaloneTags []string
}

type ClientOptions

type ClientOptions struct {
	ClientInfo                                 *protocol.ClientInfo
	InsertTextFormat                           protocol.InsertTextFormat
	ConfigurationSupported                     bool
	DynamicConfigurationSupported              bool
	DynamicRegistrationSemanticTokensSupported bool
	DynamicWatchedFilesSupported               bool
	RelativePatternsSupported                  bool
	PreferredContentFormat                     protocol.MarkupKind
	LineFoldingOnly                            bool
	HierarchicalDocumentSymbolSupport          bool
	SemanticTypes                              []string
	SemanticMods                               []string
	RelatedInformationSupported                bool
	CompletionTags                             bool
	CompletionDeprecated                       bool
	SupportedResourceOperations                []protocol.ResourceOperationKind
	CodeActionResolveOptions                   []string
}

ClientOptions holds LSP-specific configuration that is provided by the client.

type CommandJSON

type CommandJSON struct {
	Command   string
	Title     string
	Doc       string
	ArgDoc    string
	ResultDoc string
}

func (*CommandJSON) String

func (c *CommandJSON) String() string

func (*CommandJSON) Write

func (c *CommandJSON) Write(w io.Writer)

type CompletionOptions

type CompletionOptions struct {
	// Placeholders enables placeholders for function parameters or struct
	// fields in completion responses.
	UsePlaceholders bool

	// CompletionBudget is the soft latency goal for completion requests. Most
	// requests finish in a couple milliseconds, but in some cases deep
	// completions can take much longer. As we use up our budget we
	// dynamically reduce the search scope to ensure we return timely
	// results. Zero means unlimited.
	CompletionBudget time.Duration `status:"debug"`

	// Matcher sets the algorithm that is used when calculating completion
	// candidates.
	Matcher Matcher `status:"advanced"`

	// ExperimentalPostfixCompletions enables artificial method snippets
	// such as "someSlice.sort!".
	ExperimentalPostfixCompletions bool `status:"experimental"`

	// CompleteFunctionCalls enables function call completion.
	//
	// When completing a statement, or when a function return type matches the
	// expected of the expression being completed, completion may suggest call
	// expressions (i.e. may include parentheses).
	CompleteFunctionCalls bool
}

type DiagnosticOptions

type DiagnosticOptions struct {
	// Analyses specify analyses that the user would like to enable or disable.
	// A map of the names of analysis passes that should be enabled/disabled.
	// A full list of analyzers that gopls uses can be found in
	// [analyzers.md](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).
	//
	// Example Usage:
	//
	// ```json5
	// ...
	// "analyses": {
	//   "unreachable": false, // Disable the unreachable analyzer.
	//   "unusedvariable": true  // Enable the unusedvariable analyzer.
	// }
	// ...
	// ```
	Analyses map[string]bool

	// Staticcheck enables additional analyses from staticcheck.io.
	// These analyses are documented on
	// [Staticcheck's website](https://staticcheck.io/docs/checks/).
	Staticcheck bool `status:"experimental"`

	// Annotations specifies the various kinds of optimization diagnostics
	// that should be reported by the gc_details command.
	Annotations map[Annotation]bool `status:"experimental"`

	// 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"`.
	DiagnosticsDelay time.Duration `status:"advanced"`

	// DiagnosticsTrigger controls when to run diagnostics.
	DiagnosticsTrigger DiagnosticsTrigger `status:"experimental"`

	// AnalysisProgressReporting controls whether gopls sends progress
	// notifications when construction of its index of analysis facts is taking a
	// long time. Cancelling these notifications will cancel the indexing task,
	// though it will restart after the next change in the workspace.
	//
	// When a package is opened for the first time and heavyweight analyses such as
	// staticcheck are enabled, it can take a while to construct the index of
	// analysis facts for all its dependencies. The index is cached in the
	// filesystem, so subsequent analysis should be faster.
	AnalysisProgressReporting bool
}

type DiagnosticsTrigger

type DiagnosticsTrigger string
const (
	// Trigger diagnostics on file edit and save. (default)
	DiagnosticsOnEdit DiagnosticsTrigger = "Edit"
	// Trigger diagnostics only on file save. Events like initial workspace load
	// or configuration change will still trigger diagnostics.
	DiagnosticsOnSave DiagnosticsTrigger = "Save"
)

type DocumentationOptions

type DocumentationOptions struct {
	// HoverKind controls the information that appears in the hover text.
	// SingleLine and Structured are intended for use only by authors of editor plugins.
	HoverKind HoverKind

	// LinkTarget controls where documentation links go.
	// It might be one of:
	//
	// * `"godoc.org"`
	// * `"pkg.go.dev"`
	//
	// If company chooses to use its own `godoc.org`, its address can be used as well.
	//
	// Modules matching the GOPRIVATE environment variable will not have
	// documentation links in hover.
	LinkTarget string

	// LinksInHover toggles the presence of links to documentation in hover.
	LinksInHover bool
}

type EnumKey

type EnumKey struct {
	Name    string
	Doc     string
	Default string
}

type EnumKeys

type EnumKeys struct {
	ValueType string
	Keys      []EnumKey
}

type EnumValue

type EnumValue struct {
	Value string
	Doc   string
}

type FormattingOptions

type FormattingOptions struct {
	// Local is the equivalent of the `goimports -local` flag, which puts
	// imports beginning with this string after third-party packages. It should
	// be the prefix of the import path whose imports should be grouped
	// separately.
	Local string

	// Gofumpt indicates if we should run gofumpt formatting.
	Gofumpt bool
}

type HintJSON

type HintJSON struct {
	Name    string
	Doc     string
	Default bool
}

func (*HintJSON) String

func (h *HintJSON) String() string

func (*HintJSON) Write

func (h *HintJSON) Write(w io.Writer)

type Hooks

type Hooks struct {
	// LicensesText holds third party licenses for software used by gopls.
	LicensesText string

	// Whether staticcheck is supported.
	StaticcheckSupported bool

	// URLRegexp is used to find potential URLs in comments/strings.
	//
	// Not all matches are shown to the user: if the matched URL is not detected
	// as valid, it will be skipped.
	URLRegexp *regexp.Regexp

	// GofumptFormat allows the gopls module to wire-in a call to
	// gofumpt/format.Source. langVersion and modulePath are used for some
	// Gofumpt formatting rules -- see the Gofumpt documentation for details.
	GofumptFormat func(ctx context.Context, langVersion, modulePath string, src []byte) ([]byte, error)

	DefaultAnalyzers     map[string]*Analyzer
	StaticcheckAnalyzers map[string]*Analyzer
}

Hooks contains configuration that is provided to the Gopls command by the main package.

type HoverKind

type HoverKind string
const (
	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 HoverKind = "Structured"
)

type ImportShortcut

type ImportShortcut string
const (
	BothShortcuts      ImportShortcut = "Both"
	LinkShortcut       ImportShortcut = "Link"
	DefinitionShortcut ImportShortcut = "Definition"
)

func (ImportShortcut) ShowDefinition

func (s ImportShortcut) ShowDefinition() bool
func (s ImportShortcut) ShowLinks() bool

type InlayHintOptions

type InlayHintOptions struct {
	// Hints specify inlay hints that users want to see. A full list of hints
	// that gopls uses can be found in
	// [inlayHints.md](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md).
	Hints map[string]bool `status:"experimental"`
}

type InternalOptions

type InternalOptions struct {
	// VerboseWorkDoneProgress controls whether the LSP server should send
	// progress reports for all work done outside the scope of an RPC.
	// Used by the regression tests.
	VerboseWorkDoneProgress bool

	// CompletionDocumentation enables documentation with completion results.
	CompletionDocumentation bool

	// CompleteUnimported enables completion for packages that you do not
	// currently import.
	CompleteUnimported bool

	// DeepCompletion enables the ability to return completions from deep
	// inside relevant entities, rather than just the locally accessible ones.
	//
	// Consider this example:
	//
	// ```go
	// package main
	//
	// import "fmt"
	//
	// type wrapString struct {
	//     str string
	// }
	//
	// func main() {
	//     x := wrapString{"hello world"}
	//     fmt.Printf(<>)
	// }
	// ```
	//
	// At the location of the `<>` in this program, deep completion would suggest
	// the result `x.str`.
	DeepCompletion bool

	// ShowBugReports causes a message to be shown when the first bug is reported
	// on the server.
	// This option applies only during initialization.
	ShowBugReports bool

	// SubdirWatchPatterns configures the file watching glob patterns registered
	// by gopls.
	//
	// Some clients (namely VS Code) do not send workspace/didChangeWatchedFile
	// notifications for files contained in a directory when that directory is
	// deleted:
	// https://github.com/microsoft/vscode/issues/109754
	//
	// In this case, gopls would miss important notifications about deleted
	// packages. To work around this, gopls registers a watch pattern for each
	// directory containing Go files.
	//
	// Unfortunately, other clients experience performance problems with this
	// many watch patterns, so there is no single behavior that works well for
	// all clients.
	//
	// The "subdirWatchPatterns" setting allows configuring this behavior. Its
	// default value of "auto" attempts to guess the correct behavior based on
	// the client name. We'd love to avoid this specialization, but as described
	// above there is no single value that works for all clients.
	//
	// If any LSP client does not behave well with the default value (for
	// example, if like VS Code it drops file notifications), please file an
	// issue.
	SubdirWatchPatterns SubdirWatchPatterns

	// ReportAnalysisProgressAfter sets the duration for gopls to wait before starting
	// progress reporting for ongoing go/analysis passes.
	//
	// It is intended to be used for testing only.
	ReportAnalysisProgressAfter time.Duration

	// TelemetryPrompt controls whether gopls prompts about enabling Go telemetry.
	//
	// Once the prompt is answered, gopls doesn't ask again, but TelemetryPrompt
	// can prevent the question from ever being asked in the first place.
	TelemetryPrompt bool

	// LinkifyShowMessage controls whether the client wants gopls
	// to linkify links in showMessage. e.g. [go.dev](https://go.dev).
	LinkifyShowMessage bool

	// IncludeReplaceInWorkspace controls whether locally replaced modules in a
	// go.mod file are treated like workspace modules.
	// Or in other words, if a go.mod file with local replaces behaves like a
	// go.work file.
	IncludeReplaceInWorkspace bool

	// ZeroConfig enables the zero-config algorithm for workspace layout,
	// dynamically creating build configurations for different modules,
	// directories, and GOOS/GOARCH combinations to cover open files.
	ZeroConfig bool
}

InternalOptions contains settings that are not intended for use by the average user. These may be settings used by tests or outdated settings that will soon be deprecated. Some of these settings may not even be configurable by the user.

TODO(rfindley): even though these settings are not intended for modification, some of them should be surfaced in our documentation.

type LensJSON

type LensJSON struct {
	Lens  string
	Title string
	Doc   string
}

func (*LensJSON) String

func (l *LensJSON) String() string

func (*LensJSON) Write

func (l *LensJSON) Write(w io.Writer)

type Matcher

type Matcher string
const (
	Fuzzy           Matcher = "Fuzzy"
	CaseInsensitive Matcher = "CaseInsensitive"
	CaseSensitive   Matcher = "CaseSensitive"
)
type NavigationOptions struct {
	// ImportShortcut specifies whether import statements should link to
	// documentation or go to definitions.
	ImportShortcut ImportShortcut

	// SymbolMatcher sets the algorithm that is used when finding workspace symbols.
	SymbolMatcher SymbolMatcher `status:"advanced"`

	// SymbolStyle controls how symbols are qualified in symbol responses.
	//
	// Example Usage:
	//
	// ```json5
	// "gopls": {
	// ...
	//   "symbolStyle": "Dynamic",
	// ...
	// }
	// ```
	SymbolStyle SymbolStyle `status:"advanced"`

	// SymbolScope controls which packages are searched for workspace/symbol
	// requests. The default value, "workspace", searches only workspace
	// packages. The legacy behavior, "all", causes all loaded packages to be
	// searched, including dependencies; this is more expensive and may return
	// unwanted results.
	SymbolScope SymbolScope
}

type OptionJSON

type OptionJSON struct {
	Name       string
	Type       string
	Doc        string
	EnumKeys   EnumKeys
	EnumValues []EnumValue
	Default    string
	Status     string
	Hierarchy  string
}

func (*OptionJSON) String

func (o *OptionJSON) String() string

func (*OptionJSON) Write

func (o *OptionJSON) Write(w io.Writer)

type OptionResult

type OptionResult struct {
	Name  string
	Value any
	Error error
}

type OptionResults

type OptionResults []OptionResult

func SetOptions

func SetOptions(options *Options, opts any) OptionResults

type Options

Options holds various configuration that affects Gopls execution, organized by the nature or origin of the settings.

func DefaultOptions

func DefaultOptions(overrides ...func(*Options)) *Options

DefaultOptions is the options that are used for Gopls execution independent of any externally provided configuration (LSP initialization, command invocation, etc.).

func (*Options) AddStaticcheckAnalyzer

func (o *Options) AddStaticcheckAnalyzer(a *analysis.Analyzer, enabled bool, severity protocol.DiagnosticSeverity)

func (*Options) Clone

func (o *Options) Clone() *Options

func (*Options) EnableAllExperiments

func (o *Options) EnableAllExperiments()

EnableAllExperiments turns on all of the experimental "off-by-default" features offered by gopls. Any experimental features specified in maps should be enabled in enableAllExperimentMaps.

func (*Options) ForClientCapabilities

func (o *Options) ForClientCapabilities(clientName *protocol.ClientInfo, caps protocol.ClientCapabilities)

func (*Options) IsAnalyzerEnabled

func (opts *Options) IsAnalyzerEnabled(name string) bool

IsAnalyzerEnabled reports whether an analyzer with the given name is enabled.

TODO(rfindley): refactor to simplify this function. We no longer need the different categories of analyzer.

type ServerOptions

type ServerOptions struct {
	SupportedCodeActions map[file.Kind]map[protocol.CodeActionKind]bool
	SupportedCommands    []string
}

ServerOptions holds LSP-specific configuration that is provided by the server.

type SoftError

type SoftError struct {
	// contains filtered or unexported fields
}

A SoftError is an error that does not affect the functionality of gopls.

func (*SoftError) Error

func (e *SoftError) Error() string

type SubdirWatchPatterns

type SubdirWatchPatterns string
const (
	SubdirWatchPatternsOn   SubdirWatchPatterns = "on"
	SubdirWatchPatternsOff  SubdirWatchPatterns = "off"
	SubdirWatchPatternsAuto SubdirWatchPatterns = "auto"
)

type SymbolMatcher

type SymbolMatcher string

A SymbolMatcher controls the matching of symbols for workspace/symbol requests.

const (
	SymbolFuzzy           SymbolMatcher = "Fuzzy"
	SymbolFastFuzzy       SymbolMatcher = "FastFuzzy"
	SymbolCaseInsensitive SymbolMatcher = "CaseInsensitive"
	SymbolCaseSensitive   SymbolMatcher = "CaseSensitive"
)

type SymbolScope

type SymbolScope string

A SymbolScope controls the search scope for workspace/symbol requests.

const (
	// WorkspaceSymbolScope matches symbols in workspace packages only.
	WorkspaceSymbolScope SymbolScope = "workspace"
	// AllSymbolScope matches symbols in any loaded package, including
	// dependencies.
	AllSymbolScope SymbolScope = "all"
)

type SymbolStyle

type SymbolStyle string

A SymbolStyle controls the formatting of symbols in workspace/symbol results.

const (
	// PackageQualifiedSymbols is package qualified symbols i.e.
	// "pkg.Foo.Field".
	PackageQualifiedSymbols SymbolStyle = "Package"
	// FullyQualifiedSymbols is fully qualified symbols, i.e.
	// "path/to/pkg.Foo.Field".
	FullyQualifiedSymbols SymbolStyle = "Full"
	// DynamicSymbols uses whichever qualifier results in the highest scoring
	// match for the given symbol query. Here a "qualifier" is any "/" or "."
	// delimited suffix of the fully qualified symbol. i.e. "to/pkg.Foo.Field" or
	// just "Foo.Field".
	DynamicSymbols SymbolStyle = "Dynamic"
)

type UIOptions

type UIOptions struct {
	DocumentationOptions
	CompletionOptions
	NavigationOptions
	DiagnosticOptions
	InlayHintOptions

	// Codelenses overrides the enabled/disabled state of code lenses. See the
	// "Code Lenses" section of the
	// [Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#code-lenses)
	// for the list of supported lenses.
	//
	// Example Usage:
	//
	// ```json5
	// "gopls": {
	// ...
	//   "codelenses": {
	//     "generate": false,  // Don't show the `go generate` lens.
	//     "gc_details": true  // Show a code lens toggling the display of gc's choices.
	//   }
	// ...
	// }
	// ```
	Codelenses map[string]bool

	// SemanticTokens controls whether the LSP server will send
	// semantic tokens to the client.
	SemanticTokens bool `status:"experimental"`

	// NoSemanticString turns off the sending of the semantic token 'string'
	NoSemanticString bool `status:"experimental"`

	// NoSemanticNumber  turns off the sending of the semantic token 'number'
	NoSemanticNumber bool `status:"experimental"`
}

type UserOptions

type UserOptions struct {
	BuildOptions
	UIOptions
	FormattingOptions

	// VerboseOutput enables additional debug logging.
	VerboseOutput bool `status:"debug"`
}

UserOptions holds custom Gopls configuration (not part of the LSP) that is modified by the client.

func (*UserOptions) EnvSlice

func (u *UserOptions) EnvSlice() []string

EnvSlice returns Env as a slice of k=v strings.

func (*UserOptions) SetEnvSlice

func (u *UserOptions) SetEnvSlice(env []string)

SetEnvSlice sets Env from a slice of k=v strings.

Source Files

analyzer.go api_json.go default.go json.go settings.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
8 hours ago

Tools for package owners.