mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
Merge from vscode 5d18ad4c5902e3bddbc9f78da82dfc2ac349e908 (#9683)
This commit is contained in:
@@ -97,7 +97,14 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
// Collect picks and support both long running and short or combined
|
||||
const picksToken = picksCts.token;
|
||||
const res = this.getPicks(picker.value.substr(this.prefix.length).trim(), disposables.add(new DisposableStore()), picksToken);
|
||||
if (isFastAndSlowPicksType(res)) {
|
||||
|
||||
// No Picks
|
||||
if (res === null) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// Fast and Slow Picks
|
||||
else if (isFastAndSlowPicksType(res)) {
|
||||
let fastPicksHandlerDone = false;
|
||||
let slowPicksHandlerDone = false;
|
||||
|
||||
@@ -122,7 +129,6 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
}
|
||||
})(),
|
||||
|
||||
|
||||
// Slow Picks: we await the slow picks and then set them at
|
||||
// once together with the fast picks, but only if we actually
|
||||
// have additional results.
|
||||
@@ -227,6 +233,7 @@ export abstract class PickerQuickAccessProvider<T extends IPickerQuickAccessItem
|
||||
* @param token for long running tasks, implementors need to check on cancellation
|
||||
* through this token.
|
||||
* @returns the picks either directly, as promise or combined fast and slow results.
|
||||
* Pickers can return `null` to signal that no change in picks is needed.
|
||||
*/
|
||||
protected abstract getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array<T | IQuickPickSeparator> | Promise<Array<T | IQuickPickSeparator>> | FastAndSlowPicksType<T>;
|
||||
protected abstract getPicks(filter: string, disposables: DisposableStore, token: CancellationToken): Array<T | IQuickPickSeparator> | Promise<Array<T | IQuickPickSeparator>> | FastAndSlowPicksType<T> | null;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { IQuickInputService, IQuickPick, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { Disposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IQuickAccessController, IQuickAccessProvider, IQuickAccessRegistry, Extensions, IQuickAccessProviderDescriptor } from 'vs/platform/quickinput/common/quickAccess';
|
||||
import { IQuickAccessController, IQuickAccessProvider, IQuickAccessRegistry, Extensions, IQuickAccessProviderDescriptor, IQuickAccessOptions } from 'vs/platform/quickinput/common/quickAccess';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -25,7 +25,7 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
|
||||
super();
|
||||
}
|
||||
|
||||
show(value = ''): void {
|
||||
show(value = '', options?: IQuickAccessOptions): void {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
// Hide any previous picker if any
|
||||
@@ -39,7 +39,8 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
|
||||
const picker = disposables.add(this.quickInputService.createQuickPick());
|
||||
picker.placeholder = descriptor?.placeholder;
|
||||
picker.value = value;
|
||||
picker.valueSelection = [value.length, value.length];
|
||||
picker.quickNavigate = options?.quickNavigateConfiguration;
|
||||
picker.valueSelection = options?.inputSelection ? [options.inputSelection.start, options.inputSelection.end] : [value.length, value.length];
|
||||
picker.contextKey = descriptor?.contextKey;
|
||||
picker.filterValue = (value: string) => value.substring(descriptor ? descriptor.prefix.length : 0);
|
||||
|
||||
|
||||
@@ -3,19 +3,32 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IQuickPick, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IQuickPick, IQuickPickItem, IQuickNavigateConfiguration } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { first, coalesce } from 'vs/base/common/arrays';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IQuickAccessOptions {
|
||||
|
||||
/**
|
||||
* Allows to control the part of text in the input field that should be selected.
|
||||
*/
|
||||
inputSelection?: { start: number; end: number; };
|
||||
|
||||
/**
|
||||
* Allows to enable quick navigate support in quick input.
|
||||
*/
|
||||
quickNavigateConfiguration?: IQuickNavigateConfiguration;
|
||||
}
|
||||
|
||||
export interface IQuickAccessController {
|
||||
|
||||
/**
|
||||
* Open the quick access picker with the optional value prefilled.
|
||||
*/
|
||||
show(value?: string): void;
|
||||
show(value?: string, options?: IQuickAccessOptions): void;
|
||||
}
|
||||
|
||||
export interface IQuickAccessProvider {
|
||||
|
||||
Reference in New Issue
Block a user