From 034165ac674c36131429301aea78fea7877acb72 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 28 May 2019 12:15:41 +0200 Subject: [PATCH] don't cache provider results when request was cancelled, #74446 --- .../workbench/api/common/extHostLanguageFeatures.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index d3ed77cbf8d..3f6c11fe20a 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -644,6 +644,12 @@ class SuggestAdapter { return undefined; } + if (token.isCancellationRequested) { + // cancelled -> return without further ado, esp no caching + // of results as they will leak + return undefined; + } + let list = Array.isArray(value) ? new CompletionList(value) : value; let pid: number | undefined; @@ -832,6 +838,12 @@ class LinkProviderAdapter { return undefined; } + if (token.isCancellationRequested) { + // cancelled -> return without further ado, esp no caching + // of results as they will leak + return undefined; + } + if (typeof this._provider.resolveDocumentLink !== 'function') { // no resolve -> no caching return { links: links.map(typeConvert.DocumentLink.from) };