.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.6.9 / doc / commands.md
1 # Commands
2
3 This document describes the LSP-level commands supported by `gopls`. They cannot be invoked directly by users, and all the details are subject to change, so nobody should rely on this information.
4
5 <!-- BEGIN Commands: DO NOT MANUALLY EDIT THIS SECTION -->
6 ### **Add dependency**
7 Identifier: `gopls.add_dependency`
8
9 Adds a dependency to the go.mod file for a module.
10
11 Args:
12
13 ```
14 {
15         // The go.mod file URI.
16         "URI": string,
17         // Additional args to pass to the go command.
18         "GoCmdArgs": []string,
19         // Whether to add a require directive.
20         "AddRequire": bool,
21 }
22 ```
23
24 ### ****
25 Identifier: `gopls.add_import`
26
27
28
29 Args:
30
31 ```
32 {
33         "ImportPath": string,
34         "URI": string,
35 }
36 ```
37
38 ### **Apply a fix**
39 Identifier: `gopls.apply_fix`
40
41 Applies a fix to a region of source code.
42
43 Args:
44
45 ```
46 {
47         // The fix to apply.
48         "Fix": string,
49         // The file URI for the document to fix.
50         "URI": string,
51         // The document range to scan for fixes.
52         "Range": {
53                 "start": {
54                         "line": uint32,
55                         "character": uint32,
56                 },
57                 "end": {
58                         "line": uint32,
59                         "character": uint32,
60                 },
61         },
62 }
63 ```
64
65 ### **Check for upgrades**
66 Identifier: `gopls.check_upgrades`
67
68 Checks for module upgrades.
69
70 Args:
71
72 ```
73 {
74         // The go.mod file URI.
75         "URI": string,
76         // The modules to check.
77         "Modules": []string,
78 }
79 ```
80
81 ### **Toggle gc_details**
82 Identifier: `gopls.gc_details`
83
84 Toggle the calculation of gc annotations.
85
86 Args:
87
88 ```
89 string
90 ```
91
92 ### **Run go generate**
93 Identifier: `gopls.generate`
94
95 Runs `go generate` for a given directory.
96
97 Args:
98
99 ```
100 {
101         // URI for the directory to generate.
102         "Dir": string,
103         // Whether to generate recursively (go generate ./...)
104         "Recursive": bool,
105 }
106 ```
107
108 ### **Generate gopls.mod**
109 Identifier: `gopls.generate_gopls_mod`
110
111 (Re)generate the gopls.mod file for a workspace.
112
113 Args:
114
115 ```
116 {
117         // The file URI.
118         "URI": string,
119 }
120 ```
121
122 ### **go get package**
123 Identifier: `gopls.go_get_package`
124
125 Runs `go get` to fetch a package.
126
127 Args:
128
129 ```
130 {
131         // Any document URI within the relevant module.
132         "URI": string,
133         // The package to go get.
134         "Pkg": string,
135         "AddRequire": bool,
136 }
137 ```
138
139 ### ****
140 Identifier: `gopls.list_known_packages`
141
142
143
144 Args:
145
146 ```
147 {
148         // The file URI.
149         "URI": string,
150 }
151 ```
152
153 ### **Regenerate cgo**
154 Identifier: `gopls.regenerate_cgo`
155
156 Regenerates cgo definitions.
157
158 Args:
159
160 ```
161 {
162         // The file URI.
163         "URI": string,
164 }
165 ```
166
167 ### **Remove dependency**
168 Identifier: `gopls.remove_dependency`
169
170 Removes a dependency from the go.mod file of a module.
171
172 Args:
173
174 ```
175 {
176         // The go.mod file URI.
177         "URI": string,
178         // The module path to remove.
179         "ModulePath": string,
180         "OnlyDiagnostic": bool,
181 }
182 ```
183
184 ### **Run test(s)**
185 Identifier: `gopls.run_tests`
186
187 Runs `go test` for a specific set of test or benchmark functions.
188
189 Args:
190
191 ```
192 {
193         // The test file containing the tests to run.
194         "URI": string,
195         // Specific test names to run, e.g. TestFoo.
196         "Tests": []string,
197         // Specific benchmarks to run, e.g. BenchmarkFoo.
198         "Benchmarks": []string,
199 }
200 ```
201
202 ### **Run test(s) (legacy)**
203 Identifier: `gopls.test`
204
205 Runs `go test` for a specific set of test or benchmark functions.
206
207 Args:
208
209 ```
210 string,
211 []string,
212 []string
213 ```
214
215 ### **Run go mod tidy**
216 Identifier: `gopls.tidy`
217
218 Runs `go mod tidy` for a module.
219
220 Args:
221
222 ```
223 {
224         // The file URIs.
225         "URIs": []string,
226 }
227 ```
228
229 ### **Toggle gc_details**
230 Identifier: `gopls.toggle_gc_details`
231
232 Toggle the calculation of gc annotations.
233
234 Args:
235
236 ```
237 {
238         // The file URI.
239         "URI": string,
240 }
241 ```
242
243 ### **Update go.sum**
244 Identifier: `gopls.update_go_sum`
245
246 Updates the go.sum file for a module.
247
248 Args:
249
250 ```
251 {
252         // The file URIs.
253         "URIs": []string,
254 }
255 ```
256
257 ### **Upgrade dependency**
258 Identifier: `gopls.upgrade_dependency`
259
260 Upgrades a dependency in the go.mod file for a module.
261
262 Args:
263
264 ```
265 {
266         // The go.mod file URI.
267         "URI": string,
268         // Additional args to pass to the go command.
269         "GoCmdArgs": []string,
270         // Whether to add a require directive.
271         "AddRequire": bool,
272 }
273 ```
274
275 ### **Run go mod vendor**
276 Identifier: `gopls.vendor`
277
278 Runs `go mod vendor` for a module.
279
280 Args:
281
282 ```
283 {
284         // The file URI.
285         "URI": string,
286 }
287 ```
288
289 <!-- END Commands: DO NOT MANUALLY EDIT THIS SECTION -->