Remove 'split' option from Workspace::openSync

This commit is contained in:
Nathan Sobo 2014-01-21 14:05:59 -07:00
parent 726b546004
commit 933787f1a4
2 changed files with 8 additions and 42 deletions

View File

@ -49,23 +49,6 @@ describe "Workspace", ->
workspace.openSync('b', activatePane: false)
expect(activePane.activate).not.toHaveBeenCalled()
describe "when the 'split' option is specified", ->
it "activates the editor on the active pane if it has a sibling and otherwise creates a new pane", ->
pane1 = workspace.activePane
editor = workspace.openSync('a', split: 'right')
pane2 = workspace.activePane
expect(pane2).not.toBe pane1
expect(workspace.paneContainer.root.children).toEqual [pane1, pane2]
editor = workspace.openSync('file1', split: 'right')
expect(workspace.activePane).toBe pane2
expect(workspace.paneContainer.root.children).toEqual [pane1, pane2]
expect(pane1.items.length).toBe 0
expect(pane2.items.length).toBe 2
describe "::openSingletonSync(uri, options)", ->
describe "when an editor for the given uri is already open on the active pane", ->
it "activates the existing editor", ->

View File

@ -78,37 +78,20 @@ class Workspace extends Model
# Private: Only used in specs
openSync: (uri, options={}) ->
{initialLine, pane, split} = options
{initialLine} = options
# TODO: Remove deprecated changeFocus option
activatePane = options.activatePane ? options.changeFocus ? true
pane ?= @activePane
uri = atom.project.relativize(uri)
if pane
if uri
paneItem = pane.itemForUri(uri) ? atom.project.openSync(uri, {initialLine})
else
paneItem = atom.project.openSync()
if split == 'right'
panes = @getPanes()
if panes.length == 1
pane = panes[0].splitRight()
else
pane = last(panes)
else if split == 'left'
pane = @getPanes()[0]
pane.activateItem(paneItem)
if uri?
editor = @activePane.itemForUri(uri) ? atom.project.openSync(uri, {initialLine})
else
paneItem = atom.project.openSync(uri, {initialLine})
pane = new Pane(items: [paneItem])
@paneContainer.root = pane
editor = atom.project.openSync()
@itemOpened(paneItem)
pane.activate() if activatePane
paneItem
@activePane.activateItem(editor)
@itemOpened(editor)
@activePane.activate() if activatePane
editor
# Public: Synchronously open an editor for the given URI or activate an existing
# editor in any pane if one already exists.