mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Update commenting api
This commit is contained in:
@ -15,13 +15,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
provideCommentingRanges: (document: vscode.TextDocument, token: vscode.CancellationToken) => {
|
||||
let lineCount = document.lineCount;
|
||||
return [new vscode.Range(0, 0, lineCount - 1, 0)];
|
||||
}
|
||||
};
|
||||
|
||||
// callback when users click `+` button on Gutter or run Create Comment command from Command Palette
|
||||
commentController.emptyCommentThreadFactory = {
|
||||
},
|
||||
// callback when users click `+` button on Gutter or run Create Comment command from Command Palette
|
||||
createEmptyCommentThread: (document: vscode.TextDocument, range: vscode.Range) => {
|
||||
// create a empty thread
|
||||
// create a empty thread
|
||||
let thread = commentController.createCommentThread(`${++threadId}`, document.uri, range, []);
|
||||
// by default, a comment thread is collapsed, for newly created empty comment thread, we want to expand it and users can start commenting immediately
|
||||
thread.collapsibleState = vscode.CommentThreadCollapsibleState.Expanded;
|
||||
|
||||
@ -155,9 +155,7 @@ declare module 'vscode' {
|
||||
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
||||
*/
|
||||
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
||||
}
|
||||
|
||||
export interface EmptyCommentThreadFactory {
|
||||
/**
|
||||
* The method `createEmptyCommentThread` is called when users attempt to create new comment thread from the gutter or command palette.
|
||||
* Extensions still need to call `createCommentThread` inside this call when appropriate.
|
||||
@ -192,11 +190,6 @@ declare module 'vscode' {
|
||||
*/
|
||||
commentingRangeProvider?: CommentingRangeProvider;
|
||||
|
||||
/**
|
||||
* Optional new comment thread factory.
|
||||
*/
|
||||
emptyCommentThreadFactory?: EmptyCommentThreadFactory;
|
||||
|
||||
/**
|
||||
* Dispose this comment controller.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user