提交 fbe8445f 编写于 作者: B Benjamin Pasero

set files to open as pinned when opened on startup

上级 af744829
......@@ -380,7 +380,7 @@ export class ElectronWindow {
// In diffMode we open 2 resources as diff
if (diffMode && resources.length === 2) {
return this.editorService.openEditor({ leftResource: resources[0].resource, rightResource: resources[1].resource });
return this.editorService.openEditor({ leftResource: resources[0].resource, rightResource: resources[1].resource, options: { pinned: true } });
}
// For one file, just put it into the current active editor
......
......@@ -357,7 +357,7 @@ export class Workbench implements IPartService {
// Files to diff is exclusive
if (filesToDiff && filesToDiff.length === 2) {
return this.editorService.createInput({ leftResource: filesToDiff[0].resource, rightResource: filesToDiff[1].resource }).then(input => [{ input }]);
return this.editorService.createInput({ leftResource: filesToDiff[0].resource, rightResource: filesToDiff[1].resource }).then(input => [{ input, options: EditorOptions.create({ pinned: true }) }]);
}
// Otherwise: Open/Create files
......@@ -367,14 +367,19 @@ export class Workbench implements IPartService {
// Files to create
inputs.push(...filesToCreate.map(resourceInput => this.untitledEditorService.createOrGet(resourceInput.resource)));
options.push(...filesToCreate.map(r => null)); // fill empty options for files to create because we dont have options there
options.push(...filesToCreate.map(r => EditorOptions.create({ pinned: true })));
// Files to open
let filesToOpenInputPromise = filesToOpen.map(resourceInput => this.editorService.createInput(resourceInput));
return TPromise.join<EditorInput>(filesToOpenInputPromise).then((inputsToOpen) => {
inputs.push(...inputsToOpen);
options.push(...filesToOpen.map(resourceInput => TextEditorOptions.from(resourceInput)));
options.push(...filesToOpen.map(resourceInput => {
const options: EditorOptions = TextEditorOptions.from(resourceInput) || EditorOptions.create({ pinned: true });
options.pinned = true;
return options;
}));
return inputs.map((input, index) => { return { input, options: options[index] }; });
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册