Skip to content

Commit 96ec9a1

Browse files
authored
[Feature request] Expose shortcut to toggle comments on/off in editors (#6572)
Fixes #6229
1 parent dc73a76 commit 96ec9a1

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

package.json

+32-2
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,18 @@
11971197
"title": "%command.pr.closeRelatedEditors.title%",
11981198
"category": "%command.pull.request.category%"
11991199
},
1200+
{
1201+
"command": "pr.toggleEditorCommentingOn",
1202+
"title": "%command.pr.toggleEditorCommentingOn.title%",
1203+
"category": "%command.pull.request.category%",
1204+
"icon": "$(eye-closed)"
1205+
},
1206+
{
1207+
"command": "pr.toggleEditorCommentingOff",
1208+
"title": "%command.pr.toggleEditorCommentingOff.title%",
1209+
"category": "%command.pull.request.category%",
1210+
"icon": "$(eye)"
1211+
},
12001212
{
12011213
"command": "review.diffWithPrHead",
12021214
"title": "%command.review.diffWithPrHead.title%",
@@ -1792,6 +1804,14 @@
17921804
"command": "pr.closeRelatedEditors",
17931805
"when": "gitHubOpenRepositoryCount != 0"
17941806
},
1807+
{
1808+
"command": "pr.toggleEditorCommentingOn",
1809+
"when": "false"
1810+
},
1811+
{
1812+
"command": "pr.toggleEditorCommentingOff",
1813+
"when": "false"
1814+
},
17951815
{
17961816
"command": "review.suggestDiff",
17971817
"when": "false"
@@ -2247,12 +2267,22 @@
22472267
{
22482268
"command": "pr.setFileListLayoutAsTree",
22492269
"when": "view == prStatus:github && fileListLayout:flat",
2250-
"group": "navigation"
2270+
"group": "navigation1"
22512271
},
22522272
{
22532273
"command": "pr.setFileListLayoutAsFlat",
22542274
"when": "view == prStatus:github && !fileListLayout:flat",
2255-
"group": "navigation"
2275+
"group": "navigation1"
2276+
},
2277+
{
2278+
"command": "pr.toggleEditorCommentingOn",
2279+
"when": "view == prStatus:github && !commentingEnabled",
2280+
"group": "navigation@0"
2281+
},
2282+
{
2283+
"command": "pr.toggleEditorCommentingOff",
2284+
"when": "view == prStatus:github && commentingEnabled",
2285+
"group": "navigation@0"
22562286
},
22572287
{
22582288
"command": "issue.createIssue",

package.nls.json

+2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@
258258
"command.pr.resolveConflict.title": "Resolve Conflict",
259259
"command.pr.acceptMerge.title": "Accept Merge",
260260
"command.pr.closeRelatedEditors.title": "Close All Pull Request Editors",
261+
"command.pr.toggleEditorCommentingOn.title": "Toggle Editor Commenting On",
262+
"command.pr.toggleEditorCommentingOff.title": "Toggle Editor Commenting Off",
261263
"command.issue.copyGithubDevLink.title": "Copy github.dev Link",
262264
"command.issue.copyGithubPermalink.title": "Copy GitHub Permalink",
263265
"command.issue.copyGithubHeadLink.title": "Copy GitHub Head Link",

src/commands.ts

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
} from './view/treeNodes/fileChangeNode';
4545
import { PRNode } from './view/treeNodes/pullRequestNode';
4646
import { RepositoryChangesNode } from './view/treeNodes/repositoryChangesNode';
47+
import { commands } from './common/executeCommands';
4748

4849
const _onDidUpdatePR = new vscode.EventEmitter<PullRequest | void>();
4950
export const onDidUpdatePR: vscode.Event<PullRequest | void> = _onDidUpdatePR.event;
@@ -1487,6 +1488,15 @@ ${contents}
14871488
return vscode.commands.executeCommand('workbench.action.addComment', { fileComment: true });
14881489
}));
14891490

1491+
context.subscriptions.push(
1492+
vscode.commands.registerCommand('pr.toggleEditorCommentingOn', async () => {
1493+
commands.executeCommand('workbench.action.toggleCommenting');
1494+
}));
1495+
context.subscriptions.push(
1496+
vscode.commands.registerCommand('pr.toggleEditorCommentingOff', async () => {
1497+
commands.executeCommand('workbench.action.toggleCommenting');
1498+
}));
1499+
14901500
context.subscriptions.push(
14911501
vscode.commands.registerCommand('review.diffWithPrHead', async (fileChangeNode: GitFileChangeNode) => {
14921502
const fileName = fileChangeNode.fileName;

0 commit comments

Comments
 (0)