Skip to content

Commit

Permalink
Naming: Select -> Pick (#49340)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed May 7, 2018
1 parent 9624859 commit 841f140
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/vs/platform/quickOpen/common/quickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface IPickOptions {
/**
* an optional flag to make this picker multi-select (honoured by extension API)
*/
canSelectMany?: boolean;
canPickMany?: boolean;
}

export interface IInputOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
};
});

if (options.canSelectMany) {
if (options.canPickMany) {
return asWinJsPromise(token => this._quickInputService.pick(this._contents, options, token)).then(items => {
if (items) {
return items.map(item => item.handle);
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostQuickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
this._commands = commands;
}

showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Thenable<QuickPickItem[]>, options: QuickPickOptions & { canSelectMany: true; }, token?: CancellationToken): Thenable<QuickPickItem[] | undefined>;
showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Thenable<QuickPickItem[]>, options: QuickPickOptions & { canPickMany: true; }, token?: CancellationToken): Thenable<QuickPickItem[] | undefined>;
showQuickPick(itemsOrItemsPromise: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>;
showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Thenable<QuickPickItem[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<QuickPickItem | undefined>;
showQuickPick(itemsOrItemsPromise: Item[] | Thenable<Item[]>, options?: QuickPickOptions, token: CancellationToken = CancellationToken.None): Thenable<Item | Item[] | undefined> {
Expand All @@ -45,7 +45,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
matchOnDescription: options && options.matchOnDescription,
matchOnDetail: options && options.matchOnDetail,
ignoreFocusLost: options && options.ignoreFocusOut,
canSelectMany: options && options.canPickMany
canPickMany: options && options.canPickMany
});

const promise = TPromise.any(<TPromise<number | Item[]>[]>[quickPickWidget, itemsPromise]).then(values => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/quickinput/quickInput.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
flex-grow: 1;
}

.quick-input-widget[data-type=selectMany] .quick-input-box {
.quick-input-widget[data-type=pickMany] .quick-input-box {
margin-left: 5px;
}

Expand Down
20 changes: 10 additions & 10 deletions src/vs/workbench/browser/parts/quickinput/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi

const $ = dom.$;

type InputParameters = SelectManyParameters | TextInputParameters;
type InputParameters = PickManyParameters | TextInputParameters;

export interface BaseInputParameters {
readonly type: 'selectMany' | 'textInput';
readonly type: 'pickMany' | 'textInput';
readonly ignoreFocusLost?: boolean;
}

export interface SelectManyParameters<T extends IPickOpenEntry = IPickOpenEntry> extends BaseInputParameters {
readonly type: 'selectMany';
export interface PickManyParameters<T extends IPickOpenEntry = IPickOpenEntry> extends BaseInputParameters {
readonly type: 'pickMany';
readonly picks: TPromise<T[]>;
readonly matchOnDescription?: boolean;
readonly matchOnDetail?: boolean;
Expand Down Expand Up @@ -77,15 +77,15 @@ interface InputController<R> {
readonly resolve: (ok?: true | Thenable<never>) => void | TPromise<void>;
}

class SelectManyController<T extends IPickOpenEntry> implements InputController<T[]> {
class PickManyController<T extends IPickOpenEntry> implements InputController<T[]> {
public showUI = { checkAll: true, inputBox: true, count: true, ok: true, checkboxList: true };
public result: TPromise<T[]>;
public ready: TPromise<void>;
public resolve: (ok?: true | Thenable<never>) => void;
public progress: (value: T) => void;
private closed = false;

constructor(ui: QuickInputUI, parameters: SelectManyParameters<T>) {
constructor(ui: QuickInputUI, parameters: PickManyParameters<T>) {
this.result = new TPromise<T[]>((resolve, reject, progress) => {
this.resolve = ok => resolve(ok === true ? <T[]>ui.checkboxList.getCheckedElements() : ok);
this.progress = progress;
Expand Down Expand Up @@ -315,7 +315,7 @@ export class QuickInputService extends Component implements IQuickInputService {
.map(e => e[0])
.filter(e => !!e)
.latch()
.on(e => this.controller instanceof SelectManyController && this.controller.progress(e)) // TODO
.on(e => this.controller instanceof PickManyController && this.controller.progress(e)) // TODO
);

this.toUnbind.push(dom.addDisposableListener(this.container, 'focusout', (e: FocusEvent) => {
Expand Down Expand Up @@ -400,7 +400,7 @@ export class QuickInputService extends Component implements IQuickInputService {

pick<T extends IPickOpenEntry>(picks: TPromise<T[]>, options: IPickOptions = {}, token?: CancellationToken): TPromise<T[]> {
return this.show({
type: 'selectMany',
type: 'pickMany',
picks,
placeHolder: options.placeHolder,
matchOnDescription: options.matchOnDescription,
Expand All @@ -422,7 +422,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}, token);
}

show<T extends IPickOpenEntry>(parameters: SelectManyParameters<T>, token?: CancellationToken): TPromise<T[]>;
show<T extends IPickOpenEntry>(parameters: PickManyParameters<T>, token?: CancellationToken): TPromise<T[]>;
show(parameters: TextInputParameters, token?: CancellationToken): TPromise<string>;
show<R>(parameters: InputParameters, token: CancellationToken = CancellationToken.None): TPromise<R> {
this.create();
Expand All @@ -438,7 +438,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.progressBar.stop();
this.ready = false;

this.controller = parameters.type === 'selectMany' ? new SelectManyController(this.ui, parameters) : new TextInputController(this.ui, parameters);
this.controller = parameters.type === 'pickMany' ? new PickManyController(this.ui, parameters) : new TextInputController(this.ui, parameters);
this.ui.checkAll.style.display = this.controller.showUI.checkAll ? null : 'none';
this.filterContainer.style.display = this.controller.showUI.inputBox ? null : 'none';
this.ui.inputBox.showDecoration(Severity.Ignore);
Expand Down

0 comments on commit 841f140

Please sign in to comment.