Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3

This commit is contained in:
ADS Merger
2020-03-11 04:19:23 +00:00
parent 16fab722d5
commit 4c3e48773d
880 changed files with 20441 additions and 11232 deletions

View File

@@ -6,14 +6,27 @@
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IMatch } from 'vs/base/common/filters';
import { IItemAccessor } from 'vs/base/common/fuzzyScorer';
import { Schemas } from 'vs/base/common/network';
export interface IQuickPickItemHighlights {
label?: IMatch[];
description?: IMatch[];
detail?: IMatch[];
}
export interface IQuickPickItem {
type?: 'item';
id?: string;
label: string;
ariaLabel?: string;
description?: string;
detail?: string;
iconClasses?: string[];
italic?: boolean;
highlights?: IQuickPickItemHighlights;
buttons?: IQuickInputButton[];
picked?: boolean;
alwaysShow?: boolean;
@@ -125,7 +138,10 @@ export interface IInputOptions {
validateInput?: (input: string) => Promise<string | null | undefined>;
}
export interface IQuickInput {
export interface IQuickInput extends IDisposable {
readonly onDidHide: Event<void>;
readonly onDispose: Event<void>;
title: string | undefined;
@@ -146,16 +162,20 @@ export interface IQuickInput {
show(): void;
hide(): void;
onDidHide: Event<void>;
dispose(): void;
}
export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
value: string;
/**
* A method that allows to massage the value used
* for filtering, e.g, to remove certain parts.
*/
filterValue: (value: string) => string;
ariaLabel: string;
placeholder: string | undefined;
readonly onDidChangeValue: Event<string>;
@@ -254,3 +274,28 @@ export interface IQuickPickItemButtonContext<T extends IQuickPickItem> extends I
}
export type QuickPickInput<T = IQuickPickItem> = T | IQuickPickSeparator;
//region Fuzzy Scorer Support
export type IQuickPickItemWithResource = IQuickPickItem & { resource: URI | undefined };
export const quickPickItemScorerAccessor = new class implements IItemAccessor<IQuickPickItemWithResource> {
getItemLabel(entry: IQuickPickItemWithResource): string {
return entry.label;
}
getItemDescription(entry: IQuickPickItemWithResource): string | undefined {
return entry.description;
}
getItemPath(entry: IQuickPickItemWithResource): string | undefined {
if (entry.resource?.scheme === Schemas.file) {
return entry.resource.fsPath;
}
return entry.resource?.path;
}
};
//#endregion