Update use of fileComments proposal (#6047)

This commit is contained in:
Alex Ross 2024-06-19 12:39:16 +02:00 коммит произвёл GitHub
Родитель 7648732d6f
Коммит 3c9fec57e5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -81,6 +81,6 @@ 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[] | { fileComments: boolean; ranges?: Range[] }>;
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[] | { enableFileComments: boolean; ranges?: Range[] }>;
}
}

Просмотреть файл

@ -433,7 +433,7 @@ export class ReviewCommentController extends CommentControllerBase
return false;
}
async provideCommentingRanges(document: vscode.TextDocument, _token: vscode.CancellationToken): Promise<vscode.Range[] | { fileComments: boolean; ranges?: vscode.Range[] } | undefined> {
async provideCommentingRanges(document: vscode.TextDocument, _token: vscode.CancellationToken): Promise<vscode.Range[] | { enableFileComments: boolean; ranges?: vscode.Range[] } | undefined> {
let query: ReviewUriParams | undefined =
(document.uri.query && document.uri.query !== '') ? fromReviewUri(document.uri.query) : undefined;
@ -442,7 +442,7 @@ export class ReviewCommentController extends CommentControllerBase
if (matchedFile) {
Logger.debug('Found matched file for commenting ranges.', ReviewCommentController.ID);
return { ranges: getCommentingRanges(await matchedFile.changeModel.diffHunks(), query.base, ReviewCommentController.ID), fileComments: true };
return { ranges: getCommentingRanges(await matchedFile.changeModel.diffHunks(), query.base, ReviewCommentController.ID), enableFileComments: true };
}
}
@ -492,7 +492,7 @@ export class ReviewCommentController extends CommentControllerBase
}
Logger.debug(`Providing ${ranges.length} commenting ranges for ${nodePath.basename(document.uri.fsPath)}.`, ReviewCommentController.ID);
return { ranges, fileComments: ranges.length > 0 };
return { ranges, enableFileComments: ranges.length > 0 };
} else {
Logger.debug('No commenting ranges: File scheme differs from repository scheme.', ReviewCommentController.ID);
}

Просмотреть файл

@ -323,7 +323,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
};
}
async provideCommentingRanges(document: vscode.TextDocument, _token: vscode.CancellationToken): Promise<vscode.Range[] | { fileComments: boolean; ranges?: vscode.Range[] } | undefined> {
async provideCommentingRanges(document: vscode.TextDocument, _token: vscode.CancellationToken): Promise<vscode.Range[] | { enableFileComments: boolean; ranges?: vscode.Range[] } | undefined> {
if (document.uri.scheme === Schemes.Pr) {
const params = fromPRUri(document.uri);
@ -337,7 +337,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
return undefined;
}
return { ranges: getCommentingRanges(await fileChange.changeModel.diffHunks(), params.isBase, PRNode.ID), fileComments: true };
return { ranges: getCommentingRanges(await fileChange.changeModel.diffHunks(), params.isBase, PRNode.ID), enableFileComments: true };
}
return undefined;