Use CancellationError to avoid logging of cancels as errors (#7477)
This commit is contained in:
@@ -24,7 +24,7 @@ export class FoldingRangeProvider implements vscode.FoldingRangeProvider {
|
||||
token.onCancellationRequested(e => this.client.abortRequest(id));
|
||||
const ranges: GetFoldingRangesResult = await this.client.languageClient.sendRequest(GetFoldingRangesRequest, params);
|
||||
if (ranges.canceled) {
|
||||
throw new Error('Request for providing folding ranges is cancelled.');
|
||||
throw new vscode.CancellationError();
|
||||
} else {
|
||||
const result: vscode.FoldingRange[] = [];
|
||||
ranges.ranges.forEach((r) => {
|
||||
|
||||
@@ -32,10 +32,10 @@ export class SemanticTokensProvider implements vscode.DocumentSemanticTokensProv
|
||||
};
|
||||
const tokensResult: GetSemanticTokensResult = await this.client.languageClient.sendRequest(GetSemanticTokensRequest, params);
|
||||
if (tokensResult.canceled) {
|
||||
throw new Error('Request for providing semantic tokens is cancelled.');
|
||||
throw new vscode.CancellationError();
|
||||
} else {
|
||||
if (tokensResult.fileVersion !== openFileVersions.get(uriString)) {
|
||||
throw new Error('The semantic tokens are not related to the current version of the document.');
|
||||
throw new vscode.CancellationError();
|
||||
} else {
|
||||
const builder: vscode.SemanticTokensBuilder = new vscode.SemanticTokensBuilder(this.client.semanticTokensLegend);
|
||||
tokensResult.tokens.forEach((token) => {
|
||||
|
||||
Reference in New Issue
Block a user