1# Settings
2
3<!--TODO: Generate this file from the documentation in golang/org/x/tools/internal/lsp/source/options.go.-->
4
5This document describes the global settings for `gopls` inside the editor. The settings block will be called `"gopls"` and contains a collection of controls for `gopls` that the editor is not expected to understand or control. These settings can also be configured differently per workspace folder.
6
7In VSCode, this would be a section in your `settings.json` file that might look like this:
8
9```json5
10  "gopls": {
11    "usePlaceholders": true,
12    "completeUnimported": true
13  },
14```
15
16## Officially supported
17
18Below is the list of settings that are officially supported for `gopls`.
19
20### **buildFlags** *array of strings*
21
22This 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`.
23
24### **env** *map of string to value*
25
26This can be used to add environment variables. These will not affect `gopls` itself, but will be used for any external commands it invokes.
27
28### **hoverKind** *string*
29
30This controls the information that appears in the hover text.
31It must be one of:
32* `"NoDocumentation"`
33* `"SynopsisDocumentation"`
34* `"FullDocumentation"`
35
36Authors 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.
37
38* `"SingleLine"`
39* `"Structured"`
40
41Default: `"SynopsisDocumentation"`.
42
43### **usePlaceholders** *boolean*
44
45If true, then completion responses may contain placeholders for function parameters or struct fields.
46
47Default: `false`.
48
49## Experimental
50
51The below settings are considered experimental. They may be deprecated or changed in the future. They are typically used to test experimental opt-in features or to disable features.
52
53### **experimentalDisabledAnalyses** *array of strings*
54
55A list of the names of analysis passes that should be disabled. You can use this to turn off analyses that you feel are not useful in the editor.
56
57### **staticcheck** *boolean*
58
59If true, it enables the use of the staticcheck.io analyzers.
60
61### **completionDocumentation** *boolean*
62
63If false, indicates that the user does not want documentation with completion results.
64
65Default value: `true`.
66
67### **completeUnimported** *boolean*
68
69If true, the completion engine is allowed to make suggestions for packages that you do not currently import.
70
71Default: `false`.
72
73### **deepCompletion** *boolean*
74
75If true, this turns on the ability to return completions from deep inside relevant entities, rather than just the locally accessible ones.
76
77Default: `true`.
78
79Consider this example:
80
81```go
82package main
83
84import "fmt"
85
86type wrapString struct {
87    str string
88}
89
90func main() {
91    x := wrapString{"hello world"}
92    fmt.Printf(<>)
93}
94```
95
96At the location of the `<>` in this program, deep completion would suggest the result `x.str`.
97
98### **fuzzyMatching** *boolean*
99
100If true, this enables server side fuzzy matching of completion candidates.
101
102Default: `true`.
103