-
Notifications
You must be signed in to change notification settings - Fork 362
Expand file tree
/
Copy pathCodeReviewProvider.ts
More file actions
86 lines (69 loc) · 2.76 KB
/
CodeReviewProvider.ts
File metadata and controls
86 lines (69 loc) · 2.76 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
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {TypeaheadResult} from 'isl-components/Types';
import type {TypeaheadKind} from 'isl/src/CommitInfoView/types';
import type {
ClientToServerMessage,
CodeReviewProviderSpecificClientToServerMessages,
CommandArg,
DiffComment,
DiffId,
DiffSummary,
Disposable,
LandConfirmationInfo,
LandInfo,
OperationCommandProgressReporter,
Result,
ServerToClientMessage,
} from 'isl/src/types';
export type DiffSummaries = Map<DiffId, DiffSummary>;
/**
* API to fetch data from Remote Code Review system, like GitHub and Phabricator.
*/
export interface CodeReviewProvider {
triggerDiffSummariesFetch(diffs: Array<DiffId>): unknown;
onChangeDiffSummaries(callback: (result: Result<DiffSummaries>, currentUser?: string) => unknown): Disposable;
/** Run a command not handled within sapling, such as a separate submit handler */
runExternalCommand?(
cwd: string,
args: CommandArg[], // Providers may need specific normalization for args
onProgress: OperationCommandProgressReporter,
signal: AbortSignal,
): Promise<void>;
/** Run a conf command for configerator operations */
runConfCommand?(
cwd: string,
args: Array<string>,
onProgress: OperationCommandProgressReporter,
signal: AbortSignal,
): Promise<void>;
dispose: () => void;
/** Convert Code Review Provider info into a short summary string, usable in analytics */
getSummaryName(): string;
typeahead?(kind: TypeaheadKind, query: string, cwd: string): Promise<Array<TypeaheadResult>>;
getDiffUrlMarkdown(diffId: DiffId): string;
getCommitHashUrlMarkdown(hash: string): string;
getRemoteFileURL?(
path: string,
publicCommitHash: string | null,
selectionStart?: {line: number; char: number},
selectionEnd?: {line: number; char: number},
): string;
updateDiffMessage?(diffId: DiffId, newTitle: string, newDescription: string): Promise<void>;
getSuggestedReviewers?(context: {paths: Array<string>}): Promise<Array<string>>;
/** Convert usernames/emails to avatar URIs */
fetchAvatars?(authors: Array<string>): Promise<Map<string, string>>;
/** Convert usernames/emails to avatar URIs */
fetchComments?(diffId: DiffId): Promise<Array<DiffComment>>;
renderMarkup?: (markup: string) => Promise<string>;
fetchLandInfo?(topOfStack: DiffId): Promise<LandInfo>;
confirmLand?(landConfirmationInfo: NonNullable<LandConfirmationInfo>): Promise<Result<undefined>>;
handleClientToServerMessage?(
message: ClientToServerMessage,
postMessage: (message: ServerToClientMessage) => void,
): message is CodeReviewProviderSpecificClientToServerMessages;
}