Skip to content

Commit 5affb99

Browse files
stamblerrehyangah
authored andcommitted
[release] docs: automatically generate documentation for settings
Write a script to automatically generate settings and command documentation using the package.json. Also, delete the smoke-test.md file in the project root. Not sure how it got there - probably I messed something up while renaming it. Change-Id: I229f322d6c45bc81a456f5deb534f6591f3917d9 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/236963 Reviewed-by: Hyang-Ah Hana Kim <[email protected]> (cherry picked from commit 8a697ee) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/237159
1 parent 5e44797 commit 5affb99

File tree

3 files changed

+392
-105
lines changed

3 files changed

+392
-105
lines changed

docs/commands.md

Lines changed: 81 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -21,175 +21,164 @@ Finally, you can also see a full list by using a meta command: `Go: Show All Com
2121

2222
## Detailed list
2323

24-
<!--TODO(rstambler): Automatically generate this list using the package.json.-->
24+
<!-- Everything below this line is generated. DO NOT EDIT. -->
2525

26-
Below is a detailed list of commands. They are categorized into [code editing and generation](#code-editing-and-generation), [testing and benchmarking](#testing-and-benchmarking), [build, lint, and vet](#build-lint-and-vet), [miscellaneous](#miscellaneous), and [troubleshooting](#troubleshooting). You will find the [troubleshooting](#troubleshooting) commands helpful when diagnosing an issue with the extension (learn more in the [Troubleshooting documentation](troubleshooting.md)).
26+
### `Go: Current GOPATH`
2727

28-
### Code editing and generation
28+
See the currently set GOPATH.
2929

30-
<!--Note: Try to keep this list in roughly alphabetical/logical order.-->
30+
### `Go: Locate Configured Go Tools`
3131

32-
#### [`Go: Add Import`](features.md#add-import)
32+
List all the Go tools being used by this extension along with their locations.
3333

34-
<!--TODO(rstambler): Confirm exactly how this works.-->
35-
Manually add an import to your file. See [Add import](features.md#add-import).
34+
### `Go: Test Function At Cursor`
3635

37-
#### [`Go: Add Package to Workspace`]
36+
Runs a unit test at the cursor.
3837

39-
Add a package to the current workspace.
38+
### `Go: Subtest At Cursor`
4039

41-
<!--TODO(rstambler): Figure out how this command works, its use cases, and how it fits into modules.-->
40+
Runs a sub test at the cursor.
4241

43-
#### [`Go: Add Tags to Struct Fields`](features.md#add-struct-tags)
42+
### `Go: Benchmark Function At Cursor`
4443

45-
Automatically generate [tags](https://pkg.go.dev/reflect?tab=doc#StructTag) for your struct. See [Add or remove struct tags](features.md#add-or-remove-struct-tags).
44+
Runs a benchmark at the cursor.
4645

47-
#### [`Go: Remove Tags From Struct Fields`](features.md#add-struct-tags)
46+
### `Go: Debug Test At Cursor`
4847

49-
Removes [tags](https://pkg.go.dev/reflect?tab=doc#StructTag) from the selected struct fields. See [Add or remove struct tags](features.md#add-or-remove-struct-tags).
48+
Debug test at the cursor.
5049

51-
#### [`Go: Fill struct`](features.md#fill-struct-literals)
50+
### `Go: Test File`
5251

53-
Fill a struct literal with default values. See [Fill struct](features.md#fill-struct-literals).
52+
Runs all unit tests in the current file.
5453

55-
#### [`Go: Generate Interface Stubs`](features.md#generate-interface-implementation)
54+
### `Go: Test Package`
5655

57-
Generate method stubs for given interface. See [Generate interface implementation](features.md#generate-interface-implementation).
56+
Runs all unit tests in the package of the current file.
5857

59-
#### [`Go: Generate Unit Tests For Function`](features.md#generate-unit-tests)
58+
### `Go: Benchmark Package`
6059

61-
Generate unit tests for the selected function in the current file. See [Generate unit tests](features.md#generate-unit-tests).
60+
Runs all benchmarks in the package of the current file.
6261

63-
#### [`Go: Generate Unit Tests For File`](features.md#generate-unit-tests)
62+
### `Go: Benchmark File`
6463

65-
Generate unit tests for the current file. See [Generate unit tests](features.md#generate-unit-tests).
64+
Runs all benchmarks in the current file.
6665

67-
#### [`Go: Generate Unit Tests For Package`](features.md#generate-unit-tests)
66+
### `Go: Test All Packages In Workspace`
6867

69-
Generate unit tests for the current package. See [Generate unit tests](features.md#generate-unit-tests).
68+
Runs all unit tests from all packages in the current workspace.
7069

71-
#### [`Go: Extract to function`](features.md#refactor)
70+
### `Go: Test Previous`
7271

73-
Extract the highlighted code to a function. Provided by the [`godoctor`](tools.md#godoctor) tool. Learn more about [refactoring](features.md#refactoring).
72+
Re-runs the last executed test.
7473

75-
#### [`Go: Extract to variable`](features.md#refactor)
74+
### `Go: Toggle Test Coverage In Current Package`
7675

77-
Extract the highlighted code to a local variable. Provided by the [`godoctor`](tools.md#godoctor) tool. Learn more about [refactoring](features.md#refactoring).
76+
Displays test coverage in the current package.
7877

79-
### Testing and benchmarking
78+
### `Go: Generate Unit Tests For Package`
8079

81-
#### [`Go: Test Function at Cursor`](features.md#test-and-benchmark-in-the-editor)
80+
Generates unit tests for the current package
8281

83-
Run the test function at the current cursor position in the file.
82+
### `Go: Generate Unit Tests For File`
8483

85-
#### [`Go: Subtest at Cursor`](features.md#test-and-benchmark-in-the-editor)
84+
Generates unit tests for the current file
8685

87-
Run the subtest (`t.Run`) at the current cursor position in the file.
86+
### `Go: Generate Unit Tests For Function`
8887

89-
#### [`Go: Benchmark Function At Cursor`](features.md#test-and-benchmark-in-the-editor)
88+
Generates unit tests for the selected function in the current file
9089

91-
Run the benchmark at the current cursor position in the file.
90+
### `Go: Generate Interface Stubs`
9291

93-
#### [`Go: Debug Test At Cursor`](features.md#debugging)
92+
Generates method stub for implementing the provided interface and inserts at the cursor.
9493

95-
Debug the test at the current cursor position.
94+
### `Go: Add Import`
9695

97-
#### [`Go: Test File`](features.md#test-and-benchmark-in-the-editor)
96+
Add an import declaration
9897

99-
Run all of the tests in the current file.
98+
### `Go: Add Package to Workspace`
10099

101-
#### [`Go: Benchmark File`](features.md#test-and-benchmark-in-the-editor)
100+
Add a package from the imports list to the workspace.
102101

103-
Run all of the benchmarks in the current file.
102+
### `Go: Install/Update Tools`
104103

105-
#### [`Go: Test Package`](features.md#test-and-benchmark-in-the-editor)
104+
install/update the required go packages
106105

107-
Run all of the tests in the current package.
106+
### `Go: Toggle Test File`
108107

109-
#### [`Go: Benchmark Package`](features.md#test-and-benchmark-in-the-editor)
108+
Toggles between file in current active editor and the corresponding test file.
110109

111-
Run all of the benchmarks in the current package.
110+
### `Go: Add Tags To Struct Fields`
112111

113-
#### [`Go: Test Previous`](features.md#test-and-benchmark-in-the-editor)
112+
Add tags configured in go.addTags setting to selected struct using gomodifytags
114113

115-
Re-run the most recently executed test command.
114+
### `Go: Remove Tags From Struct Fields`
116115

117-
#### [`Go: Test All Packages In Workspace`](features.md#test-and-benchmark-in-the-editor)
116+
Remove tags configured in go.removeTags setting from selected struct using gomodifytags
118117

119-
Run all of the tests in the current workspace.
118+
### `Go: Fill struct`
120119

121-
#### [`Go: Cancel Running Tests`](features.md#test-and-benchmark-in-the-editor)
120+
Fill a struct literal with default values
122121

123-
Cancel currently running tests.
122+
### `Go: Show All Commands...`
124123

125-
#### [`Go: Toggle Test File`](features.md#toggle-between-code-and-tests)
124+
Shows all commands from the Go extension in the quick pick
126125

127-
Toggle between a file and its corresponding test file.
126+
### `Go: Browse Packages`
128127

129-
#### [`Go: Apply Cover Profile`](features.md#code-coverage)
128+
Browse packages and Go files inside the packages.
130129

131-
Apply a given [cover profile](https://blog.golang.org/cover) to the current file.
130+
### `Go: Get Package`
132131

133-
#### [`Go: Toggle Test Coverage In Current Package`](features.md#code-coverage)
132+
Run `go get -v` on the package on the current line.
134133

135-
Show [code coverage](features.md#code-coverage) in the current file.
134+
### `Go: Run on Go Playground`
136135

137-
### Build, lint, and vet
136+
Upload the current selection or file to the Go Playground
138137

139-
#### [`Go: Build Current Package`](features.md#build-errors)
138+
### `Go: Lint Current Package`
140139

141-
Build the current package and show build errors.
140+
Run linter in the package of the current file.
142141

143-
#### [`Go: Vet Current Package`](features.md#vet-errors)
142+
### `Go: Lint Workspace`
144143

145-
Show vet errors for the current package.
144+
Run linter in the current workspace.
146145

147-
#### [`Go: Lint Current Package`](features.md#lint-errors)
146+
### `Go: Vet Current Package`
148147

149-
Show lint errors for the current package.
148+
Run go vet in the package of the current file.
150149

151-
#### [`Go: Build Workspace`](features.md#build-errors)
150+
### `Go: Vet Workspace`
152151

153-
Build all of the packages in the current workspace and show build errors.
152+
Run go vet in the current workspace.
154153

155-
#### [`Go: Vet Workspace`](features.md#vet-errors)
154+
### `Go: Build Current Package`
156155

157-
Show vet errors for all of the packages in the current workspace.
156+
Build the package of the current file.
158157

159-
#### [`Go: Lint Workspace`](features.md#lint-errors)
158+
### `Go: Build Workspace`
160159

161-
Show lint errors for all of the packages in the current workspace.
160+
Build the current workspace.
162161

163-
#### `Go: Install Current Package`
162+
### `Go: Install Current Package`
164163

165-
Install the current package and its dependencies.
164+
Install the current package.
166165

167-
### Miscellaneous
166+
### `Go: Cancel Running Tests`
168167

169-
#### [`Go: Restart Language Server`](gopls.md)
168+
Cancels running tests.
170169

171-
Use this command to restart the [language server](gopls.md) without reloading the VS Code window. This can be helpful if something seems goes wrong with the language server (for example, if you see incorrect error messages).
170+
### `Go: Apply Cover Profile`
172171

173-
#### [`Go: Run on Go Playground`](features.md#go-playground)
172+
Applies existing cover profile.
174173

175-
Upload the current selection or file to the Go Playground ([play.golang.org](https://play.golang.org)). See [Go Playground](features.md#go-playground).
174+
### `Go: Extract to function`
176175

177-
### Troubleshooting
176+
Extract to function using godoctor.
178177

179-
#### `Go: Current GOPATH`
178+
### `Go: Extract to variable`
180179

181-
See the current value of GOPATH. This is not equivalent to `go env GOPATH`, as your VS Code settings may have altered the value of `GOPATH` used by the extension. This command is helpful when [troubleshooting](troubleshooting.md) the extension.
180+
Extract to variable using godoctor.
182181

183-
#### [`Go: Install/Update Tools`](tools.md)
182+
### `Go: Restart Language Server`
184183

185-
Install or update the Go tools on which the extension depends. Tools can be installed or updated all at once, or individual tools can be selected.
186-
187-
#### [`Go: Locate Configured Go Tools`](troubleshooting.md#check-your-set-up)
188-
189-
This command is helpful when [troubleshooting](troubleshooting.md) the extension. It prints out the environment variables and paths to the tools used by the extension. See an example of the command's output in the [troubleshooting documentation](troubleshooting.md#check-your-set-up).
190-
191-
[`golint`]: https://pkg.go.dev/golang.org/x/lint/golint?tab=overview
192-
[`staticcheck`]: https://pkg.go.dev/honnef.co/go/tools/staticcheck?tab=overview
193-
[`golangci-lint`]: https://golangci-lint.run/
194-
[`revive`]: https://pkg.go.dev/github.com/mgechev/revive?tab=overview
195-
[`gomodifytags`]: tools.md#gomodifytags
184+
Restart the running instance of the language server

0 commit comments

Comments
 (0)