提交 4e9cc698 编写于 作者: B Benjamin Pasero

untitled and created files are pinned by default

上级 0744ade2
......@@ -333,7 +333,7 @@ export class TextEditorOptions extends EditorOptions {
public static from(input: IResourceInput): TextEditorOptions {
let options: TextEditorOptions = null;
if (input && input.options) {
if (input.options.selection || input.options.forceOpen || input.options.preserveFocus) {
if (input.options.selection || input.options.forceOpen || input.options.preserveFocus || input.options.pinned || typeof input.options.index === 'number') {
options = new TextEditorOptions();
}
......
......@@ -184,13 +184,13 @@ export class TextFileEditor extends BaseTextEditor {
new Action('workbench.files.action.createMissingFile', nls.localize('createFile', "Create File"), null, true, () => {
return this.fileService.updateContent((<FileEditorInput>input).getResource(), '').then(() => {
// Add to working files
this.textFileService.getWorkingFilesModel().addEntry((<FileEditorInput>input).getResource());
// Open
return this.editorService.openEditor({
resource: (<FileEditorInput>input).getResource(),
mime: MIME_TEXT
mime: MIME_TEXT,
options: {
pinned: true // new file gets pinned by default
}
});
});
})
......
......@@ -578,10 +578,7 @@ export class GlobalNewUntitledFileAction extends Action {
public run(): TPromise<any> {
let input = this.untitledEditorService.createOrGet();
// Make sure this untitled buffer shows up in working files set
this.textFileService.getWorkingFilesModel().addEntry(input.getResource());
return this.editorService.openEditor(input);
return this.editorService.openEditor(input, EditorOptions.create({ pinned: true })); // untitled are always pinned
}
}
......
......@@ -6,7 +6,6 @@
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import paths = require('vs/base/common/paths');
import {IWorkbenchContribution} from 'vs/workbench/common/contributions';
import {TextFileChangeEvent, EventType as FileEventType, ITextFileService, AutoSaveMode, VIEWLET_ID} from 'vs/workbench/parts/files/common/files';
import {IFileService} from 'vs/platform/files/common/files';
......@@ -123,16 +122,6 @@ export class FileTracker implements IWorkbenchContribution {
return viewletPromise.then(() => {
// Out of workspace files get added right away to working files model
resources.forEach((fileToOpen) => {
let resource = fileToOpen.resource;
let workspace = this.contextService.getWorkspace();
if (!workspace || !paths.isEqualOrParent(resource.fsPath, workspace.resource.fsPath)) {
this.textFileService.getWorkingFilesModel().addEntry(resource);
}
});
// In diffMode we open 2 resources as diff
if (diffMode) {
return TPromise.join(resources.map(f => this.editorService.inputToType(f))).then((inputs: EditorInput[]) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册