提交 61c22574 编写于 作者: B Benjamin Pasero

quick access - use proper token for cancellation

上级 0d2868d4
......@@ -92,13 +92,14 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
picksCts = new CancellationTokenSource(token);
// Collect picks and support both long running and short or combined
const res = this.getPicks(picker.value.substr(this.prefix.length).trim(), disposables.add(new DisposableStore()), picksCts.token);
const picksToken = picksCts.token;
const res = this.getPicks(picker.value.substr(this.prefix.length).trim(), disposables.add(new DisposableStore()), picksToken);
if (isFastAndSlowPicksType(res)) {
picker.items = res.picks;
picker.busy = true;
try {
const additionalPicks = await res.additionalPicks;
if (token.isCancellationRequested) {
if (picksToken.isCancellationRequested) {
return;
}
......@@ -106,7 +107,7 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
picker.items = [...res.picks, ...additionalPicks];
}
} finally {
if (!token.isCancellationRequested) {
if (!picksToken.isCancellationRequested) {
picker.busy = false;
}
}
......@@ -116,13 +117,13 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
picker.busy = true;
try {
const items = await res;
if (token.isCancellationRequested) {
if (picksToken.isCancellationRequested) {
return;
}
picker.items = items;
} finally {
if (!token.isCancellationRequested) {
if (!picksToken.isCancellationRequested) {
picker.busy = false;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册