Skip to content

Commit 27106f2

Browse files
committed
feat(diff comment): post comment.
1 parent 61a61b8 commit 27106f2

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

package.json

+32
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@
6060
"command": "codingPlugin.switchRepo",
6161
"title": "Switch repo",
6262
"category": "Coding plugin"
63+
},
64+
{
65+
"command": "codingPlugin.diff.createComment",
66+
"title": "Post comment",
67+
"enablement": "!commentIsEmpty"
68+
},
69+
{
70+
"command": "codingPlugin.diff.replyComment",
71+
"title": "Reply",
72+
"enablement": "!commentIsEmpty"
6373
}
6474
],
6575
"menus": {
76+
"commandPalette": [
77+
{
78+
"command": "codingPlugin.diff.createComment",
79+
"when": "false"
80+
},
81+
{
82+
"command": "codingPlugin.diff.replyComment",
83+
"when": "false"
84+
}
85+
],
6686
"view/title": [
6787
{
6888
"command": "codingPlugin.newMrDesc",
@@ -74,6 +94,18 @@
7494
"when": "view == mrTreeView",
7595
"group": "navigation"
7696
}
97+
],
98+
"comments/commentThread/context": [
99+
{
100+
"command": "codingPlugin.diff.createComment",
101+
"group": "inline",
102+
"when": "commentController == mrDiffComment && commentThreadIsEmpty"
103+
},
104+
{
105+
"command": "codingPlugin.diff.replyComment",
106+
"group": "inline",
107+
"when": "commentController == mrDiffComment && !commentThreadIsEmpty"
108+
}
77109
]
78110
},
79111
"viewsWelcome": [

src/extension.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function activate(context: vscode.ExtensionContext) {
4848

4949
const tdService = new TurndownService();
5050
const commentController = vscode.comments.createCommentController(
51-
'mr-comment',
51+
'mrDiffComment',
5252
'Merge request diff comments',
5353
);
5454
context.subscriptions.push(commentController);
@@ -267,7 +267,15 @@ export async function activate(context: vscode.ExtensionContext) {
267267
context.subscriptions.push(
268268
vscode.commands.registerCommand(
269269
`codingPlugin.diff.createComment`,
270-
async (reply: vscode.CommentReply) => {
270+
(reply: vscode.CommentReply) => {
271+
replyNote(reply);
272+
},
273+
),
274+
);
275+
context.subscriptions.push(
276+
vscode.commands.registerCommand(
277+
`codingPlugin.diff.replyComment`,
278+
(reply: vscode.CommentReply) => {
271279
replyNote(reply);
272280
},
273281
),

0 commit comments

Comments
 (0)