From 63a80a4d4da2423ba07242360b45ecf3e40d3349 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 8 Apr 2014 10:52:19 -0700 Subject: [PATCH 01/54] Revert "Revert "Merge pull request #1844 from atom/cj-move-functionality-to-workspace"" This reverts commit 87d008c3370ad326e9f7dbcabab5021f97d4bbe6. --- spec/project-spec.coffee | 64 +++++++------------------------------- spec/workspace-spec.coffee | 39 ++++++++++++++++++++++- src/editor.coffee | 6 ++-- src/project.coffee | 23 +++----------- src/workspace.coffee | 28 ++++++++++++----- 5 files changed, 78 insertions(+), 82 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 0a65cc712..0abd31d05 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -33,21 +33,7 @@ describe "Project", -> deserializedProject.getBuffers()[0].destroy() expect(deserializedProject.getBuffers().length).toBe 0 - describe "when an edit session is destroyed", -> - it "removes edit session and calls destroy on buffer (if buffer is not referenced by other edit sessions)", -> - editor = atom.project.openSync("a") - anotherEditor = atom.project.openSync("a") - - expect(atom.project.editors.length).toBe 2 - expect(editor.buffer).toBe anotherEditor.buffer - - editor.destroy() - expect(atom.project.editors.length).toBe 1 - - anotherEditor.destroy() - expect(atom.project.editors.length).toBe 0 - - describe "when an edit session is saved and the project has no path", -> + describe "when an editor is saved and the project has no path", -> it "sets the project's path to the saved file's parent directory", -> tempFile = temp.openSync().path atom.project.setPath(undefined) @@ -56,73 +42,49 @@ describe "Project", -> editor.saveAs(tempFile) expect(atom.project.getPath()).toBe path.dirname(tempFile) - describe "when an edit session is copied", -> - it "emits an 'editor-created' event and stores the edit session", -> - handler = jasmine.createSpy('editorCreatedHandler') - atom.project.on 'editor-created', handler - - editor1 = atom.project.openSync("a") - expect(handler.callCount).toBe 1 - expect(atom.project.getEditors().length).toBe 1 - expect(atom.project.getEditors()[0]).toBe editor1 - - editor2 = editor1.copy() - expect(handler.callCount).toBe 2 - expect(atom.project.getEditors().length).toBe 2 - expect(atom.project.getEditors()[0]).toBe editor1 - expect(atom.project.getEditors()[1]).toBe editor2 - describe ".openSync(path)", -> - [absolutePath, newBufferHandler, newEditorHandler] = [] + [absolutePath, newBufferHandler] = [] beforeEach -> absolutePath = require.resolve('./fixtures/dir/a') newBufferHandler = jasmine.createSpy('newBufferHandler') atom.project.on 'buffer-created', newBufferHandler - newEditorHandler = jasmine.createSpy('newEditorHandler') - atom.project.on 'editor-created', newEditorHandler describe "when given an absolute path that hasn't been opened previously", -> - it "returns a new edit session for the given path and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session for the given path and emits 'buffer-created'", -> editor = atom.project.openSync(absolutePath) expect(editor.buffer.getPath()).toBe absolutePath expect(newBufferHandler).toHaveBeenCalledWith editor.buffer - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when given a relative path that hasn't been opened previously", -> - it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created'", -> editor = atom.project.openSync('a') expect(editor.buffer.getPath()).toBe absolutePath expect(newBufferHandler).toHaveBeenCalledWith editor.buffer - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when passed the path to a buffer that has already been opened", -> - it "returns a new edit session containing previously opened buffer and emits a 'editor-created' event", -> + it "returns a new edit session containing previously opened buffer", -> editor = atom.project.openSync(absolutePath) newBufferHandler.reset() expect(atom.project.openSync(absolutePath).buffer).toBe editor.buffer expect(atom.project.openSync('a').buffer).toBe editor.buffer expect(newBufferHandler).not.toHaveBeenCalled() - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when not passed a path", -> - it "returns a new edit session and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session and emits 'buffer-created'", -> editor = atom.project.openSync() expect(editor.buffer.getPath()).toBeUndefined() expect(newBufferHandler).toHaveBeenCalledWith(editor.buffer) - expect(newEditorHandler).toHaveBeenCalledWith editor describe ".open(path)", -> - [absolutePath, newBufferHandler, newEditorHandler] = [] + [absolutePath, newBufferHandler] = [] beforeEach -> absolutePath = require.resolve('./fixtures/dir/a') newBufferHandler = jasmine.createSpy('newBufferHandler') atom.project.on 'buffer-created', newBufferHandler - newEditorHandler = jasmine.createSpy('newEditorHandler') - atom.project.on 'editor-created', newEditorHandler describe "when given an absolute path that isn't currently open", -> - it "returns a new edit session for the given path and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session for the given path and emits 'buffer-created'", -> editor = null waitsForPromise -> atom.project.open(absolutePath).then (o) -> editor = o @@ -130,10 +92,9 @@ describe "Project", -> runs -> expect(editor.buffer.getPath()).toBe absolutePath expect(newBufferHandler).toHaveBeenCalledWith editor.buffer - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when given a relative path that isn't currently opened", -> - it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created'", -> editor = null waitsForPromise -> atom.project.open(absolutePath).then (o) -> editor = o @@ -141,10 +102,9 @@ describe "Project", -> runs -> expect(editor.buffer.getPath()).toBe absolutePath expect(newBufferHandler).toHaveBeenCalledWith editor.buffer - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when passed the path to a buffer that is currently opened", -> - it "returns a new edit session containing currently opened buffer and emits a 'editor-created' event", -> + it "returns a new edit session containing currently opened buffer", -> editor = null waitsForPromise -> atom.project.open(absolutePath).then (o) -> editor = o @@ -154,10 +114,9 @@ describe "Project", -> expect(atom.project.openSync(absolutePath).buffer).toBe editor.buffer expect(atom.project.openSync('a').buffer).toBe editor.buffer expect(newBufferHandler).not.toHaveBeenCalled() - expect(newEditorHandler).toHaveBeenCalledWith editor describe "when not passed a path", -> - it "returns a new edit session and emits 'buffer-created' and 'editor-created' events", -> + it "returns a new edit session and emits 'buffer-created'", -> editor = null waitsForPromise -> atom.project.open().then (o) -> editor = o @@ -165,7 +124,6 @@ describe "Project", -> runs -> expect(editor.buffer.getPath()).toBeUndefined() expect(newBufferHandler).toHaveBeenCalledWith(editor.buffer) - expect(newEditorHandler).toHaveBeenCalledWith editor it "returns number of read bytes as progress indicator", -> filePath = atom.project.resolve 'a' diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index ffc1667c3..53f034e8d 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -5,7 +5,7 @@ describe "Workspace", -> beforeEach -> atom.project.setPath(atom.project.resolve('dir')) - workspace = new Workspace + atom.workspace = workspace = new Workspace describe "::open(uri, options)", -> beforeEach -> @@ -152,6 +152,18 @@ describe "Workspace", -> workspace.open("bar://baz").then (item) -> expect(item).toEqual { bar: "bar://baz" } + it "emits an 'editor-created' event", -> + absolutePath = require.resolve('./fixtures/dir/a') + newEditorHandler = jasmine.createSpy('newEditorHandler') + workspace.on 'editor-created', newEditorHandler + + editor = null + waitsForPromise -> + workspace.open(absolutePath).then (e) -> editor = e + + runs -> + expect(newEditorHandler).toHaveBeenCalledWith editor + describe "::openSync(uri, options)", -> [activePane, initialItemCount] = [] @@ -245,3 +257,28 @@ describe "Workspace", -> it "opens the license as plain-text in a buffer", -> waitsForPromise -> workspace.openLicense() runs -> expect(workspace.activePaneItem.getText()).toMatch /Copyright/ + + describe "when an editor is destroyed", -> + it "removes the editor", -> + editor = null + + waitsForPromise -> + workspace.open("a").then (e) -> editor = e + + runs -> + expect(workspace.getEditors()).toHaveLength 1 + editor.destroy() + expect(workspace.getEditors()).toHaveLength 0 + + describe "when an editor is copied", -> + it "emits an 'editor-created' event and stores the editor", -> + handler = jasmine.createSpy('editorCreatedHandler') + workspace.on 'editor-created', handler + + editor1 = workspace.openSync("a") + expect(handler.callCount).toBe 1 + expect(workspace.getEditors()).toEqual [editor1] + + editor2 = editor1.copy() + expect(handler.callCount).toBe 2 + expect(workspace.getEditors()).toEqual [editor1, editor2] diff --git a/src/editor.coffee b/src/editor.coffee index 825c9c400..37e41f8e6 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -182,7 +182,7 @@ class Editor extends Model @subscribe @$scrollTop, (scrollTop) => @emit 'scroll-top-changed', scrollTop @subscribe @$scrollLeft, (scrollLeft) => @emit 'scroll-left-changed', scrollLeft - atom.project.addEditor(this) if registerEditor + atom.workspace.addEditor(this) if registerEditor serializeParams: -> id: @id @@ -225,7 +225,7 @@ class Editor extends Model @buffer.release() @displayBuffer.destroy() @languageMode.destroy() - atom.project?.removeEditor(this) + atom.workspace?.removeEditor(this) # Create an {Editor} with its initial state based on this object copy: -> @@ -237,7 +237,7 @@ class Editor extends Model newEditor.setScrollLeft(@getScrollLeft()) for marker in @findMarkers(editorId: @id) marker.copy(editorId: newEditor.id, preserveFolds: true) - atom.project.addEditor(newEditor) + atom.workspace.addEditor(newEditor) newEditor # Public: Get the title the editor's title for display in other parts of the diff --git a/src/project.coffee b/src/project.coffee index 81f7eaa8c..635d9bc0d 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -31,13 +31,11 @@ class Project extends Model constructor: ({path, @buffers}={}) -> @buffers ?= [] - @openers = [] for buffer in @buffers do (buffer) => buffer.once 'destroyed', => @removeBuffer(buffer) - @editors = [] @setPath(path) serializeParams: -> @@ -49,7 +47,6 @@ class Project extends Model params destroyed: -> - editor.destroy() for editor in @getEditors() buffer.destroy() for buffer in @getBuffers() @destroyRepo() @@ -132,15 +129,6 @@ class Project extends Model filePath = @resolve(filePath) @buildEditorForBuffer(@bufferForPathSync(filePath), options) - # Add the given {Editor}. - addEditor: (editor) -> - @editors.push editor - @emit 'editor-created', editor - - # Return and removes the given {Editor}. - removeEditor: (editor) -> - _.remove(@editors, editor) - # Retrieves all the {TextBuffer}s in the project; that is, the # buffers for all open files. # @@ -305,7 +293,7 @@ class Project extends Model buildEditorForBuffer: (buffer, editorOptions) -> editor = new Editor(_.extend({buffer}, editorOptions)) - @addEditor(editor) + atom.workspace.addEditor(editor) editor eachBuffer: (args...) -> @@ -321,20 +309,19 @@ class Project extends Model # Deprecated: delegate registerOpener: (opener) -> deprecate("Use Workspace::registerOpener instead") - @openers.push(opener) + atom.workspace.registerOpener(opener) # Deprecated: delegate unregisterOpener: (opener) -> deprecate("Use Workspace::unregisterOpener instead") - _.remove(@openers, opener) + atom.workspace.unregisterOpener(opener) # Deprecated: delegate eachEditor: (callback) -> deprecate("Use Workspace::eachEditor instead") - callback(editor) for editor in @getEditors() - @on 'editor-created', (editor) -> callback(editor) + atom.workspace.eachEditor(callback) # Deprecated: delegate getEditors: -> deprecate("Use Workspace::getEditors instead") - new Array(@editors...) + atom.workspace.getEditors() diff --git a/src/workspace.coffee b/src/workspace.coffee index 18b253e1b..db53ea152 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -1,5 +1,5 @@ {deprecate} = require 'grim' -{remove, last} = require 'underscore-plus' +_ = require 'underscore-plus' {join} = require 'path' {Model} = require 'theorist' Q = require 'q' @@ -28,6 +28,10 @@ class Workspace extends Model constructor: -> super + + @openers = [] + @editors = [] + @subscribe @paneContainer, 'item-destroyed', @onPaneItemDestroyed @registerOpener (filePath) => switch filePath @@ -50,6 +54,14 @@ class Workspace extends Model paneContainer: @paneContainer.serialize() fullScreen: atom.isFullScreen() + addEditor: (editor) -> + @editors.push editor + @emit 'editor-created', editor + editor + + removeEditor: (editor) -> + _.remove(@editors, editor) + # Public: Register a function to be called for every current and future # {Editor} in the workspace. # @@ -58,13 +70,14 @@ class Workspace extends Model # Returns a subscription object with an `.off` method that you can call to # unregister the callback. eachEditor: (callback) -> - atom.project.eachEditor(callback) + callback(editor) for editor in @getEditors() + @subscribe this, 'editor-created', (editor) -> callback(editor) # Public: Get all current editors in the workspace. # # Returns an {Array} of {Editor}s. getEditors: -> - atom.project.getEditors() + _.clone(@editors) # Public: Open a given a URI in Atom asynchronously. # @@ -172,14 +185,14 @@ class Workspace extends Model # # opener - A {Function} to be called when a path is being opened. registerOpener: (opener) -> - atom.project.registerOpener(opener) + @openers.push(opener) # Public: Unregister an opener registered with {::registerOpener}. unregisterOpener: (opener) -> - atom.project.unregisterOpener(opener) + _.remove(@openers, opener) getOpeners: -> - atom.project.openers + @openers # Public: Get the active {Pane}. # @@ -262,7 +275,7 @@ class Workspace extends Model # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) -> if uri = item.getUri?() - remove(@destroyedItemUris, uri) + _.remove(@destroyedItemUris, uri) # Adds the destroyed item's uri to the list of items to reopen. onPaneItemDestroyed: (item) => @@ -271,4 +284,5 @@ class Workspace extends Model # Called by Model superclass when destroyed destroyed: -> + editor.destroy() for editor in @getEditors() @paneContainer.destroy() From fe0d71471076d5f42f63f63f21fe67c3c52e193e Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 11 Apr 2014 10:51:56 -0700 Subject: [PATCH 02/54] Fix inconsistent indentation --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index 635d9bc0d..01cd1dfbb 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -141,7 +141,7 @@ class Project extends Model @findBufferForPath(@resolve(filePath))?.isModified() findBufferForPath: (filePath) -> - _.find @buffers, (buffer) -> buffer.getPath() == filePath + _.find @buffers, (buffer) -> buffer.getPath() == filePath # Only to be used in specs bufferForPathSync: (filePath) -> From e56fa3ec4fd202805cdaba428c35131e288f7cec Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 11 Apr 2014 11:10:00 -0700 Subject: [PATCH 03/54] Use PaneContainer to keep the state of open editors --- src/editor.coffee | 6 ++---- src/project.coffee | 3 +-- src/workspace.coffee | 16 +++++++--------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 37e41f8e6..4c8e355f4 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -182,7 +182,7 @@ class Editor extends Model @subscribe @$scrollTop, (scrollTop) => @emit 'scroll-top-changed', scrollTop @subscribe @$scrollLeft, (scrollLeft) => @emit 'scroll-left-changed', scrollLeft - atom.workspace.addEditor(this) if registerEditor + atom.workspace.editorAdded(this) if registerEditor serializeParams: -> id: @id @@ -225,19 +225,17 @@ class Editor extends Model @buffer.release() @displayBuffer.destroy() @languageMode.destroy() - atom.workspace?.removeEditor(this) # Create an {Editor} with its initial state based on this object copy: -> tabLength = @getTabLength() displayBuffer = @displayBuffer.copy() softTabs = @getSoftTabs() - newEditor = new Editor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true}) + newEditor = new Editor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true, registerEditor: true}) newEditor.setScrollTop(@getScrollTop()) newEditor.setScrollLeft(@getScrollLeft()) for marker in @findMarkers(editorId: @id) marker.copy(editorId: newEditor.id, preserveFolds: true) - atom.workspace.addEditor(newEditor) newEditor # Public: Get the title the editor's title for display in other parts of the diff --git a/src/project.coffee b/src/project.coffee index 01cd1dfbb..f3acf0b1a 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -292,8 +292,7 @@ class Project extends Model deferred.promise buildEditorForBuffer: (buffer, editorOptions) -> - editor = new Editor(_.extend({buffer}, editorOptions)) - atom.workspace.addEditor(editor) + editor = new Editor(_.extend({buffer, registerEditor: true}, editorOptions)) editor eachBuffer: (args...) -> diff --git a/src/workspace.coffee b/src/workspace.coffee index db53ea152..1bf80678e 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -5,6 +5,7 @@ _ = require 'underscore-plus' Q = require 'q' Serializable = require 'serializable' Delegator = require 'delegato' +Editor = require './editor' PaneContainer = require './pane-container' Pane = require './pane' @@ -30,7 +31,6 @@ class Workspace extends Model super @openers = [] - @editors = [] @subscribe @paneContainer, 'item-destroyed', @onPaneItemDestroyed @registerOpener (filePath) => @@ -54,13 +54,8 @@ class Workspace extends Model paneContainer: @paneContainer.serialize() fullScreen: atom.isFullScreen() - addEditor: (editor) -> - @editors.push editor + editorAdded: (editor) -> @emit 'editor-created', editor - editor - - removeEditor: (editor) -> - _.remove(@editors, editor) # Public: Register a function to be called for every current and future # {Editor} in the workspace. @@ -77,7 +72,11 @@ class Workspace extends Model # # Returns an {Array} of {Editor}s. getEditors: -> - _.clone(@editors) + editors = [] + for pane in @paneContainer.getPanes() + editors.push(item) for item in pane.getItems() when item instanceof Editor + + editors # Public: Open a given a URI in Atom asynchronously. # @@ -284,5 +283,4 @@ class Workspace extends Model # Called by Model superclass when destroyed destroyed: -> - editor.destroy() for editor in @getEditors() @paneContainer.destroy() From 6dfbd5733de67e2da051576fcce7c6cab8690de9 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 11 Apr 2014 11:14:46 -0700 Subject: [PATCH 04/54] Fix spec --- spec/workspace-spec.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 53f034e8d..538907c02 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -271,14 +271,12 @@ describe "Workspace", -> expect(workspace.getEditors()).toHaveLength 0 describe "when an editor is copied", -> - it "emits an 'editor-created' event and stores the editor", -> + it "emits an 'editor-created' event", -> handler = jasmine.createSpy('editorCreatedHandler') workspace.on 'editor-created', handler editor1 = workspace.openSync("a") expect(handler.callCount).toBe 1 - expect(workspace.getEditors()).toEqual [editor1] editor2 = editor1.copy() expect(handler.callCount).toBe 2 - expect(workspace.getEditors()).toEqual [editor1, editor2] From 54b60a52534751a39e696b0087319a4f59d1148d Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 14 Apr 2014 08:48:58 -0700 Subject: [PATCH 05/54] Don't assume atom.workspace is always defined --- src/editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index 4c8e355f4..3cc087c8e 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -182,7 +182,7 @@ class Editor extends Model @subscribe @$scrollTop, (scrollTop) => @emit 'scroll-top-changed', scrollTop @subscribe @$scrollLeft, (scrollLeft) => @emit 'scroll-left-changed', scrollLeft - atom.workspace.editorAdded(this) if registerEditor + atom.workspace?.editorAdded(this) if registerEditor serializeParams: -> id: @id From 51631669908fc3ce93987069828e49723150bfd1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 09:00:08 -0700 Subject: [PATCH 06/54] Upgrade to fuzzy-finder@0.48.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index edb1cc43d..25a40147b 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "exception-reporting": "0.17.0", "feedback": "0.29.0", "find-and-replace": "0.97.0", - "fuzzy-finder": "0.47.0", + "fuzzy-finder": "0.48.0", "git-diff": "0.28.0", "go-to-line": "0.19.0", "grammar-selector": "0.24.0", From fd48ad1c671c8b1821e6b4dce4b5c5e1f3275f6e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 09:04:03 -0700 Subject: [PATCH 07/54] Upgrade to language-todo@0.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25a40147b..d903a6345 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "language-source": "0.7.0", "language-sql": "0.8.0", "language-text": "0.6.0", - "language-todo": "0.9.0", + "language-todo": "0.10.0", "language-toml": "0.12.0", "language-xml": "0.11.0", "language-yaml": "0.6.0" From 6e6c93e6bb699be9a1482c4c4056587f614308b3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 09:16:42 -0700 Subject: [PATCH 08/54] Upgrade to markdown-preview@0.62.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d903a6345..0b438bab2 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "image-view": "0.32.0", "keybinding-resolver": "0.17.0", "link": "0.21.0", - "markdown-preview": "0.61.0", + "markdown-preview": "0.62.0", "metrics": "0.32.0", "open-on-github": "0.28.0", "package-generator": "0.30.0", From 5fc65244937b2b089b24e8ad74d1ca374f68c90a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 09:34:54 -0700 Subject: [PATCH 09/54] Upgrade to link@0.22.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b438bab2..10d3cd6dc 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "grammar-selector": "0.24.0", "image-view": "0.32.0", "keybinding-resolver": "0.17.0", - "link": "0.21.0", + "link": "0.22.0", "markdown-preview": "0.62.0", "metrics": "0.32.0", "open-on-github": "0.28.0", From 3d8bc89c42ceb50b94d7698f8ee5501a49e50753 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Apr 2014 00:39:10 +0800 Subject: [PATCH 10/54] Upgrade to atom-shell@0.11.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 10d3cd6dc..ad2acb94a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/atom/atom/issues" }, "license": "All Rights Reserved", - "atomShellVersion": "0.11.9", + "atomShellVersion": "0.11.10", "dependencies": { "async": "0.2.6", "atom-keymap": "^0.17.0", From e174bdfa409187e5a7988fda2ac157b7b3639f15 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 10:26:53 -0700 Subject: [PATCH 11/54] Upgrade to language-ruby@0.22.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad2acb94a..a52d53a55 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "language-php": "0.14.0", "language-property-list": "0.7.0", "language-python": "0.15.0", - "language-ruby": "0.21.0", + "language-ruby": "0.22.0", "language-ruby-on-rails": "0.12.0", "language-sass": "0.8.0", "language-shellscript": "0.8.0", From 1245835e968523679611b7d532dd12799ad325c7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Apr 2014 11:10:45 -0700 Subject: [PATCH 12/54] Upgrade to fuzzy-finder@0.49.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a52d53a55..1bb1386de 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "exception-reporting": "0.17.0", "feedback": "0.29.0", "find-and-replace": "0.97.0", - "fuzzy-finder": "0.48.0", + "fuzzy-finder": "0.49.0", "git-diff": "0.28.0", "go-to-line": "0.19.0", "grammar-selector": "0.24.0", From ac2f723aba54357c3ad9d2b951b58ee6e1e962eb Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 13:13:53 -0700 Subject: [PATCH 13/54] Use PaneContainerViews::getPaneViews --- src/workspace-view.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 52803a8ef..1dde00d0f 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -316,7 +316,7 @@ class WorkspaceView extends View # # Returns an Array of all open {PaneView}s. getPaneViews: -> - @panes.getPanes() + @panes.getPaneViews() # Public: Register a function to be called for every current and future # editor view in the workspace. From e6040972d80a92ec5899e2e2e3a4946d2ecc4d22 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 14:03:46 -0700 Subject: [PATCH 14/54] Update multiple packages. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1bb1386de..1d8a88f3b 100644 --- a/package.json +++ b/package.json @@ -67,15 +67,15 @@ "autocomplete": "0.27.0", "autoflow": "0.16.0", "autosave": "0.13.0", - "background-tips": "0.10.0", + "background-tips": "0.11.0", "bookmarks": "0.22.0", - "bracket-matcher": "0.30.0", + "bracket-matcher": "0.31.0", "command-palette": "0.20.0", "dev-live-reload": "0.30.0", "exception-reporting": "0.17.0", "feedback": "0.29.0", "find-and-replace": "0.97.0", - "fuzzy-finder": "0.49.0", + "fuzzy-finder": "0.50.0", "git-diff": "0.28.0", "go-to-line": "0.19.0", "grammar-selector": "0.24.0", @@ -93,7 +93,7 @@ "status-bar": "0.39.0", "styleguide": "0.28.0", "symbols-view": "0.49.0", - "tabs": "0.34.0", + "tabs": "0.35.0", "timecop": "0.17.0", "tree-view": "0.89.0", "update-package-dependencies": "0.6.0", From 7c00e02b1a3b635240ee833f565757e0c59f420e Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 14:04:20 -0700 Subject: [PATCH 15/54] Deprecate PaneContainerView::getActivePane Use PaneContainerView::getActivePaneView instead. --- src/pane-container-view.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pane-container-view.coffee b/src/pane-container-view.coffee index 1421b1283..1849441a2 100644 --- a/src/pane-container-view.coffee +++ b/src/pane-container-view.coffee @@ -81,6 +81,10 @@ class PaneContainerView extends View @find('.pane:has(:focus)').view() getActivePane: -> + deprecate("Use PaneContainerView::getActivePaneView instead.") + @getActivePaneView() + + getActivePaneView: -> @viewForModel(@model.activePane) getActivePaneItem: -> From ad0ed7e6345964ea7a98d9733ba4b41dd4b443a8 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 14:04:35 -0700 Subject: [PATCH 16/54] Don't use of deprecated methods internally --- src/workspace-view.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 1dde00d0f..b6e0990d6 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -151,7 +151,7 @@ class WorkspaceView extends View @command 'pane:reopen-closed-item', => @reopenItemSync() - @command 'core:close', => if @getActivePaneItem()? then @destroyActivePaneItem() else @destroyActivePane() + @command 'core:close', => if @getModel().getActivePane().getActiveItem()? then @destroyActivePaneItem() else @destroyActivePane() @command 'core:save', => @saveActivePaneItem() @command 'core:save-as', => @saveActivePaneItemAs() @@ -182,8 +182,8 @@ class WorkspaceView extends View detailedMessage: "The shell commands `atom` and `apm` are installed." handleFocus: -> - if @getActivePane() - @getActivePane().focus() + if @getActivePaneView() + @getActivePaneView().focus() false else @updateTitle() @@ -205,7 +205,7 @@ class WorkspaceView extends View # Updates the application's title, based on whichever file is open. updateTitle: -> if projectPath = atom.project.getPath() - if item = @getActivePaneItem() + if item = @getModel().getActivePane().getActiveItem() @setTitle("#{item.getTitle?() ? 'untitled'} - #{projectPath}") else @setTitle(projectPath) @@ -272,7 +272,7 @@ class WorkspaceView extends View # # Returns a {PaneView}. getActivePaneView: -> - @panes.getActivePane() + @panes.getActivePaneView() # Public: Get the view associated with the active pane item. # From 411cf579f42528b57eb7899432eafc1f8bc536e6 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 14:21:25 -0700 Subject: [PATCH 17/54] Add Workspace::getActivePaneItem --- src/workspace.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/workspace.coffee b/src/workspace.coffee index 1bf80678e..cc29853b0 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -223,6 +223,12 @@ class Workspace extends Model paneForUri: (uri) -> @paneContainer.paneForUri(uri) + # Public: Get the active {Pane}'s active item. + # + # Returns an pane item {Object}. + getActivePaneItem: -> + @paneContainer.getActivePane().getActiveItem() + # Public: Save the active pane item. # # If the active pane item currently has a URI according to the item's From d6ec73886f7167399f6d3f2391cfdbece44e6283 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 14:55:28 -0700 Subject: [PATCH 18/54] Add PaneContainer::getActivePane --- src/pane-container.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pane-container.coffee b/src/pane-container.coffee index a02afed9e..535e55607 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -39,6 +39,9 @@ class PaneContainer extends Model getPanes: -> @root?.getPanes() ? [] + getActivePane: -> + @activePane + paneForUri: (uri) -> find @getPanes(), (pane) -> pane.itemForUri(uri)? From 5824b127edda8a37f3a379f7b4ecb8ff14ad8ca5 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 15:23:25 -0700 Subject: [PATCH 19/54] Update multiple packages --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1d8a88f3b..46c63e0a4 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "autocomplete": "0.27.0", "autoflow": "0.16.0", "autosave": "0.13.0", - "background-tips": "0.11.0", + "background-tips": "0.12.0", "bookmarks": "0.22.0", "bracket-matcher": "0.31.0", "command-palette": "0.20.0", @@ -79,23 +79,23 @@ "git-diff": "0.28.0", "go-to-line": "0.19.0", "grammar-selector": "0.24.0", - "image-view": "0.32.0", + "image-view": "0.33.0", "keybinding-resolver": "0.17.0", "link": "0.22.0", "markdown-preview": "0.62.0", "metrics": "0.32.0", "open-on-github": "0.28.0", "package-generator": "0.30.0", - "release-notes": "0.26.0", - "settings-view": "0.107.0", - "snippets": "0.40.0", + "release-notes": "0.27.0", + "settings-view": "0.108.0", + "snippets": "0.41.0", "spell-check": "0.33.0", - "status-bar": "0.39.0", - "styleguide": "0.28.0", + "status-bar": "0.40.0", + "styleguide": "0.29.0", "symbols-view": "0.49.0", - "tabs": "0.35.0", - "timecop": "0.17.0", - "tree-view": "0.89.0", + "tabs": "0.36.0", + "timecop": "0.18.0", + "tree-view": "0.90.0", "update-package-dependencies": "0.6.0", "welcome": "0.12.0", "whitespace": "0.22.0", From 8988d55d25d4812a8de5361f2f0c1f2c76a82175 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 15:27:24 -0700 Subject: [PATCH 20/54] Upgrade to find-and-replace@0.98.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46c63e0a4..351b2689c 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "dev-live-reload": "0.30.0", "exception-reporting": "0.17.0", "feedback": "0.29.0", - "find-and-replace": "0.97.0", + "find-and-replace": "0.98.0", "fuzzy-finder": "0.50.0", "git-diff": "0.28.0", "go-to-line": "0.19.0", From b4c8cb4bf95628dc325d516a1cc2742cfefef04f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 15:31:56 -0700 Subject: [PATCH 21/54] Use Workspace::getActivePaneItem --- src/workspace-view.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index b6e0990d6..c4bcaad36 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -151,7 +151,7 @@ class WorkspaceView extends View @command 'pane:reopen-closed-item', => @reopenItemSync() - @command 'core:close', => if @getModel().getActivePane().getActiveItem()? then @destroyActivePaneItem() else @destroyActivePane() + @command 'core:close', => if @getModel().getActivePaneItem()? then @destroyActivePaneItem() else @destroyActivePane() @command 'core:save', => @saveActivePaneItem() @command 'core:save-as', => @saveActivePaneItemAs() @@ -205,7 +205,7 @@ class WorkspaceView extends View # Updates the application's title, based on whichever file is open. updateTitle: -> if projectPath = atom.project.getPath() - if item = @getModel().getActivePane().getActiveItem() + if item = @getModel().getActivePaneItem() @setTitle("#{item.getTitle?() ? 'untitled'} - #{projectPath}") else @setTitle(projectPath) From aed0c16acc6d39485f68567d255f923a34febcd3 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 16:16:01 -0700 Subject: [PATCH 22/54] Remove github auth token methods --- package.json | 1 - src/atom.coffee | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/package.json b/package.json index 1bb1386de..311b31c71 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "grim": "0.6.0", "guid": "0.0.10", "jasmine-tagged": "^1.1.1", - "keytar": "1.x", "less-cache": "0.12.0", "mixto": "1.x", "mkdirp": "0.3.5", diff --git a/src/atom.coffee b/src/atom.coffee index 59c3d1578..6a096a22f 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -1,6 +1,5 @@ crypto = require 'crypto' ipc = require 'ipc' -keytar = require 'keytar' os = require 'os' path = require 'path' remote = require 'remote' @@ -484,17 +483,6 @@ class Atom extends Model isReleasedVersion: -> @constructor.isReleasedVersion() - getGitHubAuthTokenName: -> - 'Atom GitHub API Token' - - # Public: Set the the github token in the keychain - setGitHubAuthToken: (token) -> - keytar.replacePassword(@getGitHubAuthTokenName(), 'github', token) - - # Public: Get the github token from the keychain - getGitHubAuthToken: -> - keytar.getPassword(@getGitHubAuthTokenName(), 'github') - # Public: Get the directory path to Atom's configuration area. # # Returns the absolute path to ~/.atom From 33557b87eb3fcc48a0e62751c7169c505451875b Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 15 Apr 2014 16:26:21 -0700 Subject: [PATCH 23/54] Upgrade to feedback@0.30.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 311b31c71..a148b6105 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "command-palette": "0.20.0", "dev-live-reload": "0.30.0", "exception-reporting": "0.17.0", - "feedback": "0.29.0", + "feedback": "0.30.0", "find-and-replace": "0.97.0", "fuzzy-finder": "0.49.0", "git-diff": "0.28.0", From a61dff6e219f2e1b82d9142dbf60669a980c38cb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 15 Apr 2014 18:46:02 -0600 Subject: [PATCH 24/54] :non-potable_water: Unsubscribe from Editor when EditorView is removed This replaces calls to `@editor.on` with `@subscribe @editor`. That causes us to correctly unsubscribe when the editor is removed, avoiding a memory leak. --- src/editor-view.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/editor-view.coffee b/src/editor-view.coffee index b07eb3424..8fc28392c 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -535,34 +535,34 @@ class EditorView extends View @editor.setVisible(true) - @editor.on "destroyed", => + @subscribe @editor, "destroyed", => @remove() - @editor.on "contents-conflicted.editor", => + @subscribe @editor, "contents-conflicted.editor", => @showBufferConflictAlert(@editor) - @editor.on "path-changed.editor", => + @subscribe @editor, "path-changed.editor", => @editor.reloadGrammar() @trigger 'editor:path-changed' - @editor.on "grammar-changed.editor", => + @subscribe @editor, "grammar-changed.editor", => @trigger 'editor:grammar-changed' - @editor.on 'selection-added.editor', (selection) => + @subscribe @editor, 'selection-added.editor', (selection) => @newCursors.push(selection.cursor) @newSelections.push(selection) @requestDisplayUpdate() - @editor.on 'screen-lines-changed.editor', (e) => + @subscribe @editor, 'screen-lines-changed.editor', (e) => @handleScreenLinesChange(e) - @editor.on 'scroll-top-changed.editor', (scrollTop) => + @subscribe @editor, 'scroll-top-changed.editor', (scrollTop) => @scrollTop(scrollTop) - @editor.on 'scroll-left-changed.editor', (scrollLeft) => + @subscribe @editor, 'scroll-left-changed.editor', (scrollLeft) => @scrollLeft(scrollLeft) - @editor.on 'soft-wrap-changed.editor', (softWrap) => + @subscribe @editor, 'soft-wrap-changed.editor', (softWrap) => @setSoftWrap(softWrap) @trigger 'editor:path-changed' From d554b7fd03114f24deb28b387eece33b175fc1c4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 15 Apr 2014 18:50:36 -0600 Subject: [PATCH 25/54] Remove scopes from event names in subscriptions --- src/editor-view.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 8fc28392c..1dd776c65 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -538,31 +538,31 @@ class EditorView extends View @subscribe @editor, "destroyed", => @remove() - @subscribe @editor, "contents-conflicted.editor", => + @subscribe @editor, "contents-conflicted", => @showBufferConflictAlert(@editor) - @subscribe @editor, "path-changed.editor", => + @subscribe @editor, "path-changed", => @editor.reloadGrammar() @trigger 'editor:path-changed' - @subscribe @editor, "grammar-changed.editor", => + @subscribe @editor, "grammar-changed", => @trigger 'editor:grammar-changed' - @subscribe @editor, 'selection-added.editor', (selection) => + @subscribe @editor, 'selection-added', (selection) => @newCursors.push(selection.cursor) @newSelections.push(selection) @requestDisplayUpdate() - @subscribe @editor, 'screen-lines-changed.editor', (e) => + @subscribe @editor, 'screen-lines-changed', (e) => @handleScreenLinesChange(e) - @subscribe @editor, 'scroll-top-changed.editor', (scrollTop) => + @subscribe @editor, 'scroll-top-changed', (scrollTop) => @scrollTop(scrollTop) - @subscribe @editor, 'scroll-left-changed.editor', (scrollLeft) => + @subscribe @editor, 'scroll-left-changed', (scrollLeft) => @scrollLeft(scrollLeft) - @subscribe @editor, 'soft-wrap-changed.editor', (softWrap) => + @subscribe @editor, 'soft-wrap-changed', (softWrap) => @setSoftWrap(softWrap) @trigger 'editor:path-changed' From 34f624c89531fb46297fb6371d04fd5035dc8fef Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 15 Apr 2014 19:07:57 -0600 Subject: [PATCH 26/54] Unsubscribe from the editor model with ::unsubscribe --- src/editor-view.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 1dd776c65..7f6a99b45 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -527,7 +527,7 @@ class EditorView extends View if @editor @saveScrollPositionForEditor() - @editor.off(".editor") + @unsubscribe(@editor) @editor = editor From b6d8d5d100e21342f56be397be8efa6b023765c6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 16 Apr 2014 09:56:24 -0600 Subject: [PATCH 27/54] Prepare 0.88.0 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a148b6105..5b68ec25e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.86.0", + "version": "0.88.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From fb56817895bcd561b573ccfeceedb986be9a84f0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 16 Apr 2014 09:58:38 -0600 Subject: [PATCH 28/54] Prepare 0.89.0 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b68ec25e..d382ed4a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.88.0", + "version": "0.89.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From fdccc2dae4161595b379b960f92efa8d20df61de Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 16 Apr 2014 10:20:11 -0600 Subject: [PATCH 29/54] Prepare 0.90.0 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a86c1280..d600ca29e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.89.0", + "version": "0.90.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From a1b0f6c25dbdcb5f693ead6155bc0d4d3dba9a84 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 09:29:09 -0700 Subject: [PATCH 30/54] Upgrade to settings-view@0.109.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d600ca29e..2494a2e0d 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "open-on-github": "0.28.0", "package-generator": "0.30.0", "release-notes": "0.27.0", - "settings-view": "0.108.0", + "settings-view": "0.109.0", "snippets": "0.41.0", "spell-check": "0.33.0", "status-bar": "0.40.0", From 71328f21bdc82424a137abbc37941558b8999f98 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 10:03:30 -0700 Subject: [PATCH 31/54] Upgrade to language-go@0.9.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2494a2e0d..989866be9 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "language-css": "0.13.0", "language-gfm": "0.31.0", "language-git": "0.9.0", - "language-go": "0.8.0", + "language-go": "0.9.0", "language-html": "0.19.0", "language-hyperlink": "0.9.0", "language-java": "0.9.0", From 58da88b71aa51b4384483111a6bfe90664825fc1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 10:55:50 -0700 Subject: [PATCH 32/54] Upgrade to apm v0.39.0 --- vendor/apm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/apm b/vendor/apm index 2ce1206e6..b0fd602b4 160000 --- a/vendor/apm +++ b/vendor/apm @@ -1 +1 @@ -Subproject commit 2ce1206e6720c133fd2acf53bebeb9b37de2b65a +Subproject commit b0fd602b4ffd0dac68cdc7b012666faebba0a0f8 From c475e89a3e6a2feecb7d2315efcc72f15ab4d1ee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 12:07:43 -0700 Subject: [PATCH 33/54] Remove duplicate tilde Closes #1866 --- src/editor-view.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 7f6a99b45..28b50bf05 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -50,7 +50,7 @@ class EditorView extends View showLineNumbers: true autoIndent: true normalizeIndentOnPaste: true - nonWordCharacters: "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?-" + nonWordCharacters: "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-" preferredLineLength: 80 tabLength: 2 softWrap: false From a967e52f685d6410113a1ee280944684e497d457 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 12:43:51 -0700 Subject: [PATCH 34/54] Autoscroll when moving lines up/down Closes #1829 --- src/editor.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 662c6e8a6..d286e187f 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -913,7 +913,7 @@ class Editor extends Model for foldedRow in foldedRows when 0 <= foldedRow <= @getLastBufferRow() @foldBufferRow(foldedRow) - @setSelectedBufferRange(selection.translate([-insertDelta]), preserveFolds: true) + @setSelectedBufferRange(selection.translate([-insertDelta]), preserveFolds: true, autoscroll: true) # Move lines intersecting the most recent selection down by one row in screen # coordinates. @@ -969,7 +969,7 @@ class Editor extends Model for foldedRow in foldedRows when 0 <= foldedRow <= @getLastBufferRow() @foldBufferRow(foldedRow) - @setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true) + @setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true, autoscroll: true) # Duplicate the most recent cursor's current line. duplicateLines: -> From 442342937ffa1d427b81d12e386a3c574108f1c6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 13:43:25 -0700 Subject: [PATCH 35/54] Upgrade to markdown-preview@0.63.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 989866be9..2cb68fc51 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "image-view": "0.33.0", "keybinding-resolver": "0.17.0", "link": "0.22.0", - "markdown-preview": "0.62.0", + "markdown-preview": "0.63.0", "metrics": "0.32.0", "open-on-github": "0.28.0", "package-generator": "0.30.0", From ddf7bb53031cbbee0156dd96a0d6990549c7c571 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 17:55:05 -0700 Subject: [PATCH 36/54] Upgrade to settings-view@0.110.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cb68fc51..bc0efb10d 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "open-on-github": "0.28.0", "package-generator": "0.30.0", "release-notes": "0.27.0", - "settings-view": "0.109.0", + "settings-view": "0.110.0", "snippets": "0.41.0", "spell-check": "0.33.0", "status-bar": "0.40.0", From 142bb4b615c88f8e7c0762a8714c367704bf6282 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 11:18:49 -0700 Subject: [PATCH 37/54] Upgrade to markdown-preview@0.64.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc0efb10d..587e19e37 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "image-view": "0.33.0", "keybinding-resolver": "0.17.0", "link": "0.22.0", - "markdown-preview": "0.63.0", + "markdown-preview": "0.64.0", "metrics": "0.32.0", "open-on-github": "0.28.0", "package-generator": "0.30.0", From be3a6bc6d018c777de77c06d16ae7f326bf012ca Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 17:03:38 -0700 Subject: [PATCH 38/54] Send context menu commands without focused window The context menu always knows what window it is bound to so start supporting running context menus on non-focused windows. Previously these would either fail silently or log an error if focusedWindow() returned null and the command wasn't guarding against it. --- src/browser/atom-application.coffee | 16 +++++++++++++++- src/browser/atom-window.coffee | 2 +- src/browser/context-menu.coffee | 9 +++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 20d5e1e5b..62855ebca 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -140,7 +140,9 @@ class AtomApplication @on 'application:open-file', -> @promptForPath(type: 'file') @on 'application:open-folder', -> @promptForPath(type: 'folder') @on 'application:open-dev', -> @promptForPath(devMode: true) - @on 'application:inspect', ({x,y}) -> @focusedWindow().browserWindow.inspectElement(x, y) + @on 'application:inspect', ({x,y}, atomWindow=@focusedWindow()) -> + atomWindow?.browserWindow?.inspectElement(x, y) + @on 'application:open-documentation', -> shell.openExternal('https://atom.io/docs/latest/?app') @on 'application:install-update', -> @autoUpdateManager.install() @on 'application:check-for-update', => @autoUpdateManager.check() @@ -228,6 +230,18 @@ class AtomApplication else @sendCommandToFirstResponder(command) + # Public: Executes the given command on the given window. + # + # command - The string representing the command. + # atomWindow - The {AtomWindow} to send the command to. + # args - The optional arguments to pass along. + sendCommandToWindow: (command, atomWindow, args...) -> + unless @emit(command, args..., atomWindow) + if atomWindow? + atomWindow.sendCommand(command, args...) + else + @sendCommandToFirstResponder(command) + # Translates the command into OS X action and sends it to application's first # responder. sendCommandToFirstResponder: (command) -> diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index 4d4f71a93..744ae9a50 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -107,7 +107,7 @@ class AtomWindow when 1 then @browserWindow.restart() @browserWindow.on 'context-menu', (menuTemplate) => - new ContextMenu(menuTemplate, @browserWindow) + new ContextMenu(menuTemplate, this) if @isSpec # Spec window's web view should always have focus diff --git a/src/browser/context-menu.coffee b/src/browser/context-menu.coffee index e3044b30d..c8ab57de5 100644 --- a/src/browser/context-menu.coffee +++ b/src/browser/context-menu.coffee @@ -2,10 +2,10 @@ Menu = require 'menu' module.exports = class ContextMenu - constructor: (template, browserWindow) -> + constructor: (template, @atomWindow) -> template = @createClickHandlers(template) menu = Menu.buildFromTemplate(template) - menu.popup(browserWindow) + menu.popup(@atomWindow.browserWindow) # It's necessary to build the event handlers in this process, otherwise # closures are drug across processes and failed to be garbage collected @@ -14,6 +14,7 @@ class ContextMenu for item in template if item.command (item.commandOptions ?= {}).contextCommand = true - item.click = do (item) -> - => global.atomApplication.sendCommand(item.command, item.commandOptions) + do (item) => + item.click = => + global.atomApplication.sendCommandToWindow(item.command, @atomWindow, item.commandOptions) item From 020c5e795aa82cfb38f7c9bd65bb8ae1e44a081c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Apr 2014 17:07:46 -0700 Subject: [PATCH 39/54] Remove unneeded . --- src/context-menu-manager.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 40228156b..c310c9c48 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -18,7 +18,7 @@ class ContextMenuManager label: 'Inspect Element' command: 'application:inspect' executeAtBuild: (e) -> - @.commandOptions = x: e.pageX, y: e.pageY + @commandOptions = x: e.pageX, y: e.pageY ] # Public: Creates menu definitions from the object specified by the menu From 9128041c202e89b57a8014f4a18b6276019087c2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 11:36:19 -0700 Subject: [PATCH 40/54] Include AtomWindow in command options This ensures that all application commands can use it instead of relying on the focused window. --- src/browser/atom-application.coffee | 5 +++-- src/browser/context-menu.coffee | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 62855ebca..23dc09686 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -140,7 +140,8 @@ class AtomApplication @on 'application:open-file', -> @promptForPath(type: 'file') @on 'application:open-folder', -> @promptForPath(type: 'folder') @on 'application:open-dev', -> @promptForPath(devMode: true) - @on 'application:inspect', ({x,y}, atomWindow=@focusedWindow()) -> + @on 'application:inspect', ({x,y, atomWindow}) -> + atomWindow ?= @focusedWindow() atomWindow?.browserWindow?.inspectElement(x, y) @on 'application:open-documentation', -> shell.openExternal('https://atom.io/docs/latest/?app') @@ -236,7 +237,7 @@ class AtomApplication # atomWindow - The {AtomWindow} to send the command to. # args - The optional arguments to pass along. sendCommandToWindow: (command, atomWindow, args...) -> - unless @emit(command, args..., atomWindow) + unless @emit(command, args...) if atomWindow? atomWindow.sendCommand(command, args...) else diff --git a/src/browser/context-menu.coffee b/src/browser/context-menu.coffee index c8ab57de5..1f8377637 100644 --- a/src/browser/context-menu.coffee +++ b/src/browser/context-menu.coffee @@ -13,7 +13,9 @@ class ContextMenu createClickHandlers: (template) -> for item in template if item.command - (item.commandOptions ?= {}).contextCommand = true + item.commandOptions ?= {} + item.commandOptions.contextCommand = true + item.commandOptions.atomWindow = @atomWindow do (item) => item.click = => global.atomApplication.sendCommandToWindow(item.command, @atomWindow, item.commandOptions) From e37fc316fbaca21182bdd8ee44e7f4c833e3094b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 11:42:57 -0700 Subject: [PATCH 41/54] Remove unneeded ? AtomWindow always has a non-null browserWindow property --- src/browser/atom-application.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 23dc09686..01ca799b7 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -142,7 +142,7 @@ class AtomApplication @on 'application:open-dev', -> @promptForPath(devMode: true) @on 'application:inspect', ({x,y, atomWindow}) -> atomWindow ?= @focusedWindow() - atomWindow?.browserWindow?.inspectElement(x, y) + atomWindow?.browserWindow.inspectElement(x, y) @on 'application:open-documentation', -> shell.openExternal('https://atom.io/docs/latest/?app') @on 'application:install-update', -> @autoUpdateManager.install() From 37d2e00f4ea9d054f9cf595a11c0cdaea641140d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 17 Apr 2014 13:33:28 -0600 Subject: [PATCH 42/54] Upgrade to text-buffer@2.0.2 to fix next marker id when deserializing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 587e19e37..d64130d41 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "serializable": "1.x", "space-pen": "3.1.1", "temp": "0.5.0", - "text-buffer": "^2.0.1", + "text-buffer": "^2.0.2", "theorist": "1.x", "underscore-plus": "^1.1.2", "vm-compatibility-layer": "0.1.0" From 20c3ca21e39948a49dc37f1dd6e537a1af99600a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:08:27 -0700 Subject: [PATCH 43/54] Add Config::getDefault(keyPath) --- spec/config-spec.coffee | 17 +++++++++++++++++ src/config.coffee | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 2d74d69f0..43e88f29e 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -45,6 +45,23 @@ describe "Config", -> atom.config.set('foo.changes', 1) expect(atom.config.settings.foo).toEqual {} + describe ".getDefault(keyPath)", -> + it "returns the default value", -> + atom.config.setDefaults("foo", same: 1, changes: 1) + expect(atom.config.getDefault('foo.same')).toBe 1 + expect(atom.config.getDefault('foo.changes')).toBe 1 + + atom.config.set('foo.same', 2) + atom.config.set('foo.changes', 3) + expect(atom.config.getDefault('foo.same')).toBe 1 + expect(atom.config.getDefault('foo.changes')).toBe 1 + + it "returns a clone of the default value", -> + initialDefaultValue = [1, 2, 3] + atom.config.setDefaults("foo", bar: initialDefaultValue) + expect(atom.config.getDefault('foo.bar')).toEqual initialDefaultValue + expect(atom.config.getDefault('foo.bar')).not.toBe initialDefaultValue + describe ".toggle(keyPath)", -> it "negates the boolean value of the current key path value", -> atom.config.set('foo.a', 1) diff --git a/src/config.coffee b/src/config.coffee index 0c0e558aa..07f7b833b 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -158,6 +158,15 @@ class Config restoreDefault: (keyPath) -> @set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath)) + # Public: Get the default value of the key path. + # + # keyPath - The {String} name of the key. + # + # Returns the default value. + getDefault: (keyPath) -> + value = _.valueForKeyPath(@defaultSettings, keyPath) + _.deepClone(value) + # Public: Push the value to the array at the key path. # # keyPath - The {String} key path. From 35d268fcf815e3e19d83f29540b14d926af30ddc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:15:20 -0700 Subject: [PATCH 44/54] Use _.isEqual when comparing value to default --- spec/config-spec.coffee | 5 ++++- src/config.coffee | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 43e88f29e..76806cc88 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -36,10 +36,13 @@ describe "Config", -> describe "when the value equals the default value", -> it "does not store the value", -> - atom.config.setDefaults("foo", same: 1, changes: 1) + atom.config.setDefaults("foo", same: 1, changes: 1, sameArray: [1, 2, 3], null: null, undefined: undefined) expect(atom.config.settings.foo).toBeUndefined() atom.config.set('foo.same', 1) atom.config.set('foo.changes', 2) + atom.config.set('foo.sameArray', [1, 2, 3]) + atom.config.set('foo.null', undefined) + atom.config.set('foo.undefined', null) expect(atom.config.settings.foo).toEqual {changes: 2} atom.config.set('foo.changes', 1) diff --git a/src/config.coffee b/src/config.coffee index 07f7b833b..1f520479e 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -135,8 +135,9 @@ class Config # # Returns the `value`. set: (keyPath, value) -> - if @get(keyPath) != value - value = undefined if _.valueForKeyPath(@defaultSettings, keyPath) == value + if @get(keyPath) isnt value + defaultValue = _.valueForKeyPath(@defaultSettings, keyPath) + value = undefined if _.isEqual(defaultValue, value) _.setValueForKeyPath(@settings, keyPath, value) @update() value From f12004d27bcb98e709579ebd91ea0d9907b855b7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:16:35 -0700 Subject: [PATCH 45/54] Add object to default value spec --- spec/config-spec.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 76806cc88..3e231f4a9 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -36,13 +36,21 @@ describe "Config", -> describe "when the value equals the default value", -> it "does not store the value", -> - atom.config.setDefaults("foo", same: 1, changes: 1, sameArray: [1, 2, 3], null: null, undefined: undefined) + atom.config.setDefaults "foo", + same: 1 + changes: 1 + sameArray: [1, 2, 3] + sameObject: {a: 1, b: 2} + null: null + undefined: undefined + expect(atom.config.settings.foo).toBeUndefined() atom.config.set('foo.same', 1) atom.config.set('foo.changes', 2) atom.config.set('foo.sameArray', [1, 2, 3]) atom.config.set('foo.null', undefined) atom.config.set('foo.undefined', null) + atom.config.set('foo.sameObject', {b: 2, a: 1}) expect(atom.config.settings.foo).toEqual {changes: 2} atom.config.set('foo.changes', 1) From 0ea683e0b51b8d38987d325797849debd888683e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:17:03 -0700 Subject: [PATCH 46/54] :lipstick: Move expect up one line --- spec/config-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 3e231f4a9..0de7f5ec7 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -43,8 +43,8 @@ describe "Config", -> sameObject: {a: 1, b: 2} null: null undefined: undefined - expect(atom.config.settings.foo).toBeUndefined() + atom.config.set('foo.same', 1) atom.config.set('foo.changes', 2) atom.config.set('foo.sameArray', [1, 2, 3]) From 541ffa505722f1891147e1ccf643d63642c31b13 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:19:25 -0700 Subject: [PATCH 47/54] :lipstick: Combine specs --- spec/config-spec.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 0de7f5ec7..c6639de60 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -57,7 +57,7 @@ describe "Config", -> expect(atom.config.settings.foo).toEqual {} describe ".getDefault(keyPath)", -> - it "returns the default value", -> + it "returns a clone of the default value", -> atom.config.setDefaults("foo", same: 1, changes: 1) expect(atom.config.getDefault('foo.same')).toBe 1 expect(atom.config.getDefault('foo.changes')).toBe 1 @@ -67,7 +67,6 @@ describe "Config", -> expect(atom.config.getDefault('foo.same')).toBe 1 expect(atom.config.getDefault('foo.changes')).toBe 1 - it "returns a clone of the default value", -> initialDefaultValue = [1, 2, 3] atom.config.setDefaults("foo", bar: initialDefaultValue) expect(atom.config.getDefault('foo.bar')).toEqual initialDefaultValue From 6ec58e1163131daa688b43cbd0d31d28de6edf21 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:20:33 -0700 Subject: [PATCH 48/54] Rename value var to defaultValue --- src/config.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 1f520479e..472043f2a 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -165,8 +165,8 @@ class Config # # Returns the default value. getDefault: (keyPath) -> - value = _.valueForKeyPath(@defaultSettings, keyPath) - _.deepClone(value) + defaultValue = _.valueForKeyPath(@defaultSettings, keyPath) + _.deepClone(defaultValue) # Public: Push the value to the array at the key path. # From 408665d7d2badc337f9cae9602001928d2c26e6e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:30:22 -0700 Subject: [PATCH 49/54] Add Config::isDefault(keyPath) --- spec/config-spec.coffee | 11 +++++++++++ src/config.coffee | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index c6639de60..95ef05760 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -72,6 +72,17 @@ describe "Config", -> expect(atom.config.getDefault('foo.bar')).toEqual initialDefaultValue expect(atom.config.getDefault('foo.bar')).not.toBe initialDefaultValue + describe ".isDefault(keyPath)", -> + it "returns true when the value of the key path is its default value", -> + atom.config.setDefaults("foo", same: 1, changes: 1) + expect(atom.config.isDefault('foo.same')).toBe true + expect(atom.config.isDefault('foo.changes')).toBe true + + atom.config.set('foo.same', 2) + atom.config.set('foo.changes', 3) + expect(atom.config.isDefault('foo.same')).toBe false + expect(atom.config.isDefault('foo.changes')).toBe false + describe ".toggle(keyPath)", -> it "negates the boolean value of the current key path value", -> atom.config.set('foo.a', 1) diff --git a/src/config.coffee b/src/config.coffee index 472043f2a..bcbb7edd6 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -168,6 +168,13 @@ class Config defaultValue = _.valueForKeyPath(@defaultSettings, keyPath) _.deepClone(defaultValue) + # Public: Is the key path value its default value? + # + # Returns a {Boolean}, `true` if the current value is the default, `false` + # otherwise. + isDefault: (keyPath) -> + not _.valueForKeyPath(@settings, keyPath)? + # Public: Push the value to the array at the key path. # # keyPath - The {String} key path. From 9b2901583e7e40ca9bab79696d15bc61a8b6b9e8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 10:56:06 -0700 Subject: [PATCH 50/54] :memo: Clean up docs --- src/config.coffee | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index bcbb7edd6..e41bbb9d6 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -88,7 +88,7 @@ class Config _.extend hash, defaults @emit 'updated' - # Public: Get the path to the config file being used. + # Public: Get the {String} path to the config file being used. getUserConfigPath: -> @configFilePath @@ -98,10 +98,10 @@ class Config # Public: Retrieves the setting for the given key. # - # keyPath - The {String} name of the key to retrieve + # keyPath - The {String} name of the key to retrieve. # - # Returns the value from Atom's default settings, the user's configuration file, - # or `null` if the key doesn't exist in either. + # Returns the value from Atom's default settings, the user's configuration + # file, or `null` if the key doesn't exist in either. get: (keyPath) -> value = _.valueForKeyPath(@settings, keyPath) ? _.valueForKeyPath(@defaultSettings, keyPath) _.deepClone(value) @@ -110,8 +110,8 @@ class Config # # keyPath - The {String} name of the key to retrieve # - # Returns the value from Atom's default settings, the user's configuration file, - # or `NaN` if the key doesn't exist in either. + # Returns the value from Atom's default settings, the user's configuration + # file, or `NaN` if the key doesn't exist in either. getInt: (keyPath) -> parseInt(@get(keyPath)) @@ -121,8 +121,8 @@ class Config # defaultValue - The integer {Number} to fall back to if the value isn't # positive, defaults to 0. # - # Returns the value from Atom's default settings, the user's configuration file, - # or `defaultValue` if the key value isn't greater than zero. + # Returns the value from Atom's default settings, the user's configuration + # file, or `defaultValue` if the key value isn't greater than zero. getPositiveInt: (keyPath, defaultValue=0) -> Math.max(@getInt(keyPath), 0) or defaultValue @@ -130,8 +130,8 @@ class Config # # This value is stored in Atom's internal configuration file. # - # keyPath - The {String} name of the key - # value - The value of the setting + # keyPath - The {String} name of the key. + # value - The value of the setting. # # Returns the `value`. set: (keyPath, value) -> @@ -147,6 +147,8 @@ class Config # The new value will be `true` if the value is currently falsy and will be # `false` if the value is currently truthy. # + # keyPath - The {String} name of the key. + # # Returns the new value. toggle: (keyPath) -> @set(keyPath, !@get(keyPath)) @@ -170,6 +172,8 @@ class Config # Public: Is the key path value its default value? # + # keyPath - The {String} name of the key. + # # Returns a {Boolean}, `true` if the current value is the default, `false` # otherwise. isDefault: (keyPath) -> @@ -180,7 +184,7 @@ class Config # keyPath - The {String} key path. # value - The value to push to the array. # - # Returns the new array length of the setting. + # Returns the new array length {Number} of the setting. pushAtKeyPath: (keyPath, value) -> arrayValue = @get(keyPath) ? [] result = arrayValue.push(value) @@ -192,7 +196,7 @@ class Config # keyPath - The {String} key path. # value - The value to shift onto the array. # - # Returns the new array length of the setting. + # Returns the new array length {Number} of the setting. unshiftAtKeyPath: (keyPath, value) -> arrayValue = @get(keyPath) ? [] result = arrayValue.unshift(value) @@ -242,9 +246,9 @@ class Config callback(value) if options.callNow ? true subscription - # Public: Unobserve all callbacks on a given key + # Public: Unobserve all callbacks on a given key. # - # keyPath - The {String} name of the key to unobserve + # keyPath - The {String} name of the key to unobserve. unobserve: (keyPath) -> @off("updated.#{keyPath.replace(/\./, '-')}") From 27fe5b784c53637da3c09418229dcd95d5210b27 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 11:00:00 -0700 Subject: [PATCH 51/54] :memo: Use package instead of plugin in example --- src/config.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index e41bbb9d6..551240f31 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -18,9 +18,9 @@ pathWatcher = require 'pathwatcher' # ## Example # # ```coffeescript -# atom.config.set('myplugin.key', 'value') -# atom.config.observe 'myplugin.key', -> -# console.log 'My configuration changed:', atom.config.get('myplugin.key') +# atom.config.set('my-package.key', 'value') +# atom.config.observe 'my-package.key', -> +# console.log 'My configuration changed:', atom.config.get('my-package.key') # ``` module.exports = class Config From 81646532b4c22a8a80aaf67277b66df740a04940 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 13:31:43 -0700 Subject: [PATCH 52/54] Ignore non-string core.themes config entries Previously exceptions would be raised downstream if invalid theme names were returned from ThemeManager::getEnabledThemeNames Closes #1877 --- spec/theme-manager-spec.coffee | 16 ++++++++++++++++ src/theme-manager.coffee | 2 ++ 2 files changed, 18 insertions(+) diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee index d3e3bd434..cbf201913 100644 --- a/spec/theme-manager-spec.coffee +++ b/spec/theme-manager-spec.coffee @@ -36,6 +36,22 @@ describe "ThemeManager", -> themes = themeManager.getActiveThemes() expect(themes).toHaveLength(names.length) + describe "when the core.themes config value contains invalid entry", -> + fit "ignores theme", -> + atom.config.set 'core.themes', [ + 'atom-light-ui' + null + undefined + '' + false + 4 + {} + [] + 'atom-dark-ui' + ] + + expect(themeManager.getEnabledThemeNames()).toEqual ['atom-dark-ui', 'atom-light-ui'] + describe "getImportPaths()", -> it "returns the theme directories before the themes are loaded", -> atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui', 'atom-light-ui']) diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 320e1e8f9..3570bef69 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -48,6 +48,8 @@ class ThemeManager getEnabledThemeNames: -> themeNames = atom.config.get('core.themes') ? [] themeNames = [themeNames] unless _.isArray(themeNames) + themeNames = themeNames.filter (themeName) -> + themeName and typeof themeName is 'string' # Reverse so the first (top) theme is loaded after the others. We want # the first/top theme to override later themes in the stack. From 02553bf8e21c42a4c68345abfe553cfe57e1721b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 13:34:23 -0700 Subject: [PATCH 53/54] Upgrade to fs-plus 2.2.2 Refs #1877 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d64130d41..f844b688a 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "delegato": "1.x", "emissary": "^1.2.1", "first-mate": "^1.5.1", - "fs-plus": "^2.2.1", + "fs-plus": "^2.2.2", "fstream": "0.1.24", "fuzzaldrin": "~1.1", "git-utils": "^1.2.2", From 690fc7180a9f1dc5dfc77f8b2b31e866ce79510c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 17 Apr 2014 13:53:00 -0700 Subject: [PATCH 54/54] Defer requiring of $ in Package This is needed in the case that the package manager is being used in the browser process to open a URL. Closes #1869 --- src/package.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/package.coffee b/src/package.coffee index f51d9aea4..6ef7bc3b4 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -7,7 +7,7 @@ fs = require 'fs-plus' {Emitter} = require 'emissary' Q = require 'q' -{$} = require './space-pen-extensions' +$ = null # Defer require in case this is in the window-less browser process ScopedProperties = require './scoped-properties' # Loads and activates a package's main module and resources such as @@ -286,6 +286,7 @@ class Package handleActivationEvent: (event) => bubblePathEventHandlers = @disableEventHandlersOnBubblePath(event) @activateNow() + $ ?= require('./space-pen-extensions').$ $(event.target).trigger(event) @restoreEventHandlersOnBubblePath(bubblePathEventHandlers) @unsubscribeFromActivationEvents() @@ -303,6 +304,7 @@ class Package disableEventHandlersOnBubblePath: (event) -> bubblePathEventHandlers = [] disabledHandler = -> + $ ?= require('./space-pen-extensions').$ element = $(event.target) while element.length if eventHandlers = element.handlers()?[event.type]