Addresses #26184 - use configuration for pinned default (#27357)

* Addresses #26184 - use configuration for pinned default

* Honors the preview editor setting above all

* Removes passing undefined to pinned internally
re: requested code review changes

* Removes unnecessary undefined

* feedback
This commit is contained in:
Eric Amodio
2017-07-06 08:12:39 +02:00
committed by Benjamin Pasero
parent b5cd8121f5
commit 4f50b29e92
5 changed files with 6 additions and 10 deletions
-1
View File
@@ -174,7 +174,6 @@ export class CommandCenter {
}
const opts: TextDocumentShowOptions = {
preview: true,
viewColumn
};
@@ -205,11 +205,10 @@ export class ExtHostApiCommands {
});
this._register('vscode.diff', (left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions) => {
let editorOptions: IEditorOptions;
if (options) {
editorOptions = {
pinned: !options.preview,
pinned: typeof options.preview === 'boolean' ? !options.preview : undefined,
preserveFocus: options.preserveFocus
};
}
@@ -63,20 +63,18 @@ export class ExtHostEditors extends ExtHostEditorsShape {
if (typeof columnOrOptions === 'number') {
options = {
position: TypeConverters.fromViewColumn(columnOrOptions),
preserveFocus: preserveFocus,
pinned: true
preserveFocus
};
} else if (typeof columnOrOptions === 'object') {
options = {
position: TypeConverters.fromViewColumn(columnOrOptions.viewColumn),
preserveFocus: columnOrOptions.preserveFocus,
pinned: columnOrOptions.preview === undefined ? true : !columnOrOptions.preview
pinned: typeof columnOrOptions.preview === 'boolean' ? !columnOrOptions.preview : undefined
};
} else {
options = {
position: EditorPosition.ONE,
preserveFocus: false,
pinned: true
preserveFocus: false
};
}
@@ -320,6 +320,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// stacks model gets updated if any of the UI updating fails with an error.
const group = this.ensureGroup(position, !options || !options.preserveFocus);
const pinned = !this.tabOptions.previewEditors || (options && (options.pinned || typeof options.index === 'number')) || input.isDirty();
const active = (group.count === 0) || !options || !options.inactive;
group.openEditor(input, { active, pinned, index: options && options.index });
@@ -399,8 +399,7 @@ export function registerCommands(): void {
if (!options || typeof options !== 'object') {
options = {
preserveFocus: false,
pinned: true
preserveFocus: false
};
}