forked from microsoft/vscode-pull-request-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.ts
More file actions
90 lines (82 loc) · 2.26 KB
/
Copy pathcommands.ts
File metadata and controls
90 lines (82 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { PRNode } from '../view/treeNodes/pullRequestNode';
import { ReviewDocumentCommentProvider } from '../view/reviewDocumentCommentProvider';
import { CommentHandler } from './utils';
export function getAcceptInputCommands(thread: vscode.CommentThread, inDraftMode: boolean, handler: CommentHandler, supportGraphQL: boolean): { acceptInputCommand: vscode.Command, additionalCommands: vscode.Command[] } {
let commands: vscode.Command[] = [];
let acceptInputCommand = {
title: inDraftMode ? 'Add Review Comment' : 'Add Comment',
command: 'pr.replyComment',
arguments: [
handler,
thread
]
};
if (supportGraphQL) {
if (inDraftMode) {
commands.push({
title: 'Delete Review',
command: 'pr.deleteReview',
arguments: [
handler
]
});
commands.push({
title: 'Finish Review',
command: 'pr.finishReview',
arguments: [
handler,
thread
]
});
} else {
commands.push({
title: 'Start Review',
command: 'pr.startReview',
arguments: [
handler,
thread
]
});
}
}
return {
acceptInputCommand: acceptInputCommand,
additionalCommands: commands
};
}
export function getEditCommand(thread: vscode.CommentThread, vscodeComment: vscode.Comment, handler: PRNode | ReviewDocumentCommentProvider): vscode.Command {
return {
title: 'Edit Comment',
command: 'pr.editComment',
arguments: [
handler,
thread,
vscodeComment
]
};
}
export function getDeleteCommand(thread: vscode.CommentThread, vscodeComment: vscode.Comment, handler: PRNode | ReviewDocumentCommentProvider): vscode.Command {
return {
title: 'Delete Comment',
command: 'pr.deleteComment',
arguments: [
handler,
thread,
vscodeComment
]
};
}
export function getDeleteThreadCommand(thread: vscode.CommentThread): vscode.Command {
return {
title: 'Delete Thread',
command: 'pr.deleteThread',
arguments: [
thread
]
};
}