mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 01:25:38 -05:00
Merge from vscode 1ec43773e37997841c5af42b33ddb180e9735bf2
This commit is contained in:
@@ -115,15 +115,27 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
const picksToken = picksCts.token;
|
||||
const providedPicks = this.getPicks(picker.value.substr(this.prefix.length).trim(), picksDisposables, picksToken);
|
||||
|
||||
function applyPicks(picks: Picks<T>): void {
|
||||
function applyPicks(picks: Picks<T>, skipEmpty?: boolean): boolean {
|
||||
let items: ReadonlyArray<Pick<T>>;
|
||||
let activeItem: T | undefined = undefined;
|
||||
|
||||
if (isPicksWithActive(picks)) {
|
||||
picker.items = picks.items;
|
||||
if (picks.active) {
|
||||
picker.activeItems = [picks.active];
|
||||
}
|
||||
items = picks.items;
|
||||
activeItem = picks.active;
|
||||
} else {
|
||||
picker.items = picks;
|
||||
items = picks;
|
||||
}
|
||||
|
||||
if (items.length === 0 && skipEmpty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
picker.items = items;
|
||||
if (activeItem) {
|
||||
picker.activeItems = [activeItem];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// No Picks
|
||||
@@ -133,8 +145,8 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
|
||||
// Fast and Slow Picks
|
||||
else if (isFastAndSlowPicks(providedPicks)) {
|
||||
let fastPicksHandlerDone = false;
|
||||
let slowPicksHandlerDone = false;
|
||||
let fastPicksApplied = false;
|
||||
let slowPicksApplied = false;
|
||||
|
||||
await Promise.all([
|
||||
|
||||
@@ -143,17 +155,13 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
// If the slow picks are faster, we reduce the flicker by
|
||||
// only setting the items once.
|
||||
(async () => {
|
||||
try {
|
||||
await timeout(PickerQuickAccessProvider.FAST_PICKS_RACE_DELAY);
|
||||
if (picksToken.isCancellationRequested) {
|
||||
return;
|
||||
}
|
||||
await timeout(PickerQuickAccessProvider.FAST_PICKS_RACE_DELAY);
|
||||
if (picksToken.isCancellationRequested) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!slowPicksHandlerDone) {
|
||||
applyPicks(providedPicks.picks);
|
||||
}
|
||||
} finally {
|
||||
fastPicksHandlerDone = true;
|
||||
if (!slowPicksApplied) {
|
||||
fastPicksApplied = applyPicks(providedPicks.picks, true /* skip over empty to reduce flicker */);
|
||||
}
|
||||
})(),
|
||||
|
||||
@@ -186,7 +194,7 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
additionalPicks = awaitedAdditionalPicks;
|
||||
}
|
||||
|
||||
if (additionalPicks.length > 0 || !fastPicksHandlerDone) {
|
||||
if (additionalPicks.length > 0 || !fastPicksApplied) {
|
||||
applyPicks({
|
||||
items: [...picks, ...additionalPicks],
|
||||
active: activePick as T || additionalActivePick as T // {{SQL CARBON EDIT}} strict-null-checks
|
||||
@@ -197,7 +205,7 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
picker.busy = false;
|
||||
}
|
||||
|
||||
slowPicksHandlerDone = true;
|
||||
slowPicksApplied = true;
|
||||
}
|
||||
})()
|
||||
]);
|
||||
|
||||
@@ -52,7 +52,7 @@ export class QuickInputService extends Themable implements IQuickInputService {
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IContextKeyService protected readonly contextKeyService: IContextKeyService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
|
||||
@ILayoutService protected readonly layoutService: ILayoutService
|
||||
@@ -166,10 +166,6 @@ export class QuickInputService extends Themable implements IQuickInputService {
|
||||
return this.controller.cancel();
|
||||
}
|
||||
|
||||
hide(focusLost?: boolean): void {
|
||||
return this.controller.hide(focusLost);
|
||||
}
|
||||
|
||||
protected updateStyles() {
|
||||
this.controller.applyStyles(this.computeStyles());
|
||||
}
|
||||
|
||||
@@ -94,7 +94,4 @@ export interface IQuickInputService {
|
||||
* Cancels quick input and closes it.
|
||||
*/
|
||||
cancel(): Promise<void>;
|
||||
|
||||
// TODO@Ben remove once quick open is gone
|
||||
hide(focusLost?: boolean): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user