提交 4c71656f 编写于 作者: C Christof Marti

Remove dead code (#29096)

上级 b3ae7679
......@@ -5,94 +5,9 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import uri from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IQuickNavigateConfiguration, IAutoFocus, IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen';
import { IQuickNavigateConfiguration, IAutoFocus } from 'vs/base/parts/quickopen/common/quickOpen';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IAction } from 'vs/base/common/actions';
import { FileKind } from 'vs/platform/files/common/files';
export interface IFilePickOpenEntry extends IPickOpenEntry {
resource: uri;
fileKind?: FileKind;
}
export interface IPickOpenAction extends IAction {
run(item: IPickOpenItem): TPromise<any>;
}
export interface IPickOpenEntry {
id?: string;
label: string;
description?: string;
detail?: string;
tooltip?: string;
separator?: ISeparator;
alwaysShow?: boolean;
run?: (context: IEntryRunContext) => void;
action?: IAction;
payload?: any;
}
export interface IPickOpenItem {
index: number;
remove: () => void;
getId: () => string;
getResource: () => uri;
getPayload: () => any;
}
export interface ISeparator {
border?: boolean;
label?: string;
}
export interface IPickOptions {
/**
* an optional string to show as place holder in the input box to guide the user what she picks on
*/
placeHolder?: string;
/**
* optional auto focus settings
*/
autoFocus?: IAutoFocus;
/**
* an optional flag to include the description when filtering the picks
*/
matchOnDescription?: boolean;
/**
* an optional flag to include the detail when filtering the picks
*/
matchOnDetail?: boolean;
/**
* an optional flag to not close the picker on focus lost
*/
ignoreFocusLost?: boolean;
/**
* enables quick navigate in the picker to open an element without typing
*/
quickNavigateConfiguration?: IQuickNavigateConfiguration;
/**
* a context key to set when this picker is active
*/
contextKey?: string;
}
export interface IStringPickOptions extends IPickOptions {
onDidFocus?: (item: string) => void;
}
export interface ITypedPickOptions<T extends IPickOpenEntry> extends IPickOptions {
onDidFocus?: (entry: T) => void;
}
export interface IShowOptions {
quickNavigateConfiguration?: IQuickNavigateConfiguration;
......@@ -115,18 +30,6 @@ export interface IQuickOpenService {
*/
show(prefix?: string, options?: IShowOptions): TPromise<void>;
/**
* A convenient way to bring up quick open as a picker with custom elements. This bypasses the quick open handler
* registry and just leverages the quick open widget to select any kind of entries.
*
* Passing in a promise will allow you to resolve the elements in the background while quick open will show a
* progress bar spinning.
*/
pick(picks: TPromise<string[]>, options?: IStringPickOptions, token?: CancellationToken): TPromise<string>;
pick<T extends IPickOpenEntry>(picks: TPromise<T[]>, options?: ITypedPickOptions<T>, token?: CancellationToken): TPromise<T>;
pick(picks: string[], options?: IStringPickOptions, token?: CancellationToken): TPromise<string>;
pick<T extends IPickOpenEntry>(picks: T[], options?: ITypedPickOptions<T>, token?: CancellationToken): TPromise<T>;
/**
* Allows to navigate from the outside in an opened picker.
*/
......
......@@ -14,11 +14,10 @@ import URI from 'vs/base/common/uri';
import * as resources from 'vs/base/common/resources';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import * as types from 'vs/base/common/types';
import { Action, IAction } from 'vs/base/common/actions';
import { Action } from 'vs/base/common/actions';
import { IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Mode, IEntryRunContext, IAutoFocus, IQuickNavigateConfiguration, IModel } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup, compareEntries, QuickOpenItemAccessorClass } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup, QuickOpenItemAccessorClass } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { QuickOpenWidget, HideReason } from 'vs/base/parts/quickopen/browser/quickOpenWidget';
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
import { ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
......@@ -33,7 +32,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry, CLOSE_ON_FOCUS_LOST_CONFIG } from 'vs/workbench/browser/quickopen';
import * as errors from 'vs/base/common/errors';
import { IPickOpenEntry, IFilePickOpenEntry, IQuickOpenService, IShowOptions, IPickOpenItem, IStringPickOptions, ITypedPickOptions } from 'vs/platform/quickOpen/common/quickOpen';
import { IQuickOpenService, IShowOptions } from 'vs/platform/quickOpen/common/quickOpen';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
......@@ -42,41 +41,20 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';
import { attachQuickOpenStyler } from 'vs/platform/theme/common/styler';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ITree, IActionProvider } from 'vs/base/parts/tree/browser/tree';
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { FileKind, IFileService } from 'vs/platform/files/common/files';
import { IFileService } from 'vs/platform/files/common/files';
import { scoreItem, ScorerCache, compareItemsByScore, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
import { matchesFuzzyOcticonAware, parseOcticons, IParsedOcticons } from 'vs/base/common/octicon';
import { IMatch } from 'vs/base/common/filters';
import { Schemas } from 'vs/base/common/network';
import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { Dimension, addClass } from 'vs/base/browser/dom';
import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { isThenable, timeout } from 'vs/base/common/async';
import { timeout } from 'vs/base/common/async';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
const HELP_PREFIX = '?';
interface IInternalPickOptions {
contextKey?: string;
value?: string;
valueSelection?: [number, number];
placeHolder?: string;
inputDecoration?: Severity;
password?: boolean;
autoFocus?: IAutoFocus;
matchOnDescription?: boolean;
matchOnDetail?: boolean;
ignoreFocusLost?: boolean;
quickNavigateConfiguration?: IQuickNavigateConfiguration;
onDidType?: (value: string) => any;
onDidFocus?: (item: any) => void;
}
export class QuickOpenController extends Component implements IQuickOpenService {
private static readonly MAX_SHORT_RESPONSE_TIME = 500;
......@@ -91,13 +69,11 @@ export class QuickOpenController extends Component implements IQuickOpenService
get onHide(): Event<void> { return this._onHide.event; }
private quickOpenWidget: QuickOpenWidget;
private pickOpenWidget: QuickOpenWidget;
private layoutDimensions: Dimension;
private mapResolvedHandlersToPrefix: { [prefix: string]: TPromise<QuickOpenHandler>; } = Object.create(null);
private mapContextKeyToContext: { [id: string]: IContextKey<boolean>; } = Object.create(null);
private handlerOnOpenCalled: { [prefix: string]: boolean; } = Object.create(null);
private currentResultToken: string;
private currentPickerToken: string;
private promisesToCompleteOnHide: ValueCallback[] = [];
private previousActiveHandlerDescriptor: QuickOpenHandlerDescriptor;
private actionProvider = new ContributableActionProvider();
......@@ -124,7 +100,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
}
private registerListeners(): void {
this._register(this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration()));
this._register(this.configurationService.onDidChangeConfiguration(() => this.updateConfiguration()));
this._register(this.partService.onTitleBarVisibilityChange(() => this.positionQuickOpenWidget()));
this._register(browser.onDidChangeZoomLevel(() => this.positionQuickOpenWidget()));
}
......@@ -141,295 +117,24 @@ export class QuickOpenController extends Component implements IQuickOpenService
if (this.quickOpenWidget) {
this.quickOpenWidget.navigate(next, quickNavigate);
}
if (this.pickOpenWidget) {
this.pickOpenWidget.navigate(next, quickNavigate);
}
}
pick(picks: TPromise<string[]>, options?: IStringPickOptions, token?: CancellationToken): TPromise<string>;
pick<T extends IPickOpenEntry>(picks: TPromise<T[]>, options?: ITypedPickOptions<T>, token?: CancellationToken): TPromise<string>;
pick(picks: string[], options?: IStringPickOptions, token?: CancellationToken): TPromise<string>;
pick<T extends IPickOpenEntry>(picks: T[], options?: ITypedPickOptions<T>, token?: CancellationToken): TPromise<T>;
pick(arg1: string[] | TPromise<string[]> | IPickOpenEntry[] | TPromise<IPickOpenEntry[]>, options?: IStringPickOptions | ITypedPickOptions<IPickOpenEntry>, token?: CancellationToken): TPromise<string | IPickOpenEntry> {
if (!options) {
options = Object.create(null);
}
let arrayPromise: TPromise<string[] | IPickOpenEntry[]>;
if (Array.isArray(arg1)) {
arrayPromise = TPromise.as(arg1);
} else if (isThenable(arg1)) {
arrayPromise = arg1;
} else {
throw new Error('illegal input');
}
let isAboutStrings = false;
const entryPromise = arrayPromise.then(elements => {
return (<Array<string | IPickOpenEntry>>elements).map(element => {
if (typeof element === 'string') {
isAboutStrings = true;
return <IPickOpenEntry>{ label: element };
} else {
return element;
}
});
});
if (this.pickOpenWidget && this.pickOpenWidget.isVisible()) {
this.pickOpenWidget.hide(HideReason.CANCELED);
}
return new TPromise<string | IPickOpenEntry>((resolve, reject) => {
function onItem(item: IPickOpenEntry): string | IPickOpenEntry {
return item && isAboutStrings ? item.label : item;
}
this.doPick(entryPromise, options, token).then(item => resolve(onItem(item)), err => reject(err));
});
}
private doPick(picksPromise: TPromise<IPickOpenEntry[]>, options: IInternalPickOptions, token: CancellationToken = CancellationToken.None): TPromise<IPickOpenEntry> {
const autoFocus = options.autoFocus;
// Use a generated token to avoid race conditions from long running promises
const currentPickerToken = defaultGenerator.nextId();
this.currentPickerToken = currentPickerToken;
// Update context
this.setQuickOpenContextKey(options.contextKey);
// Create upon first open
if (!this.pickOpenWidget) {
this.pickOpenWidget = this._register(new QuickOpenWidget(
document.getElementById(this.partService.getWorkbenchElementId()),
{
onOk: () => { /* ignore, handle later */ },
onCancel: () => { /* ignore, handle later */ },
onType: (value: string) => { /* ignore, handle later */ },
onShow: () => this.handleOnShow(true),
onHide: (reason) => this.handleOnHide(true, reason)
}, {
inputPlaceHolder: options.placeHolder || '',
keyboardSupport: false,
treeCreator: (container, config, opts) => this.instantiationService.createInstance(WorkbenchTree, container, config, opts)
}
));
this._register(attachQuickOpenStyler(this.pickOpenWidget, this.themeService, { background: SIDE_BAR_BACKGROUND, foreground: SIDE_BAR_FOREGROUND }));
const pickOpenContainer = this.pickOpenWidget.create();
addClass(pickOpenContainer, 'show-file-icons');
this.positionQuickOpenWidget();
}
// Update otherwise
else {
this.pickOpenWidget.setPlaceHolder(options.placeHolder || '');
}
// Respect input value
if (options.value) {
this.pickOpenWidget.setValue(options.value, options.valueSelection);
}
// Respect password
this.pickOpenWidget.setPassword(options.password);
// Input decoration
if (!types.isUndefinedOrNull(options.inputDecoration)) {
this.pickOpenWidget.showInputDecoration(options.inputDecoration);
} else {
this.pickOpenWidget.clearInputDecoration();
}
// Layout
if (this.layoutDimensions) {
this.pickOpenWidget.layout(this.layoutDimensions);
}
return new TPromise<IPickOpenEntry>((complete, error) => {
// Detect cancellation while pick promise is loading
this.pickOpenWidget.setCallbacks({
onCancel: () => { complete(void 0); },
onOk: () => { /* ignore, handle later */ },
onType: (value: string) => { /* ignore, handle later */ },
});
// hide widget when being cancelled
token.onCancellationRequested(e => {
if (this.currentPickerToken === currentPickerToken) {
this.pickOpenWidget.hide(HideReason.CANCELED);
}
});
let picksPromiseDone = false;
// Resolve picks
picksPromise.then(picks => {
if (this.currentPickerToken !== currentPickerToken) {
return complete(void 0); // Return as canceled if another request came after or user canceled
}
picksPromiseDone = true;
// Reset Progress
this.pickOpenWidget.getProgressBar().stop().hide();
// Model
const model = new QuickOpenModel([], new PickOpenActionProvider());
const entries = picks.map((e, index) => {
const onPreview = () => {
if (options.onDidFocus) {
options.onDidFocus(e);
}
};
return this.instantiationService.createInstance(PickOpenEntry, e, index, onPreview, () => this.pickOpenWidget.refresh());
});
if (picks.length === 0) {
entries.push(this.instantiationService.createInstance(PickOpenEntry, { label: nls.localize('emptyPicks', "There are no entries to pick from") }, 0, null, null));
}
model.setEntries(entries);
// Handlers
const callbacks = {
onOk: () => {
if (picks.length === 0) {
return complete(null);
}
let index = -1;
let context: IEntryRunContext;
entries.forEach(entry => {
if (entry.shouldRunWithContext) {
index = entry.index;
context = entry.shouldRunWithContext;
}
});
const selectedPick = picks[index];
if (selectedPick && typeof selectedPick.run === 'function') {
selectedPick.run(context);
}
complete(selectedPick || null);
},
onCancel: () => complete(void 0),
onFocusLost: () => !this.closeOnFocusLost || options.ignoreFocusLost,
onType: (value: string) => {
// the caller takes care of all input
if (options.onDidType) {
options.onDidType(value);
return;
}
if (picks.length === 0) {
return;
}
value = value ? strings.trim(value) : value;
// Reset filtering
if (!value) {
entries.forEach(e => {
e.setHighlights(null);
e.setHidden(false);
});
}
// Filter by value (since we support octicons, use octicon aware fuzzy matching)
else {
entries.forEach(entry => {
const { labelHighlights, descriptionHighlights, detailHighlights } = entry.matchesFuzzy(value, options);
if (entry.shouldAlwaysShow() || labelHighlights || descriptionHighlights || detailHighlights) {
entry.setHighlights(labelHighlights, descriptionHighlights, detailHighlights);
entry.setHidden(false);
} else {
entry.setHighlights(null, null, null);
entry.setHidden(true);
}
});
}
// Sort by value
const normalizedSearchValue = value ? strings.stripWildcards(value.toLowerCase()) : value;
model.entries.sort((pickA: PickOpenEntry, pickB: PickOpenEntry) => {
if (!value) {
return pickA.index - pickB.index; // restore natural order
}
return compareEntries(pickA, pickB, normalizedSearchValue);
});
this.pickOpenWidget.refresh(model, value ? { autoFocusFirstEntry: true } : autoFocus);
},
onShow: () => this.handleOnShow(true),
onHide: (reason: HideReason) => this.handleOnHide(true, reason)
};
this.pickOpenWidget.setCallbacks(callbacks);
// Set input
if (!this.pickOpenWidget.isVisible()) {
this.pickOpenWidget.show(model, { autoFocus, quickNavigateConfiguration: options.quickNavigateConfiguration });
} else {
this.pickOpenWidget.setInput(model, autoFocus);
}
// The user might have typed something (or options.value was set) so we need to play back
// the input box value through our callbacks to filter the result accordingly.
const inputValue = this.pickOpenWidget.getInputBox().value;
if (inputValue) {
callbacks.onType(inputValue);
}
}, (err) => {
this.pickOpenWidget.hide();
error(err);
});
// Progress if task takes a long time
setTimeout(() => {
if (!picksPromiseDone && this.currentPickerToken === currentPickerToken) {
this.pickOpenWidget.getProgressBar().infinite().show();
}
}, 800);
// Show picker empty if resolving takes a while
if (!picksPromiseDone) {
this.pickOpenWidget.show(new QuickOpenModel());
}
});
}
accept(): void {
[this.quickOpenWidget, this.pickOpenWidget].forEach(w => {
if (w && w.isVisible()) {
w.accept();
}
});
if (this.quickOpenWidget.isVisible()) {
this.quickOpenWidget.accept();
}
}
focus(): void {
[this.quickOpenWidget, this.pickOpenWidget].forEach(w => {
if (w && w.isVisible()) {
w.focus();
}
});
if (this.quickOpenWidget.isVisible()) {
this.quickOpenWidget.focus();
}
}
close(): void {
[this.quickOpenWidget, this.pickOpenWidget].forEach(w => {
if (w && w.isVisible()) {
w.hide(HideReason.CANCELED);
}
});
if (this.quickOpenWidget.isVisible()) {
this.quickOpenWidget.hide(HideReason.CANCELED);
}
}
private emitQuickOpenVisibilityChange(isVisible: boolean): void {
......@@ -464,8 +169,8 @@ export class QuickOpenController extends Component implements IQuickOpenService
onOk: () => { /* ignore */ },
onCancel: () => { /* ignore */ },
onType: (value: string) => this.onType(value || ''),
onShow: () => this.handleOnShow(false),
onHide: (reason) => this.handleOnHide(false, reason),
onShow: () => this.handleOnShow(),
onHide: (reason) => this.handleOnHide(reason),
onFocusLost: () => !this.closeOnFocusLost
}, {
inputPlaceHolder: this.hasHandler(HELP_PREFIX) ? nls.localize('quickOpenInput', "Type '?' to get help on the actions you can take from here") : '',
......@@ -527,42 +232,29 @@ export class QuickOpenController extends Component implements IQuickOpenService
if (this.quickOpenWidget) {
this.quickOpenWidget.getElement().style.top = `${titlebarOffset}px`;
}
if (this.pickOpenWidget) {
this.pickOpenWidget.getElement().style.top = `${titlebarOffset}px`;
}
}
private handleOnShow(isPicker: boolean): void {
if (isPicker && this.quickOpenWidget) {
this.quickOpenWidget.hide(HideReason.FOCUS_LOST);
} else if (!isPicker && this.pickOpenWidget) {
this.pickOpenWidget.hide(HideReason.FOCUS_LOST);
}
private handleOnShow(): void {
this.emitQuickOpenVisibilityChange(true);
}
private handleOnHide(isPicker: boolean, reason: HideReason): void {
if (!isPicker) {
// Clear state
this.previousActiveHandlerDescriptor = null;
private handleOnHide(reason: HideReason): void {
// Clear state
this.previousActiveHandlerDescriptor = null;
// Pass to handlers
for (let prefix in this.mapResolvedHandlersToPrefix) {
const promise = this.mapResolvedHandlersToPrefix[prefix];
promise.then(handler => {
this.handlerOnOpenCalled[prefix] = false;
// Pass to handlers
for (let prefix in this.mapResolvedHandlersToPrefix) {
const promise = this.mapResolvedHandlersToPrefix[prefix];
promise.then(handler => {
this.handlerOnOpenCalled[prefix] = false;
handler.onClose(reason === HideReason.CANCELED); // Don't check if onOpen was called to preserve old behaviour for now
});
}
handler.onClose(reason === HideReason.CANCELED); // Don't check if onOpen was called to preserve old behaviour for now
});
}
// Complete promises that are waiting
while (this.promisesToCompleteOnHide.length) {
this.promisesToCompleteOnHide.pop()(true);
}
// Complete promises that are waiting
while (this.promisesToCompleteOnHide.length) {
this.promisesToCompleteOnHide.pop()(true);
}
if (reason !== HideReason.FOCUS_LOST) {
......@@ -883,10 +575,6 @@ export class QuickOpenController extends Component implements IQuickOpenService
if (this.quickOpenWidget) {
this.quickOpenWidget.layout(this.layoutDimensions);
}
if (this.pickOpenWidget) {
this.pickOpenWidget.layout(this.layoutDimensions);
}
}
}
......@@ -904,169 +592,6 @@ class PlaceholderQuickOpenEntry extends QuickOpenEntryGroup {
}
}
class PickOpenEntry extends PlaceholderQuickOpenEntry implements IPickOpenItem {
private _shouldRunWithContext: IEntryRunContext;
private description: string;
private detail: string;
private tooltip: string;
private descriptionTooltip: string;
private hasSeparator: boolean;
private separatorLabel: string;
private alwaysShow: boolean;
private resource: URI;
private fileKind: FileKind;
private _action: IAction;
private removed: boolean;
private payload: any;
private labelOcticons: IParsedOcticons;
private descriptionOcticons: IParsedOcticons;
private detailOcticons: IParsedOcticons;
constructor(
item: IPickOpenEntry,
private _index: number,
private onPreview: () => void,
private onRemove: () => void,
@IModeService private modeService: IModeService,
@IModelService private modelService: IModelService
) {
super(item.label);
this.description = item.description;
this.detail = item.detail;
this.tooltip = item.tooltip;
this.descriptionOcticons = item.description ? parseOcticons(item.description) : void 0;
this.descriptionTooltip = this.descriptionOcticons ? this.descriptionOcticons.text : void 0;
this.hasSeparator = item.separator && item.separator.border;
this.separatorLabel = item.separator && item.separator.label;
this.alwaysShow = item.alwaysShow;
this._action = item.action;
this.payload = item.payload;
const fileItem = <IFilePickOpenEntry>item;
this.resource = fileItem.resource;
this.fileKind = fileItem.fileKind;
}
matchesFuzzy(query: string, options: IInternalPickOptions): { labelHighlights: IMatch[], descriptionHighlights: IMatch[], detailHighlights: IMatch[] } {
if (!this.labelOcticons) {
this.labelOcticons = parseOcticons(this.getLabel()); // parse on demand
}
const detail = this.getDetail();
if (detail && options.matchOnDetail && !this.detailOcticons) {
this.detailOcticons = parseOcticons(detail); // parse on demand
}
return {
labelHighlights: matchesFuzzyOcticonAware(query, this.labelOcticons),
descriptionHighlights: options.matchOnDescription && this.descriptionOcticons ? matchesFuzzyOcticonAware(query, this.descriptionOcticons) : void 0,
detailHighlights: options.matchOnDetail && this.detailOcticons ? matchesFuzzyOcticonAware(query, this.detailOcticons) : void 0
};
}
getPayload(): any {
return this.payload;
}
remove(): void {
super.setHidden(true);
this.removed = true;
this.onRemove();
}
isHidden(): boolean {
return this.removed || super.isHidden();
}
get action(): IAction {
return this._action;
}
get index(): number {
return this._index;
}
getLabelOptions(): IIconLabelValueOptions {
return {
extraClasses: this.resource ? getIconClasses(this.modelService, this.modeService, this.resource, this.fileKind) : []
};
}
get shouldRunWithContext(): IEntryRunContext {
return this._shouldRunWithContext;
}
getDescription(): string {
return this.description;
}
getDetail(): string {
return this.detail;
}
getTooltip(): string {
return this.tooltip;
}
getDescriptionTooltip(): string {
return this.descriptionTooltip;
}
showBorder(): boolean {
return this.hasSeparator;
}
getGroupLabel(): string {
return this.separatorLabel;
}
shouldAlwaysShow(): boolean {
return this.alwaysShow;
}
getResource(): URI {
return this.resource;
}
run(mode: Mode, context: IEntryRunContext): boolean {
if (mode === Mode.OPEN) {
this._shouldRunWithContext = context;
return true;
}
if (mode === Mode.PREVIEW && this.onPreview) {
this.onPreview();
}
return false;
}
}
class PickOpenActionProvider implements IActionProvider {
hasActions(tree: ITree, element: PickOpenEntry): boolean {
return !!element.action;
}
getActions(tree: ITree, element: PickOpenEntry): TPromise<IAction[]> {
return TPromise.as(element.action ? [element.action] : []);
}
hasSecondaryActions(tree: ITree, element: PickOpenEntry): boolean {
return false;
}
getSecondaryActions(tree: ITree, element: PickOpenEntry): TPromise<IAction[]> {
return TPromise.as([]);
}
getActionItem(tree: ITree, element: PickOpenEntry, action: Action): BaseActionItem {
return null;
}
}
class EditorHistoryHandler {
private scorerCache: ScorerCache;
......@@ -1123,7 +648,7 @@ class EditorHistoryHandler {
// Sort by score and provide a fallback sorter that keeps the
// recency of items in case the score for items is the same
.sort((e1, e2) => compareItemsByScore(e1, e2, query, false, accessor, this.scorerCache, (e1, e2, query, accessor) => -1));
.sort((e1, e2) => compareItemsByScore(e1, e2, query, false, accessor, this.scorerCache, () => -1));
}
}
......
......@@ -22,10 +22,6 @@ export class TestQuickOpenService implements IQuickOpenService {
this.callback = callback;
}
pick(arg: any, options?: any, token?: any): Promise {
return TPromise.as(null);
}
accept(): void {
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册