Skip to content

Commit

Permalink
ToggleGCDetails: change UI text
Browse files Browse the repository at this point in the history
This CL changes the UI elements for this feature to use the phrasing
"Toggle compiler optimization details".

I ran tools/generate.go -w -gopls with gopls/v0.17.1 on my path.

Change-Id: I02f4c9a969774432b5a912d16a11e0c450d172e2
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/639415
Auto-Submit: Alan Donovan <[email protected]>
kokoro-CI: kokoro <[email protected]>
Commit-Queue: Alan Donovan <[email protected]>
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Reviewed-by: Hongxiang Jiang <[email protected]>
  • Loading branch information
adonovan authored and gopherbot committed Jan 8, 2025
1 parent 5e506ea commit e85cb10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ Extract logs in the `gopls (server)` output channel to the editor.

Open the welcome page for the Go extension.

### `Go: Toggle gc details`
### `Go: Toggle compiler optimization details`

Toggle the display of compiler optimization choices
Toggle the per-package flag that causes compiler optimization details to be reported as diagnostics

### `Go: Add Import`

Expand Down
4 changes: 2 additions & 2 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@
},
{
"command": "go.toggle.gc_details",
"title": "Go: Toggle gc details",
"description": "Toggle the display of compiler optimization choices"
"title": "Go: Toggle compiler optimization details",
"description": "Toggle the per-package flag that causes compiler optimization details to be reported as diagnostics"
},
{
"command": "go.import.add",
Expand Down
8 changes: 5 additions & 3 deletions extension/src/commands/toggleGCDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ export const toggleGCDetails: CommandFactory = (ctx, goCtx) => {
return async () => {
if (!goCtx.languageServerIsRunning) {
vscode.window.showErrorMessage(
'"Go: Toggle gc details" command is available only when the language server is running'
'"Go: Toggle compiler optimization details" command is available only when the language server is running'
);
return;
}
const doc = vscode.window.activeTextEditor?.document.uri.toString();
if (!doc || !doc.endsWith('.go')) {
vscode.window.showErrorMessage('"Go: Toggle gc details" command cannot run when no Go file is open.');
vscode.window.showErrorMessage(
'"Go: Toggle compiler optimization details" command cannot run when no Go file is open.'
);
return;
}
try {
await vscode.commands.executeCommand('gopls.gc_details', doc);
} catch (e) {
vscode.window.showErrorMessage(`"Go: Toggle gc details" command failed: ${e}`);
vscode.window.showErrorMessage(`"Go: Toggle compiler optimization details" command failed: ${e}`);
}
};
};

0 comments on commit e85cb10

Please sign in to comment.