From f0eb62ec73177887276f1022f26fb7e35d5aca75 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Wed, 17 Feb 2016 11:57:40 -0800 Subject: [PATCH] Merge pull request #10846 from atom/ku-pending-tabs-option Add core setting for pending tabs configuration --- spec/workspace-spec.coffee | 11 +++++++++++ src/config-schema.coffee | 4 ++++ src/workspace.coffee | 3 +++ 3 files changed, 18 insertions(+) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e89e4c6bd..534f2bf61 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -1532,3 +1532,14 @@ describe "Workspace", -> atom.workspace.closeActivePaneItemOrEmptyPaneOrWindow() expect(atom.close).toHaveBeenCalled() + + describe "when the core.allowPendingPaneItems option is falsey", -> + it "does not open item with `pending: true` option as pending", -> + editor = null + atom.config.set('core.allowPendingPaneItems', false) + + waitsForPromise -> + atom.workspace.open('sample.js', pending: true).then (o) -> editor = o + + runs -> + expect(editor.isPending()).toBeFalsy() diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 88e00c71d..c8d9a2f2b 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -108,6 +108,10 @@ module.exports = description: 'Automatically update Atom when a new release is available.' type: 'boolean' default: true + allowPendingPaneItems: + description: 'Allow items to be previewed without adding them to a pane permanently, such as when single clicking files in the tree view.' + type: 'boolean' + default: true editor: type: 'object' diff --git a/src/workspace.coffee b/src/workspace.coffee index ebaf1b337..848560965 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -414,6 +414,9 @@ class Workspace extends Model split = options.split uri = @project.resolvePath(uri) + if not atom.config.get('core.allowPendingPaneItems') + options.pending = false + # Avoid adding URLs as recent documents to work-around this Spotlight crash: # https://github.com/atom/atom/issues/10071 if uri? and not url.parse(uri).protocol?