Merge pull request #10846 from atom/ku-pending-tabs-option

Add core setting for pending tabs configuration
This commit is contained in:
Katrina Uychaco
2016-02-17 11:57:40 -08:00
parent e3f66c16ab
commit f0eb62ec73
3 changed files with 18 additions and 0 deletions

View File

@@ -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()

View File

@@ -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'

View File

@@ -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?