Update use of comment thread reveal proposal (#6085)
Part of microsoft/vscode#167253
This commit is contained in:
Родитель
3bc90f9626
Коммит
58730f3279
|
@ -35,7 +35,7 @@
|
|||
"version": "0.92.0",
|
||||
"publisher": "GitHub",
|
||||
"engines": {
|
||||
"vscode": "^1.91.0"
|
||||
"vscode": "^1.92.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
|
|
|
@ -7,26 +7,39 @@ declare module 'vscode' {
|
|||
|
||||
// @alexr00 https://github.com/microsoft/vscode/issues/167253
|
||||
|
||||
export enum CommentThreadFocus {
|
||||
/**
|
||||
* Focus the comment editor if the thread supports replying.
|
||||
*/
|
||||
Reply = 1,
|
||||
/**
|
||||
* Focus the revealed comment.
|
||||
*/
|
||||
Comment = 2
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to reveal a comment thread in an editor.
|
||||
*/
|
||||
export interface CommentThreadRevealOptions {
|
||||
/**
|
||||
* By default, the comment thread will be focused. Set `preserveFocus` to `true` to maintain the original focus.
|
||||
*/
|
||||
preserveFocus?: boolean;
|
||||
|
||||
/**
|
||||
* Focus the comment thread reply editor, if the thread supports replying.
|
||||
* Where to move the focus to when revealing the comment thread.
|
||||
* If undefined, the focus will not be changed.
|
||||
*/
|
||||
focusReply?: boolean;
|
||||
focus?: CommentThreadFocus;
|
||||
}
|
||||
|
||||
export interface CommentThread {
|
||||
export interface CommentThread2 {
|
||||
/**
|
||||
* Reveal the comment thread in an editor.
|
||||
* Reveal the comment thread in an editor. If no comment is provided, the first comment in the thread will be revealed.
|
||||
*/
|
||||
reveal(options?: CommentThreadRevealOptions): Thenable<void>;
|
||||
reveal(comment?: Comment, options?: CommentThreadRevealOptions): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Collapse the comment thread in an editor.
|
||||
*/
|
||||
hide(): Thenable<void>;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,9 +68,6 @@ declare module 'vscode' {
|
|||
* Once disposed, this comment thread will be removed from visible editors and Comment Panel when appropriate.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
// Part of the comment reveal proposal
|
||||
reveal(options?: CommentThreadRevealOptions): Thenable<void>;
|
||||
}
|
||||
|
||||
export interface CommentController {
|
||||
|
|
|
@ -974,7 +974,7 @@ export function registerCommands(
|
|||
if (handler) {
|
||||
await handler.unresolveReviewThread(thread, text);
|
||||
if (focusReply) {
|
||||
thread.reveal({ focusReply: true });
|
||||
thread.reveal(undefined, { focus: vscode.CommentThreadFocus.Reply });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ export interface GHPRCommentThread extends vscode.CommentThread2 {
|
|||
*/
|
||||
state?: { resolved: vscode.CommentThreadState; applicability?: vscode.CommentThreadApplicability };
|
||||
|
||||
reveal(options?: vscode.CommentThreadRevealOptions): Promise<void>;
|
||||
reveal(comment?: vscode.Comment, options?: vscode.CommentThreadRevealOptions): Promise<void>;
|
||||
|
||||
dispose: () => void;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ describe('ReviewCommentController', function () {
|
|||
state: { resolved: vscode.CommentThreadState.Unresolved, applicability: 0 },
|
||||
canReply: false,
|
||||
reveal: () => Promise.resolve(),
|
||||
hide: () => Promise.resolve(),
|
||||
dispose: () => { },
|
||||
};
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче