diff --git a/package.json b/package.json index 26e5d955e..d32336da2 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "autocomplete-plus": "2.35.1", "autocomplete-snippets": "1.11.0", "autoflow": "0.29.0", - "autosave": "0.24.1", + "autosave": "0.24.2", "background-tips": "0.27.0", "bookmarks": "0.44.3", "bracket-matcher": "0.85.5", @@ -103,7 +103,7 @@ "dev-live-reload": "0.47.1", "encoding-selector": "0.23.3", "exception-reporting": "0.41.3", - "find-and-replace": "0.207.3", + "find-and-replace": "0.207.4", "fuzzy-finder": "1.5.4", "git-diff": "1.3.5", "go-to-line": "0.32.0", @@ -124,7 +124,7 @@ "status-bar": "1.8.5", "styleguide": "0.49.6", "symbols-view": "0.115.5", - "tabs": "0.105.0", + "tabs": "0.105.1", "timecop": "0.36.0", "tree-view": "0.216.0", "update-package-dependencies": "0.11.0", diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 73eaf162c..5c02b8852 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -281,6 +281,18 @@ describe('Workspace', () => { }) }) + describe("when the 'activateItem' option is false", () => { + it('adds the item to the workspace', () => { + let editor + waitsForPromise(() => workspace.open('a')) + waitsForPromise(() => workspace.open('b', {activateItem: false}).then(o => { editor = o })) + runs(() => { + expect(workspace.getPaneItems()).toContain(editor) + expect(workspace.getActivePaneItem()).not.toBe(editor) + }) + }) + }) + describe('when the active pane does not have an editor for the given uri', () => { it('adds and activates a new editor for the given path on the active pane', () => { let editor = null diff --git a/src/workspace.js b/src/workspace.js index 7e7ddbe30..894d67b62 100644 --- a/src/workspace.js +++ b/src/workspace.js @@ -719,7 +719,9 @@ module.exports = class Workspace extends Model { this.itemOpened(item) - if (options.activateItem !== false) { + if (options.activateItem === false) { + pane.addItem(item, {pending: options.pending}) + } else { pane.activateItem(item, {pending: options.pending}) } @@ -841,6 +843,13 @@ module.exports = class Workspace extends Model { return this.open(uri, {pane}) } + // Public: Creates a new item that corresponds to the provided URI. + // + // If no URI is given, or no registered opener can open the URI, a new empty + // {TextEditor} will be created. + // + // * `uri` A {String} containing a URI. + // // Returns a {Promise} that resolves to the {TextEditor} (or other item) for the given URI. createItemForURI (uri, options) { if (uri != null) {