diff --git a/package.json b/package.json index b000c18638de6e88fc6dc604915f132c7384703f..7060be5cb8a279af887aaea69ad74274496e6759 100644 --- a/package.json +++ b/package.json @@ -279,40 +279,43 @@ { "command": "gl.startEditingComment", "group": "inline@1", - "when": "comment =~ /canAdmin/" + "when": "commentController =~ /^gitlab-mr-/ && comment =~ /canAdmin/" }, { "command": "gl.deleteComment", "group": "inline@2", - "when": "comment =~ /canAdmin/" + "when": "commentController =~ /^gitlab-mr-/ && comment =~ /canAdmin/" } ], "comments/comment/context": [ { "command": "gl.submitCommentEdit", - "group": "inline@1" + "group": "inline@1", + "when": "commentController =~ /^gitlab-mr-/" }, { "command": "gl.cancelEditingComment", - "group": "inline@2" + "group": "inline@2", + "when": "commentController =~ /^gitlab-mr-/" } ], "comments/commentThread/title": [ { "command": "gl.resolveThread", "group": "inline@1", - "when": "commentThread == unresolved" + "when": "commentController =~ /^gitlab-mr-/ && commentThread == unresolved" }, { "command": "gl.unresolveThread", "group": "inline@2", - "when": "commentThread == resolved" + "when": "commentController =~ /^gitlab-mr-/ && commentThread == resolved" } ], "comments/commentThread/context": [ { "command": "gl.createComment", - "group": "inline" + "group": "inline", + "when": "commentController =~ /^gitlab-mr-/" } ] }, diff --git a/src/data_providers/items/mr_item_model.test.ts b/src/data_providers/items/mr_item_model.test.ts index 8a336e6d62d0e1939690bc5439ac3268b7b82584..53bf82d9857e1a673c880092c9715dbe0617ecdf 100644 --- a/src/data_providers/items/mr_item_model.test.ts +++ b/src/data_providers/items/mr_item_model.test.ts @@ -46,7 +46,10 @@ describe('MrItemModel', () => { it('should add comment thread to VS Code', async () => { await item.getChildren(); - expect(createCommentControllerMock).toBeCalledWith('gitlab-org/gitlab!2000', 'Issuable Title'); + expect(createCommentControllerMock).toBeCalledWith( + 'gitlab-mr-gitlab-org/gitlab!2000', + 'Issuable Title', + ); const [uri, range] = createCommentThreadMock.mock.calls[0]; expect(uri.path).toBe('src/webview/src/components/LabelNoteOld.vue'); expect(range.start.line).toBe(47); diff --git a/src/data_providers/items/mr_item_model.ts b/src/data_providers/items/mr_item_model.ts index bf192795560719ce4523bd7fa63b78e7f43e3b19..cc33ab4cdc0f2ecb11d76b2a5dd987c827deda39 100644 --- a/src/data_providers/items/mr_item_model.ts +++ b/src/data_providers/items/mr_item_model.ts @@ -61,7 +61,7 @@ export class MrItemModel extends ItemModel { private async initializeMrDiscussions(mrVersion: RestMrVersion): Promise { const commentController = vscode.comments.createCommentController( - this.mr.references.full, + `gitlab-mr-${this.mr.references.full}`, this.mr.title, ); this.setDisposableChildren([commentController]);