提交 80a9557b 编写于 作者: B Benjamin Pasero

fix #30770

上级 26d471d4
......@@ -29,7 +29,7 @@ import { EditorInput, IWorkbenchEditorConfiguration, IEditorInput } from 'vs/wor
import { Component } from 'vs/workbench/common/component';
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 { QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry, CLOSE_ON_FOCUS_LOST_CONFIG, SEARCH_EDITOR_HISTORY } from 'vs/workbench/browser/quickopen';
import * as errors from 'vs/base/common/errors';
import { IQuickOpenService, IShowOptions } from 'vs/platform/quickOpen/common/quickOpen';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
......@@ -77,6 +77,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
private previousActiveHandlerDescriptor: QuickOpenHandlerDescriptor;
private actionProvider = new ContributableActionProvider();
private closeOnFocusLost: boolean;
private searchInEditorHistory: boolean;
private editorHistoryHandler: EditorHistoryHandler;
private pendingGetResultsInvocation: CancellationTokenSource;
......@@ -111,6 +112,8 @@ export class QuickOpenController extends Component implements IQuickOpenService
} else {
this.closeOnFocusLost = this.configurationService.getValue(CLOSE_ON_FOCUS_LOST_CONFIG);
}
this.searchInEditorHistory = this.configurationService.getValue(SEARCH_EDITOR_HISTORY);
}
navigate(next: boolean, quickNavigate?: IQuickNavigateConfiguration): void {
......@@ -403,8 +406,14 @@ export class QuickOpenController extends Component implements IQuickOpenService
private handleDefaultHandler(handler: QuickOpenHandlerDescriptor, value: string, token: CancellationToken): TPromise<void> {
// Fill in history results if matching
const matchingHistoryEntries = this.editorHistoryHandler.getResults(value, token);
// Fill in history results if matching and we are configured to search in history
let matchingHistoryEntries: QuickOpenEntry[];
if (value && !this.searchInEditorHistory) {
matchingHistoryEntries = [];
} else {
matchingHistoryEntries = this.editorHistoryHandler.getResults(value, token);
}
if (matchingHistoryEntries.length > 0) {
matchingHistoryEntries[0] = new EditorHistoryEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened"), false);
}
......
......@@ -22,6 +22,7 @@ import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/
import { CancellationToken } from 'vs/base/common/cancellation';
export const CLOSE_ON_FOCUS_LOST_CONFIG = 'workbench.quickOpen.closeOnFocusLost';
export const SEARCH_EDITOR_HISTORY = 'search.quickOpen.includeHistory';
export interface IWorkbenchQuickOpenConfiguration {
workbench: {
......
......@@ -602,6 +602,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('search.quickOpen.includeSymbols', "Whether to include results from a global symbol search in the file results for Quick Open."),
default: false
},
'search.quickOpen.includeHistory': {
type: 'boolean',
description: nls.localize('search.quickOpen.includeHistory', "Whether to include results from recently opened files in the file results for Quick Open."),
default: true
},
'search.followSymlinks': {
type: 'boolean',
description: nls.localize('search.followSymlinks', "Controls whether to follow symlinks while searching."),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册