Skip to content

Commit 5ab06b0

Browse files
committed
internal/lsp/source: sort commands alphabetically
For stability and to ease navigation, sort commands alphabetically. This will simplify the diff in later CLs, where command discovery is refactored. Change-Id: I346cbc2162b1b4dbac16572a653c4169b93cc0f3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/290390 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 5941677 commit 5ab06b0

File tree

4 files changed

+125
-125
lines changed

4 files changed

+125
-125
lines changed

gopls/doc/commands.md

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,65 @@
33
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.
44

55
<!-- BEGIN Commands: DO NOT MANUALLY EDIT THIS SECTION -->
6-
### **Run go generate**
7-
Identifier: `gopls.generate`
8-
9-
generate runs `go generate` for a given directory.
10-
11-
12-
### **Fill struct**
13-
Identifier: `gopls.fill_struct`
6+
### **Add dependency**
7+
Identifier: `gopls.add_dependency`
148

15-
fill_struct is a gopls command to fill a struct with default
16-
values.
9+
add_dependency adds a dependency.
1710

1811

19-
### **Regenerate cgo**
20-
Identifier: `gopls.regenerate_cgo`
12+
### **Check for upgrades**
13+
Identifier: `gopls.check_upgrades`
2114

22-
regenerate_cgo regenerates cgo definitions.
15+
check_upgrades checks for module upgrades.
2316

2417

25-
### **Run test(s)**
26-
Identifier: `gopls.test`
18+
### **Extract to function**
19+
Identifier: `gopls.extract_function`
2720

28-
test runs `go test` for a specific test function.
21+
extract_function extracts statements to a function.
2922

3023

31-
### **Run go mod tidy**
32-
Identifier: `gopls.tidy`
24+
### **Extract to variable**
25+
Identifier: `gopls.extract_variable`
3326

34-
tidy runs `go mod tidy` for a module.
27+
extract_variable extracts an expression to a variable.
3528

3629

37-
### **Update go.sum**
38-
Identifier: `gopls.update_go_sum`
30+
### **Fill struct**
31+
Identifier: `gopls.fill_struct`
3932

40-
update_go_sum updates the go.sum file for a module.
33+
fill_struct is a gopls command to fill a struct with default
34+
values.
4135

4236

43-
### **Undeclared name**
44-
Identifier: `gopls.undeclared_name`
37+
### **Toggle gc_details**
38+
Identifier: `gopls.gc_details`
4539

46-
undeclared_name adds a variable declaration for an undeclared
47-
name.
40+
gc_details controls calculation of gc annotations.
4841

4942

50-
### **go get package**
51-
Identifier: `gopls.go_get_package`
43+
### **Run go generate**
44+
Identifier: `gopls.generate`
5245

53-
go_get_package runs `go get` to fetch a package.
46+
generate runs `go generate` for a given directory.
5447

5548

56-
### **Check for upgrades**
57-
Identifier: `gopls.check_upgrades`
49+
### **Generate gopls.mod**
50+
Identifier: `gopls.generate_gopls_mod`
5851

59-
check_upgrades checks for module upgrades.
52+
generate_gopls_mod (re)generates the gopls.mod file.
6053

6154

62-
### **Add dependency**
63-
Identifier: `gopls.add_dependency`
55+
### **go get package**
56+
Identifier: `gopls.go_get_package`
6457

65-
add_dependency adds a dependency.
58+
go_get_package runs `go get` to fetch a package.
6659

6760

68-
### **Upgrade dependency**
69-
Identifier: `gopls.upgrade_dependency`
61+
### **Regenerate cgo**
62+
Identifier: `gopls.regenerate_cgo`
7063

71-
upgrade_dependency upgrades a dependency.
64+
regenerate_cgo regenerates cgo definitions.
7265

7366

7467
### **Remove dependency**
@@ -77,34 +70,41 @@ Identifier: `gopls.remove_dependency`
7770
remove_dependency removes a dependency.
7871

