提交 7edbf1fd 编写于 作者: B Benjamin Pasero

setting to control preview from quick open (#5554)

上级 e1317923
......@@ -411,7 +411,12 @@ configurationRegistry.registerConfiguration({
},
'workbench.previewEditors': {
'type': 'boolean',
'description': nls.localize('previewEditors', "Controls if opened editors show as preview until getting pinned."),
'description': nls.localize('previewEditors', "Controls if opened editors show as preview until getting pinned. Set to false to always open editors pinned."),
'default': true
},
'workbench.quickOpenPreviews': {
'type': 'boolean',
'description': nls.localize('quickOpenPreviews', "Controls if editors opened from quick open show as preview. Set to false to always open editors from quick open pinned."),
'default': true
}
}
......
......@@ -22,7 +22,7 @@ import {ITree, IElementCallback} from 'vs/base/parts/tree/browser/tree';
import labels = require('vs/base/common/labels');
import paths = require('vs/base/common/paths');
import {Registry} from 'vs/platform/platform';
import {EditorInput, getUntitledOrFileResource} from 'vs/workbench/common/editor';
import {EditorInput, EditorOptions, getUntitledOrFileResource, IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor';
import {WorkbenchComponent} from 'vs/workbench/common/component';
import Event, {Emitter} from 'vs/base/common/event';
import {Identifiers} from 'vs/workbench/common/constants';
......@@ -33,6 +33,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
import {IPickOpenEntry, IInputOptions, IQuickOpenService, IPickOptions, IShowOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
......@@ -982,6 +983,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
input: EditorInput,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService private configurationService: IConfigurationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
) {
super(editorService);
......@@ -1020,8 +1022,10 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
public run(mode: Mode, context: IEntryRunContext): boolean {
if (mode === Mode.OPEN) {
let sideBySide = !context.quickNavigateConfiguration && context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
this.editorService.openEditor(this.input, null, sideBySide).done(null, errors.onUnexpectedError);
const sideBySide = !context.quickNavigateConfiguration && context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
const pinned = !this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.quickOpenPreviews;
this.editorService.openEditor(this.input, EditorOptions.create({ pinned }), sideBySide).done(null, errors.onUnexpectedError);
return true;
}
......
......@@ -667,5 +667,6 @@ export interface IWorkbenchEditorConfiguration {
workbench: {
showEditorTabs: boolean;
previewEditors: boolean;
quickOpenPreviews: boolean;
};
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import {QuickOpenEntry, QuickOpenModel} from 'vs/base/parts/quickopen/browser/qu
import {QuickOpenHandler, EditorQuickOpenEntry} from 'vs/workbench/browser/quickopen';
import {QueryBuilder} from 'vs/workbench/parts/search/common/searchQuery';
import {ITextFileService} from 'vs/workbench/parts/files/common/files';
import {EditorInput, getOutOfWorkspaceEditorResources} from 'vs/workbench/common/editor';
import {EditorInput, getOutOfWorkspaceEditorResources, IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor';
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
import {IResourceInput} from 'vs/platform/editor/common/editor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
......@@ -37,6 +37,7 @@ export class FileEntry extends EditorQuickOpenEntry {
resource: URI,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService private configurationService: IConfigurationService,
@IWorkspaceContextService contextService: IWorkspaceContextService
) {
super(editorService);
......@@ -73,12 +74,13 @@ export class FileEntry extends EditorQuickOpenEntry {
public getInput(): IResourceInput | EditorInput {
let input: IResourceInput = {
resource: this.resource,
options: {
pinned: !this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.quickOpenPreviews
}
};
if (this.range) {
input.options = {
selection: this.range
};
input.options.selection = this.range;
}
return input;
......
......@@ -13,13 +13,14 @@ import {QuickOpenModel, QuickOpenEntry, IHighlight} from 'vs/base/parts/quickope
import {IAutoFocus} from 'vs/base/parts/quickopen/common/quickOpen';
import filters = require('vs/base/common/filters');
import {IRange} from 'vs/editor/common/editorCommon';
import {EditorInput} from 'vs/workbench/common/editor';
import {EditorInput, IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor';
import labels = require('vs/base/common/labels');
import {IResourceInput} from 'vs/platform/editor/common/editor';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ITypeBearing, getNavigateToItems} from 'vs/workbench/parts/search/common/search';
class SymbolEntry extends EditorQuickOpenEntry {
......@@ -30,7 +31,17 @@ class SymbolEntry extends EditorQuickOpenEntry {
private type: string;
private range: IRange;
constructor(name: string, parameters: string, description: string, resource: URI, type: string, range: IRange, highlights: IHighlight[], editorService: IWorkbenchEditorService) {
constructor(
name: string,
parameters: string,
description: string,
resource: URI,
type: string,
range: IRange,
highlights: IHighlight[],
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(editorService);
this.name = name;
......@@ -73,14 +84,15 @@ class SymbolEntry extends EditorQuickOpenEntry {
public getInput(): IResourceInput | EditorInput {
let input: IResourceInput = {
resource: this.resource,
options: {
pinned: !this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.quickOpenPreviews
}
};
if (this.range) {
input.options = {
selection: {
startLineNumber: this.range.startLineNumber,
startColumn: this.range.startColumn
}
input.options.selection = {
startLineNumber: this.range.startLineNumber,
startColumn: this.range.startColumn
};
}
......@@ -179,7 +191,7 @@ export class OpenSymbolHandler extends QuickOpenHandler {
container = element.containerName || path;
}
results.push(new SymbolEntry(element.name, element.parameters, container, resource, element.type, element.range, highlights, this.editorService));
results.push(this.instantiationService.createInstance(SymbolEntry, element.name, element.parameters, container, resource, element.type, element.range, highlights));
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册