Closed
Description
Introduces the concept of comment threads and comments, and adds two providers an extension can register. One for on-demand comments when an editor is opened, rendered in the editor, and one to display all comments in the workspace and allow navigation.
interface CommentInfo {
threads: CommentThread[];
commentingRanges?: Range[];
}
export enum CommentThreadCollapsibleState {
/**
* Determines an item is collapsed
*/
Collapsed = 0,
/**
* Determines an item is expanded
*/
Expanded = 1
}
interface CommentThread {
threadId: string;
resource: Uri;
range: Range;
comments: Comment[];
collapsibleState?: CommentThreadCollapsibleState;
}
interface Comment {
commentId: string;
body: MarkdownString;
userName: string;
gravatar: string;
command?: Command;
}
export interface CommentThreadChangedEvent {
/**
* Added comment threads.
*/
readonly added: CommentThread[];
/**
* Removed comment threads.
*/
readonly removed: CommentThread[];
/**
* Changed comment threads.
*/
readonly changed: CommentThread[];
}
interface DocumentCommentProvider {
provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
}
interface WorkspaceCommentProvider {
provideWorkspaceComments(token: CancellationToken): Promise<CommentThread[]>;
createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
}