7972

80-
### **Run go mod vendor**
81-
Identifier: `gopls.vendor`
73+
### **Run test(s)**
74+
Identifier: `gopls.test`
8275

83-
vendor runs `go mod vendor` for a module.
76+
test runs `go test` for a specific test function.
8477

8578

86-
### **Extract to variable**
87-
Identifier: `gopls.extract_variable`
79+
### **Run go mod tidy**
80+
Identifier: `gopls.tidy`
8881

89-
extract_variable extracts an expression to a variable.
82+
tidy runs `go mod tidy` for a module.
9083

9184

92-
### **Extract to function**
93-
Identifier: `gopls.extract_function`
85+
### **Undeclared name**
86+
Identifier: `gopls.undeclared_name`
9487

95-
extract_function extracts statements to a function.
88+
undeclared_name adds a variable declaration for an undeclared
89+
name.
9690

9791

98-
### **Toggle gc_details**
99-
Identifier: `gopls.gc_details`
92+
### **Update go.sum**
93+
Identifier: `gopls.update_go_sum`
10094

101-
gc_details controls calculation of gc annotations.
95+
update_go_sum updates the go.sum file for a module.
10296

10397

104-
### **Generate gopls.mod**
105-
Identifier: `gopls.generate_gopls_mod`
98+
### **Upgrade dependency**
99+
Identifier: `gopls.upgrade_dependency`
106100

107-
generate_gopls_mod (re)generates the gopls.mod file.
101+
upgrade_dependency upgrades a dependency.
102+
103+
104+
### **Run go mod vendor**
105+
Identifier: `gopls.vendor`
106+
107+
vendor runs `go mod vendor` for a module.
108108

109109

110110
<!-- END Commands: DO NOT MANUALLY EDIT THIS SECTION -->

gopls/doc/settings.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ and disabled using the `codelenses` setting, documented above. Their names and
384384
features are subject to change.
385385

386386
<!-- BEGIN Lenses: DO NOT MANUALLY EDIT THIS SECTION -->
387+
### **Toggle gc_details**
388+
389+
Identifier: `gc_details`
390+
391+
gc_details controls calculation of gc annotations.
392+
387393
### **Run go generate**
388394

389395
Identifier: `generate`
@@ -420,10 +426,4 @@ Identifier: `vendor`
420426

421427
vendor runs `go mod vendor` for a module.
422428

423-
### **Toggle gc_details**
424-
425-
Identifier: `gc_details`
426-
427-
gc_details controls calculation of gc annotations.
428-
429429
<!-- END Lenses: DO NOT MANUALLY EDIT THIS SECTION -->

internal/lsp/source/api_json.go

Lines changed: 56 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/lsp/source/command.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ type SuggestedFixFunc func(fset *token.FileSet, rng span.Range, src []byte, file
5757

5858
// Commands are the commands currently supported by gopls.
5959
var Commands = []*Command{
60-
CommandGenerate,
60+
CommandAddDependency,
61+
CommandCheckUpgrades,
62+
CommandExtractFunction,
63+
CommandExtractVariable,
6164
CommandFillStruct,
65+
CommandToggleDetails, // gc_details
66+
CommandGenerate,
67+
CommandGenerateGoplsMod,
68+
CommandGoGetPackage,
6269
CommandRegenerateCgo,
70+
CommandRemoveDependency,
6371
CommandTest,
6472
CommandTidy,
65-
CommandUpdateGoSum,
6673
CommandUndeclaredName,
67-
CommandGoGetPackage,
68-
CommandCheckUpgrades,
69-
CommandAddDependency,
74+
CommandUpdateGoSum,
7075
CommandUpgradeDependency,
71-
CommandRemoveDependency,
7276
CommandVendor,
73-
CommandExtractVariable,
74-
CommandExtractFunction,
75-
CommandToggleDetails,
76-
CommandGenerateGoplsMod,
7777
}
7878

7979
var (

0 commit comments

Comments
 (0)