From 99f25267a030329399879a75b448b8e4b187846a Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 29 Jan 2014 16:52:42 -0800 Subject: [PATCH 01/96] Make sure the filePath is never null or undefined --- src/project.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 62f5f0dbe..51d7e78d9 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -143,9 +143,10 @@ class Project extends Model # # Returns a promise that resolves to an {Editor}. open: (filePath, options={}) -> - filePath = @resolve(filePath) - resource = null - _.find @openers, (opener) -> resource = opener(filePath, options) + filePath = @resolve(filePath) ? '' + resource = opener(filePath, options) for opener in @openers when !resource + + console.log resource if resource Q(resource) @@ -155,11 +156,10 @@ class Project extends Model # Private: Only be used in specs openSync: (filePath, options={}) -> - filePath = @resolve(filePath) - for opener in @openers - return resource if resource = opener(filePath, options) + filePath = @resolve(filePath) ? '' + resource = opener(filePath, options) for opener in @openers when !resource - @buildEditorForBuffer(@bufferForPathSync(filePath), options) + resource or @buildEditorForBuffer(@bufferForPathSync(filePath), options) # Public: Retrieves all {Editor}s for all open files. # From dcbd2a210246534ee355d20979d88e683039564f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 3 Feb 2014 19:00:50 -0800 Subject: [PATCH 02/96] Add split and searchAllPanes option to Workspace::open --- spec/workspace-spec.coffee | 193 ++++++++++++++++++++----------------- src/workspace.coffee | 28 ++++-- 2 files changed, 123 insertions(+), 98 deletions(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 937069482..4ca654d18 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -7,49 +7,119 @@ describe "Workspace", -> atom.project.setPath(atom.project.resolve('dir')) workspace = new Workspace - describe "::open(uri)", -> + describe "::open(uri, options)", -> beforeEach -> - spyOn(workspace.activePane, 'activate') - - describe "when called without a uri", -> - it "adds and activates an empty editor on the active pane", -> - editor = null - waitsForPromise -> - workspace.open().then (o) -> editor = o - - runs -> - expect(editor.getPath()).toBeUndefined() - expect(workspace.activePane.items).toEqual [editor] - expect(workspace.activePaneItem).toBe editor - expect(workspace.activePane.activate).toHaveBeenCalled() - - describe "when called with a uri", -> - describe "when the active pane already has an editor for the given uri", -> - it "activates the existing editor on the active pane", -> - editor1 = workspace.openSync('a') - editor2 = workspace.openSync('b') + spyOn(workspace.activePane, 'activate').andCallThrough() + describe "when the 'searchAllPanes' option is false (default)", -> + describe "when called without a uri", -> + it "adds and activates an empty editor on the active pane", -> editor = null waitsForPromise -> - workspace.open('a').then (o) -> editor = o + workspace.open().then (o) -> editor = o runs -> - expect(editor).toBe editor1 - expect(workspace.activePaneItem).toBe editor - expect(workspace.activePane.activate).toHaveBeenCalled() - - 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", -> - editor = null - waitsForPromise -> - workspace.open('a').then (o) -> editor = o - - runs -> - expect(editor.getUri()).toBe 'a' - expect(workspace.activePaneItem).toBe editor + expect(editor.getPath()).toBeUndefined() expect(workspace.activePane.items).toEqual [editor] + expect(workspace.activePaneItem).toBe editor expect(workspace.activePane.activate).toHaveBeenCalled() + describe "when called with a uri", -> + describe "when the active pane already has an editor for the given uri", -> + it "activates the existing editor on the active pane", -> + editor1 = workspace.openSync('a') + editor2 = workspace.openSync('b') + + editor = null + waitsForPromise -> + workspace.open('a').then (o) -> editor = o + + runs -> + expect(editor).toBe editor1 + expect(workspace.activePaneItem).toBe editor + expect(workspace.activePane.activate).toHaveBeenCalled() + + 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", -> + editor = null + waitsForPromise -> + workspace.open('a').then (o) -> editor = o + + runs -> + expect(editor.getUri()).toBe 'a' + expect(workspace.activePaneItem).toBe editor + expect(workspace.activePane.items).toEqual [editor] + expect(workspace.activePane.activate).toHaveBeenCalled() + + describe "when the 'searchAllPanes' option is true", -> + describe "when an editor for the given uri is already open on an inactive pane", -> + it "activates the existing editor on the inactive pane, then activates that pane", -> + editor1 = workspace.openSync('a') + pane1 = workspace.activePane + pane2 = workspace.activePane.splitRight() + editor2 = workspace.openSync('b') + expect(workspace.activePaneItem).toBe editor2 + + waitsForPromise -> + workspace.open('a', searchAllPanes: true) + + runs -> + expect(workspace.activePane).toBe pane1 + expect(workspace.activePaneItem).toBe editor1 + + describe "when no editor for the given uri is open in any pane", -> + it "opens an editor for the given uri in the active pane", -> + editor = null + waitsForPromise -> + workspace.open('a', searchAllPanes: true).then (o) -> editor = o + + runs -> + expect(workspace.activePaneItem).toBe editor + + describe "when the 'split' option is set", -> + describe "when the 'split' option is 'left'", -> + it "opens the editor in the leftmost pane of the current pane axis", -> + pane1 = workspace.activePane + pane2 = pane1.splitRight() + expect(workspace.activePane).toBe pane2 + + editor = null + waitsForPromise -> + workspace.open('a', split: 'left').then (o) -> editor = o + + runs -> + expect(workspace.activePane).toBe pane1 + expect(pane1.items).toEqual [editor] + expect(pane2.items).toEqual [] + + describe "when the 'split' option is 'right'", -> + it "activates the editor on the existing right pane", -> + pane1 = workspace.activePane + pane2 = pane1.splitRight() + pane1.activate() + + editor = null + waitsForPromise -> + workspace.open('a', split: 'right').then (o) -> editor = o + + runs -> + expect(workspace.activePane).toBe pane2 + expect(pane2.items).toEqual [editor] + expect(pane1.items).toEqual [] + + it "splits the current pane if the right pane doesn't exist", -> + pane1 = workspace.activePane + + editor = null + waitsForPromise -> + workspace.open('a', split: 'right').then (o) -> editor = o + + runs -> + pane2 = workspace.activePane + expect(workspace.paneContainer.root.children).toEqual [pane1, pane2] + expect(pane2.items).toEqual [editor] + expect(pane1.items).toEqual [] + describe "::openSync(uri, options)", -> [activePane, initialItemCount] = [] @@ -92,61 +162,6 @@ describe "Workspace", -> workspace.openSync('b', activatePane: false) expect(activePane.activate).not.toHaveBeenCalled() - describe "::openSingletonSync(uri, options)", -> - describe "when an editor for the given uri is already open on the active pane", -> - it "activates the existing editor", -> - editor1 = workspace.openSync('a') - editor2 = workspace.openSync('b') - expect(workspace.activePaneItem).toBe editor2 - workspace.openSingletonSync('a') - expect(workspace.activePaneItem).toBe editor1 - - describe "when an editor for the given uri is already open on an inactive pane", -> - it "activates the existing editor on the inactive pane, then activates that pane", -> - editor1 = workspace.openSync('a') - pane1 = workspace.activePane - pane2 = workspace.activePane.splitRight() - editor2 = workspace.openSync('b') - expect(workspace.activePaneItem).toBe editor2 - workspace.openSingletonSync('a') - expect(workspace.activePane).toBe pane1 - expect(workspace.activePaneItem).toBe editor1 - - describe "when no editor for the given uri is open in any pane", -> - it "opens an editor for the given uri in the active pane", -> - editor1 = workspace.openSingletonSync('a') - expect(workspace.activePaneItem).toBe editor1 - - describe "when the 'split' option is 'left'", -> - it "opens the editor in the leftmost pane of the current pane axis", -> - pane1 = workspace.activePane - pane2 = pane1.splitRight() - expect(workspace.activePane).toBe pane2 - editor1 = workspace.openSingletonSync('a', split: 'left') - expect(workspace.activePane).toBe pane1 - expect(pane1.items).toEqual [editor1] - expect(pane2.items).toEqual [] - - describe "when the 'split' option is 'right'", -> - describe "when the active pane is in a horizontal pane axis", -> - it "activates the editor on the rightmost pane of the current pane axis", -> - pane1 = workspace.activePane - pane2 = pane1.splitRight() - pane1.activate() - editor1 = workspace.openSingletonSync('a', split: 'right') - expect(workspace.activePane).toBe pane2 - expect(pane2.items).toEqual [editor1] - expect(pane1.items).toEqual [] - - describe "when the active pane is not in a horizontal pane axis", -> - it "splits the current pane to the right, then activates the editor on the right pane", -> - pane1 = workspace.activePane - editor1 = workspace.openSingletonSync('a', split: 'right') - pane2 = workspace.activePane - expect(workspace.paneContainer.root.children).toEqual [pane1, pane2] - expect(pane2.items).toEqual [editor1] - expect(pane1.items).toEqual [] - describe "::reopenItemSync()", -> it "opens the uri associated with the last closed pane that isn't currently open", -> pane = workspace.activePane diff --git a/src/workspace.coffee b/src/workspace.coffee index 21663bb59..c3d9cb48d 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -57,20 +57,30 @@ class Workspace extends Model changeFocus = options.changeFocus ? true filePath = atom.project.resolve(filePath) initialLine = options.initialLine - activePane = @activePane + searchAllPanes = options.searchAllPanes + split = options.split + uri = atom.project.relativize(filePath) - editor = activePane.itemForUri(atom.project.relativize(filePath)) if activePane and filePath - promise = atom.project.open(filePath, {initialLine}) if not editor + pane = switch split + when 'left' + @activePane.findLeftmostSibling() + when 'right' + @activePane.findOrCreateRightmostSibling() + else + if searchAllPanes + @paneContainer.paneForUri(uri) ? @activePane + else + @activePane - Q(editor ? promise) + Q(pane.itemForUri(uri) ? atom.project.open(filePath, options)) .then (editor) => - if not activePane - activePane = new Pane(items: [editor]) - @paneContainer.root = activePane + if not pane + pane = new Pane(items: [editor]) + @paneContainer.root = pane @itemOpened(editor) - activePane.activateItem(editor) - activePane.activate() if changeFocus + pane.activateItem(editor) + pane.activate() if changeFocus @emit "uri-opened" editor .catch (error) -> From bc5a79564a8b11f1ecefc675eb3a8e060a8b68d5 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 3 Feb 2014 19:00:54 -0800 Subject: [PATCH 03/96] Update docs --- src/workspace.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index c3d9cb48d..2d2ca0711 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -51,6 +51,12 @@ class Workspace extends Model # * filePath: A file path # * options # + initialLine: The buffer line number to open to. + # + split: Takes 'left' or 'right'. Opens in existing right or left pane if + # one exists, otherwise creates a new pane. + # + changeFocus: Boolean that allows a filePath to be opened without + # changing focus. + # + searchAllPanes: Boolean that will open existing editors from any pane + # if the filePath is already open (defaults to false) # # Returns a promise that resolves to the {Editor} for the file URI. open: (filePath, options={}) -> @@ -103,8 +109,7 @@ class Workspace extends Model @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. + # Deprecated openSingletonSync: (uri, options={}) -> {initialLine, split} = options # TODO: Remove deprecated changeFocus option From 1023c421c720277b57fb91b4946f09c0528bec3e Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 4 Feb 2014 10:07:01 -0800 Subject: [PATCH 04/96] Remove log --- src/project.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 51d7e78d9..8aaf6e27b 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -146,8 +146,6 @@ class Project extends Model filePath = @resolve(filePath) ? '' resource = opener(filePath, options) for opener in @openers when !resource - console.log resource - if resource Q(resource) else From 3c9000719979dc4cf21c4d4be5ed7841b7e54d89 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 4 Feb 2014 10:07:17 -0800 Subject: [PATCH 05/96] Cleanup split specs --- spec/workspace-spec.coffee | 46 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 4ca654d18..fd99c3d74 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -92,33 +92,39 @@ describe "Workspace", -> expect(pane1.items).toEqual [editor] expect(pane2.items).toEqual [] - describe "when the 'split' option is 'right'", -> - it "activates the editor on the existing right pane", -> - pane1 = workspace.activePane - pane2 = pane1.splitRight() - pane1.activate() - - editor = null + # Focus right pane and reopen the file on the left waitsForPromise -> + pane2.focus() + workspace.open('a', split: 'left').then (o) -> editor = o + + runs -> + expect(workspace.activePane).toBe pane1 + expect(pane1.items).toEqual [editor] + expect(pane2.items).toEqual [] + + describe "when the 'split' option is 'right'", -> + it "opens the editor in the rightmost pane of the current pane axis", -> + editor = null + pane1 = workspace.activePane + pane2 = null + waitsForPromise -> + workspace.open('a', split: 'right').then (o) -> editor = o + + runs -> + pane2 = workspace.getPanes().filter((p) -> p != pane1)[0] + expect(workspace.activePane).toBe pane2 + expect(pane1.items).toEqual [] + expect(pane2.items).toEqual [editor] + + # Focus right pane and reopen the file on the right + waitsForPromise -> + pane1.focus() workspace.open('a', split: 'right').then (o) -> editor = o runs -> expect(workspace.activePane).toBe pane2 - expect(pane2.items).toEqual [editor] expect(pane1.items).toEqual [] - - it "splits the current pane if the right pane doesn't exist", -> - pane1 = workspace.activePane - - editor = null - waitsForPromise -> - workspace.open('a', split: 'right').then (o) -> editor = o - - runs -> - pane2 = workspace.activePane - expect(workspace.paneContainer.root.children).toEqual [pane1, pane2] expect(pane2.items).toEqual [editor] - expect(pane1.items).toEqual [] describe "::openSync(uri, options)", -> [activePane, initialItemCount] = [] From 36427dae9f5bfb399034865a185e4865312970b3 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 4 Feb 2014 13:06:47 -0800 Subject: [PATCH 06/96] Add toHaveFocus jasmine expectation --- spec/spec-helper.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index c93dcf4fd..e1610748c 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -159,6 +159,17 @@ addCustomMatchers = (spec) -> @message = -> return "Expected path '" + @actual + "'" + notText + " to exist." fs.existsSync(@actual) + toHaveFocus: -> + notText = this.isNot and " not" or "" + if not document.hasFocus() + console.error "Specs will fail because the Dev Tools have focus. To fix this close the Dev Tools or click the spec runner." + + @message = -> return "Expected element '" + @actual + "' or its descendants" + notText + " to have focus." + element = @actual + element = element.get(0) if element.jquery + element.webkitMatchesSelector(":focus") or element.querySelector(":focus") + + window.keyIdentifierForKey = (key) -> if key.length > 1 # named key key From 6b88ce8d19b2a378d50a2746d85ded3e4a90c082 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 4 Feb 2014 15:26:02 -0800 Subject: [PATCH 07/96] Replace getActivePane with getActivePaneView --- src/workspace-view.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 908f25a9d..85837fd95 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -225,9 +225,13 @@ class WorkspaceView extends View @horizontal.append(element) # Public: Returns the currently focused {PaneView}. - getActivePane: -> + getActivePaneView: -> @panes.getActivePane() + # Deprecated: Returns the currently focused {PaneView}. + getActivePane: -> + @getActivePaneView() + # Public: Returns the currently focused item from within the focused {PaneView} getActivePaneItem: -> @model.activePaneItem From f10e55b4d5151a7cb5a3185849f5a4a2e5fe3579 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 5 Feb 2014 14:46:49 -0800 Subject: [PATCH 08/96] Remove deferred package deserializers --- docs/advanced/serialization.md | 24 ------------------ spec/atom-spec.coffee | 25 ++++++------------- .../package.cson | 1 - src/atom-package.coffee | 12 +-------- src/deserializer-manager.coffee | 9 ------- 5 files changed, 8 insertions(+), 63 deletions(-) diff --git a/docs/advanced/serialization.md b/docs/advanced/serialization.md index ce1d7a78e..282d9e358 100644 --- a/docs/advanced/serialization.md +++ b/docs/advanced/serialization.md @@ -71,27 +71,3 @@ will only attempt to call deserialize if the two versions match, and otherwise return undefined. We plan on implementing a migration system in the future, but this at least protects you from improperly deserializing old state. If you find yourself in dire need of the migration system, let us know. - -### Deferred Package Deserializers - -If your package defers loading on startup with an `activationEvents` property in -its `package.cson`, your deserializers won't be loaded until your package is -activated. If you want to deserialize an object from your package on startup, -this could be a problem. - -The solution is to also supply a `deferredDeserializers` array in your -`package.cson` with the names of all your deserializers. When Atom attempts to -deserialize some state whose `deserializer` matches one of these names, it will -load your package first so it can register any necessary deserializers before -proceeding. - -For example, the markdown preview package doesn't fully load until a preview is -triggered. But if you refresh a window with a preview pane, it loads the -markdown package early so Atom can deserialize the view correctly. - -```coffee-script -# markdown-preview/package.cson -'activationEvents': 'markdown-preview:toggle': '.editor' -'deferredDeserializers': ['MarkdownPreviewView'] -... -``` diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 24b646b95..6a3becd99 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -9,25 +9,14 @@ describe "the `atom` global", -> describe "package lifecycle methods", -> describe ".loadPackage(name)", -> - describe "when the package has deferred deserializers", -> - it "requires the package's main module if one of its deferred deserializers is referenced", -> - pack = atom.packages.loadPackage('package-with-activation-events') - spyOn(pack, 'activateStylesheets').andCallThrough() - expect(pack.mainModule).toBeNull() - object = atom.deserializers.deserialize({deserializer: 'Foo', data: 5}) - expect(pack.mainModule).toBeDefined() - expect(object.constructor.name).toBe 'Foo' - expect(object.data).toBe 5 - expect(pack.activateStylesheets).toHaveBeenCalled() + it "continues if the package has an invalid package.json", -> + spyOn(console, 'warn') + atom.config.set("core.disabledPackages", []) + expect(-> atom.packages.loadPackage("package-with-broken-package-json")).not.toThrow() - it "continues if the package has an invalid package.json", -> - spyOn(console, 'warn') - atom.config.set("core.disabledPackages", []) - expect(-> atom.packages.loadPackage("package-with-broken-package-json")).not.toThrow() - - it "continues if the package has an invalid keymap", -> - atom.config.set("core.disabledPackages", []) - expect(-> atom.packages.loadPackage("package-with-broken-keymap")).not.toThrow() + it "continues if the package has an invalid keymap", -> + atom.config.set("core.disabledPackages", []) + expect(-> atom.packages.loadPackage("package-with-broken-keymap")).not.toThrow() describe ".unloadPackage(name)", -> describe "when the package is active", -> diff --git a/spec/fixtures/packages/package-with-activation-events/package.cson b/spec/fixtures/packages/package-with-activation-events/package.cson index 45d8dfea1..dfa55c54d 100644 --- a/spec/fixtures/packages/package-with-activation-events/package.cson +++ b/spec/fixtures/packages/package-with-activation-events/package.cson @@ -1,2 +1 @@ 'activationEvents': ['activation-event'] -'deferredDeserializers': ['Foo'] diff --git a/src/atom-package.coffee b/src/atom-package.coffee index 6546945bb..955274d05 100644 --- a/src/atom-package.coffee +++ b/src/atom-package.coffee @@ -42,11 +42,7 @@ class AtomPackage extends Package @loadStylesheets() @loadGrammars() @loadScopedProperties() - - if @metadata.activationEvents? - @registerDeferredDeserializers() - else - @requireMainModule() + @requireMainModule() unless @metadata.activationEvents? catch e console.warn "Failed to load package named '#{@name}'", e.stack ? e @@ -203,12 +199,6 @@ class AtomPackage extends Package path.join(@path, 'index') @mainModulePath = fs.resolveExtension(mainModulePath, ["", _.keys(require.extensions)...]) - registerDeferredDeserializers: -> - for deserializerName in @metadata.deferredDeserializers ? [] - atom.deserializers.addDeferred deserializerName, => - @activateStylesheets() - @requireMainModule() - subscribeToActivationEvents: -> return unless @metadata.activationEvents? if _.isArray(@metadata.activationEvents) diff --git a/src/deserializer-manager.coffee b/src/deserializer-manager.coffee index 60df24b0a..2266845d6 100644 --- a/src/deserializer-manager.coffee +++ b/src/deserializer-manager.coffee @@ -5,16 +5,11 @@ module.exports = class DeserializerManager constructor: (@environment) -> @deserializers = {} - @deferredDeserializers = {} # Public: Register the given class(es) as deserializers. add: (klasses...) -> @deserializers[klass.name] = klass for klass in klasses - # Public: Add a deferred deserializer for the given class name. - addDeferred: (name, fn) -> - @deferredDeserializers[name] = fn - # Public: Remove the given class(es) as deserializers. remove: (klasses...) -> delete @deserializers[klass.name] for klass in klasses @@ -35,8 +30,4 @@ class DeserializerManager return unless state? name = state.get?('deserializer') ? state.deserializer - if @deferredDeserializers[name] - @deferredDeserializers[name]() - delete @deferredDeserializers[name] - @deserializers[name] From 44c4bc84341abb248a433c308ea16718f83cb320 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:12:02 -0800 Subject: [PATCH 09/96] Upgrade to whitespace@0.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a0538ee8..cf0110f8a 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "update-package-dependencies": "0.2.0", "visual-bell": "0.6.0", "welcome": "0.4.0", - "whitespace": "0.11.0", + "whitespace": "0.12.0", "wrap-guide": "0.14.0", "language-c": "0.4.0", "language-clojure": "0.1.0", From ca49ac173010e7f34eccc29f141c85e1ac854264 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:13:43 -0800 Subject: [PATCH 10/96] Upgrade to visual-bell@0.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf0110f8a..8708735e4 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "to-the-hubs": "0.19.0", "tree-view": "0.69.0", "update-package-dependencies": "0.2.0", - "visual-bell": "0.6.0", + "visual-bell": "0.7.0", "welcome": "0.4.0", "whitespace": "0.12.0", "wrap-guide": "0.14.0", From 508636c06e2bfa7de9d5668d99a4c29a922f9251 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:14:10 -0800 Subject: [PATCH 11/96] Upgrade to update-package-dependencies@0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8708735e4..e62628925 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "timecop": "0.13.0", "to-the-hubs": "0.19.0", "tree-view": "0.69.0", - "update-package-dependencies": "0.2.0", + "update-package-dependencies": "0.3.0", "visual-bell": "0.7.0", "welcome": "0.4.0", "whitespace": "0.12.0", From e8c0793874dee447c8fa8354cf9aedef95ef1d67 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:16:53 -0800 Subject: [PATCH 12/96] Upgrade to spell-check@0.24.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e62628925..326bdb98b 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "release-notes": "0.18.0", "settings-view": "0.71.0", "snippets": "0.27.0", - "spell-check": "0.23.0", + "spell-check": "0.24.0", "status-bar": "0.32.0", "styleguide": "0.23.0", "symbols-view": "0.33.0", From b6576545ba60708840ae05dd01d62a4b51a1ece2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:20:56 -0800 Subject: [PATCH 13/96] Upgrade to release-notes@0.20.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 326bdb98b..7082a64c7 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "markdown-preview": "0.25.1", "metrics": "0.26.0", "package-generator": "0.26.0", - "release-notes": "0.18.0", + "release-notes": "0.20.0", "settings-view": "0.71.0", "snippets": "0.27.0", "spell-check": "0.24.0", From a229c28e627718654d057bd65b370f27f86f324e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:30:58 -0800 Subject: [PATCH 14/96] Upgrade to language-toml@0.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7082a64c7..e0015fdac 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "language-sql": "0.3.0", "language-text": "0.3.0", "language-todo": "0.3.0", - "language-toml": "0.7.0", + "language-toml": "0.8.0", "language-xml": "0.3.0", "language-yaml": "0.2.0" }, From 72f2824588cc39030bbfbe19f436bb6732f1cbc3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:32:01 -0800 Subject: [PATCH 15/96] Upgrade to language-gfm@0.15.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0015fdac..1e40accfc 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "language-clojure": "0.1.0", "language-coffee-script": "0.7.0", "language-css": "0.3.0", - "language-gfm": "0.14.0", + "language-gfm": "0.15.0", "language-git": "0.4.0", "language-go": "0.3.0", "language-html": "0.3.0", From 2d16d3a459eacde8d66fa68da46f96664740e4d4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:33:58 -0800 Subject: [PATCH 16/96] Upgrade to keybinding-resolve@0.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e40accfc..7528e370b 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "go-to-line": "0.16.0", "grammar-selector": "0.19.0", "image-view": "0.19.0", - "keybinding-resolver": "0.9.0", + "keybinding-resolver": "0.10.0", "link": "0.17.0", "markdown-preview": "0.25.1", "metrics": "0.26.0", From b49bd6fd106a0eb3e3f0f02195b44fffbadb042f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 15:36:50 -0800 Subject: [PATCH 17/96] Upgrade to github-sign-in@0.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7528e370b..8aa19b53e 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "fuzzy-finder": "0.34.0", "gists": "0.17.0", "git-diff": "0.24.0", - "github-sign-in": "0.18.0", + "github-sign-in": "0.19.0", "go-to-line": "0.16.0", "grammar-selector": "0.19.0", "image-view": "0.19.0", From 3592ec19df9e4a88668494340f49dbfe59317cdf Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:16:47 -0800 Subject: [PATCH 18/96] Don't use activation events on fixture package with serialization error --- .../packages/package-with-serialize-error/package.cson | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/fixtures/packages/package-with-serialize-error/package.cson b/spec/fixtures/packages/package-with-serialize-error/package.cson index d49a175ed..300ce2fc0 100644 --- a/spec/fixtures/packages/package-with-serialize-error/package.cson +++ b/spec/fixtures/packages/package-with-serialize-error/package.cson @@ -1,5 +1 @@ -# This package loads async, otherwise it would log errors when it -# is automatically serialized when workspaceView is deactivatated - 'main': 'index.coffee' -'activationEvents': ['activation-event'] From 13e435a4f965e26e7124ba286bfdc1d832215627 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:16:58 -0800 Subject: [PATCH 19/96] Update Atom Spec --- spec/atom-spec.coffee | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 9e37e2ac6..68d9f2b29 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -355,12 +355,18 @@ describe "the `atom` global", -> it "absorbs exceptions that are thrown by the package module's serialize methods", -> spyOn(console, 'error') - atom.packages.activatePackage('package-with-serialize-error', immediate: true) - atom.packages.activatePackage('package-with-serialization', immediate: true) - atom.packages.deactivatePackages() - expect(atom.packages.packageStates['package-with-serialize-error']).toBeUndefined() - expect(atom.packages.packageStates['package-with-serialization']).toEqual someNumber: 1 - expect(console.error).toHaveBeenCalled() + + waitsForPromise -> + atom.packages.activatePackage('package-with-serialize-error') + + waitsForPromise -> + atom.packages.activatePackage('package-with-serialization') + + runs -> + atom.packages.deactivatePackages() + expect(atom.packages.packageStates['package-with-serialize-error']).toBeUndefined() + expect(atom.packages.packageStates['package-with-serialization']).toEqual someNumber: 1 + expect(console.error).toHaveBeenCalled() it "removes the package's grammars", -> waitsForPromise -> @@ -405,15 +411,22 @@ describe "the `atom` global", -> describe "textmate packages", -> it "removes the package's grammars", -> expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar" - atom.packages.activatePackage('language-ruby', sync: true) - expect(atom.syntax.selectGrammar("file.rb").name).toBe "Ruby" - atom.packages.deactivatePackage('language-ruby') - expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar" + + waitsForPromise -> + atom.packages.activatePackage('language-ruby') + + runs -> + expect(atom.syntax.selectGrammar("file.rb").name).toBe "Ruby" + atom.packages.deactivatePackage('language-ruby') + expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar" it "removes the package's scoped properties", -> - atom.packages.activatePackage('language-ruby', sync: true) - atom.packages.deactivatePackage('language-ruby') - expect(atom.syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined() + waitsForPromise -> + atom.packages.activatePackage('language-ruby') + + runs -> + atom.packages.deactivatePackage('language-ruby') + expect(atom.syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined() describe ".activate()", -> packageActivator = null From e01be5d41a77dbee0530add9ba8ecaecdf2ea1cb Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:18:59 -0800 Subject: [PATCH 20/96] Update display buffer spec --- spec/display-buffer-spec.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index e85a05049..6e13ee8f4 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -5,12 +5,15 @@ describe "DisplayBuffer", -> [displayBuffer, buffer, changeHandler, tabLength] = [] beforeEach -> tabLength = 2 - atom.packages.activatePackage('language-javascript', sync: true) + buffer = atom.project.bufferForPathSync('sample.js') displayBuffer = new DisplayBuffer({buffer, tabLength}) changeHandler = jasmine.createSpy 'changeHandler' displayBuffer.on 'changed', changeHandler + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + afterEach -> displayBuffer.destroy() buffer.release() From 1f3ea7637966611553c279a53538ad331ec3c716 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:22:00 -0800 Subject: [PATCH 21/96] Update Editor spec --- spec/editor-spec.coffee | 52 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 8d5e05d9a..821299f8c 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -16,11 +16,13 @@ describe "Editor", -> describe "with default options", -> beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) editor = atom.project.openSync('sample.js', autoIndent: false) buffer = editor.buffer lineLengths = buffer.getLines().map (line) -> line.length + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + describe "when the editor is deserialized", -> it "restores selections and folds based on markers in the buffer", -> editor.setSelectedBufferRange([[1, 2], [3, 4]]) @@ -2733,19 +2735,26 @@ describe "Editor", -> describe "when the editor's grammar has an injection selector", -> beforeEach -> - atom.packages.activatePackage('language-text', sync: true) - atom.packages.activatePackage('language-javascript', sync: true) + + waitsForPromise -> + atom.packages.activatePackage('language-text') + + waitsForPromise -> + atom.packages.activatePackage('language-javascript') it "includes the grammar's patterns when the selector matches the current scope in other grammars", -> - atom.packages.activatePackage('language-hyperlink', sync: true) - grammar = atom.syntax.selectGrammar("text.js") - {tokens} = grammar.tokenizeLine("var i; // http://github.com") + waitsForPromise -> + atom.packages.activatePackage('language-hyperlink') - expect(tokens[0].value).toBe "var" - expect(tokens[0].scopes).toEqual ["source.js", "storage.modifier.js"] + runs -> + grammar = atom.syntax.selectGrammar("text.js") + {tokens} = grammar.tokenizeLine("var i; // http://github.com") - expect(tokens[6].value).toBe "http://github.com" - expect(tokens[6].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"] + expect(tokens[0].value).toBe "var" + expect(tokens[0].scopes).toEqual ["source.js", "storage.modifier.js"] + + expect(tokens[6].value).toBe "http://github.com" + expect(tokens[6].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"] describe "when the grammar is added", -> it "retokenizes existing buffers that contain tokens that match the injection selector", -> @@ -2756,11 +2765,13 @@ describe "Editor", -> expect(tokens[1].value).toBe " http://github.com" expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"] - atom.packages.activatePackage('language-hyperlink', sync: true) + waitsForPromise -> + atom.packages.activatePackage('language-hyperlink') - {tokens} = editor.lineForScreenRow(0) - expect(tokens[2].value).toBe "http://github.com" - expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"] + runs -> + {tokens} = editor.lineForScreenRow(0) + expect(tokens[2].value).toBe "http://github.com" + expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"] describe "when the grammar is updated", -> it "retokenizes existing buffers that contain tokens that match the injection selector", -> @@ -2771,14 +2782,17 @@ describe "Editor", -> expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS" expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"] - atom.packages.activatePackage('package-with-injection-selector', sync: true) + + atom.packages.activatePackage('package-with-injection-selector') {tokens} = editor.lineForScreenRow(0) expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS" expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"] - atom.packages.activatePackage('language-sql', sync: true) + waitsForPromise -> + atom.packages.activatePackage('language-sql') - {tokens} = editor.lineForScreenRow(0) - expect(tokens[2].value).toBe "SELECT" - expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "keyword.other.DML.sql"] + runs -> + {tokens} = editor.lineForScreenRow(0) + expect(tokens[2].value).toBe "SELECT" + expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "keyword.other.DML.sql"] From 1d4cab404da78c69aec73dfa1721f9d86f0087fb Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:39:20 -0800 Subject: [PATCH 22/96] Fix specs for Editor View --- spec/editor-view-spec.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index b63079d11..7542bd059 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -10,8 +10,6 @@ describe "EditorView", -> [buffer, editorView, editor, cachedLineHeight, cachedCharWidth] = [] beforeEach -> - atom.packages.activatePackage('language-text', sync: true) - atom.packages.activatePackage('language-javascript', sync: true) editor = atom.project.openSync('sample.js') buffer = editor.buffer editorView = new EditorView(editor) @@ -26,6 +24,12 @@ describe "EditorView", -> @width(getCharWidth() * widthInChars) if widthInChars $('#jasmine-content').append(this) + waitsForPromise -> + atom.packages.activatePackage('language-text', sync: true) + + waitsForPromise -> + atom.packages.activatePackage('language-javascript', sync: true) + getLineHeight = -> return cachedLineHeight if cachedLineHeight? calcDimensions() From 8df791c9499383d5627dbd5e6b8edb155d5b8dca Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:47:28 -0800 Subject: [PATCH 23/96] Fix specs for Language Mode --- spec/language-mode-spec.coffee | 36 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index 2f7b1cc91..1303f9a75 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -1,4 +1,4 @@ -describe "LanguageMode", -> +fdescribe "LanguageMode", -> [editor, buffer, languageMode] = [] afterEach -> @@ -6,10 +6,12 @@ describe "LanguageMode", -> describe "javascript", -> beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) editor = atom.project.openSync('sample.js', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + describe ".minIndentLevelForRowRange(startRow, endRow)", -> it "returns the minimum indent level for the given row range", -> expect(languageMode.minIndentLevelForRowRange(4, 7)).toBe 2 @@ -100,10 +102,12 @@ describe "LanguageMode", -> describe "coffeescript", -> beforeEach -> - atom.packages.activatePackage('language-coffee-script', sync: true) editor = atom.project.openSync('coffee.coffee', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-coffee-script') + describe ".toggleLineCommentsForBufferRows(start, end)", -> it "comments/uncomments lines in the given range", -> languageMode.toggleLineCommentsForBufferRows(4, 6) @@ -147,10 +151,12 @@ describe "LanguageMode", -> describe "css", -> beforeEach -> - atom.packages.activatePackage('language-css', sync: true) editor = atom.project.openSync('css.css', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-css') + describe ".toggleLineCommentsForBufferRows(start, end)", -> it "comments/uncomments lines in the given range", -> languageMode.toggleLineCommentsForBufferRows(0, 1) @@ -188,11 +194,15 @@ describe "LanguageMode", -> describe "less", -> beforeEach -> - atom.packages.activatePackage('language-less', sync: true) - atom.packages.activatePackage('language-css', sync: true) editor = atom.project.openSync('sample.less', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-less') + + waitsForPromise -> + atom.packages.activatePackage('language-css') + describe "when commenting lines", -> it "only uses the `commentEnd` pattern if it comes from the same grammar as the `commentStart`", -> languageMode.toggleLineCommentsForBufferRows(0, 0) @@ -200,10 +210,12 @@ describe "LanguageMode", -> describe "folding", -> beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) editor = atom.project.openSync('sample.js', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + it "maintains cursor buffer position when a folding/unfolding", -> editor.setCursorBufferPosition([5,5]) languageMode.foldAll() @@ -298,10 +310,12 @@ describe "LanguageMode", -> describe "folding with comments", -> beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) editor = atom.project.openSync('sample-with-comments.js', autoIndent: false) {buffer, languageMode} = editor + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + describe ".unfoldAll()", -> it "unfolds every folded line", -> initialScreenLineCount = editor.getScreenLineCount() @@ -362,10 +376,12 @@ describe "LanguageMode", -> describe "css", -> beforeEach -> - atom.packages.activatePackage('language-source', sync: true) - atom.packages.activatePackage('language-css', sync: true) editor = atom.project.openSync('css.css', autoIndent: true) + waitsForPromise -> + atom.packages.activatePackage('language-source') + atom.packages.activatePackage('language-css') + describe "suggestedIndentForBufferRow", -> it "does not return negative values (regression)", -> editor.setText('.test {\npadding: 0;\n}') From d2abbb3681f56e88dd0d5d9d36edfcd2810af989 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:47:40 -0800 Subject: [PATCH 24/96] Fix specs for Syntax --- spec/syntax-spec.coffee | 48 +++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/spec/syntax-spec.coffee b/spec/syntax-spec.coffee index 92373c53d..407194d76 100644 --- a/spec/syntax-spec.coffee +++ b/spec/syntax-spec.coffee @@ -2,12 +2,20 @@ path = require 'path' temp = require 'temp' -describe "the `syntax` global", -> +fdescribe "the `syntax` global", -> beforeEach -> - atom.packages.activatePackage('language-text', sync: true) - atom.packages.activatePackage('language-javascript', sync: true) - atom.packages.activatePackage('language-coffee-script', sync: true) - atom.packages.activatePackage('language-ruby', sync: true) + + waitsForPromise -> + atom.packages.activatePackage('language-text') + + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + + waitsForPromise -> + atom.packages.activatePackage('language-coffee-script') + + waitsForPromise -> + atom.packages.activatePackage('language-ruby') describe "serialization", -> it "remembers grammar overrides by path", -> @@ -20,29 +28,33 @@ describe "the `syntax` global", -> describe ".selectGrammar(filePath)", -> it "can use the filePath to load the correct grammar based on the grammar's filetype", -> - atom.packages.activatePackage('language-git', sync: true) + waitsForPromise -> + atom.packages.activatePackage('language-git') - expect(atom.syntax.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js) - expect(atom.syntax.selectGrammar(path.join(temp.dir, '.git', 'config')).name).toBe "Git Config" # based on end of the path (.git/config) - expect(atom.syntax.selectGrammar("Rakefile").name).toBe "Ruby" # based on the file's basename (Rakefile) - expect(atom.syntax.selectGrammar("curb").name).toBe "Null Grammar" - expect(atom.syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar" + runs -> + expect(atom.syntax.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js) + expect(atom.syntax.selectGrammar(path.join(temp.dir, '.git', 'config')).name).toBe "Git Config" # based on end of the path (.git/config) + expect(atom.syntax.selectGrammar("Rakefile").name).toBe "Ruby" # based on the file's basename (Rakefile) + expect(atom.syntax.selectGrammar("curb").name).toBe "Null Grammar" + expect(atom.syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar" it "uses the filePath's shebang line if the grammar cannot be determined by the extension or basename", -> filePath = require.resolve("./fixtures/shebang") expect(atom.syntax.selectGrammar(filePath).name).toBe "Ruby" it "uses the number of newlines in the first line regex to determine the number of lines to test against", -> - atom.packages.activatePackage('language-property-list', sync: true) + waitsForPromise -> + atom.packages.activatePackage('language-property-list') - fileContent = "first-line\n" - expect(atom.syntax.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript" + runs -> + fileContent = "first-line\n" + expect(atom.syntax.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript" - fileContent = '' - expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Null Grammar" + fileContent = '' + expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Null Grammar" - fileContent += '\n' - expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)" + fileContent += '\n' + expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)" it "doesn't read the file when the file contents are specified", -> filePath = require.resolve("./fixtures/shebang") From c189dc22d7f48367c97d18e84de2d22cc4f570c6 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:48:06 -0800 Subject: [PATCH 25/96] Remove focused specs --- spec/language-mode-spec.coffee | 2 +- spec/syntax-spec.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index 1303f9a75..a72470704 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -1,4 +1,4 @@ -fdescribe "LanguageMode", -> +describe "LanguageMode", -> [editor, buffer, languageMode] = [] afterEach -> diff --git a/spec/syntax-spec.coffee b/spec/syntax-spec.coffee index 407194d76..c39d12152 100644 --- a/spec/syntax-spec.coffee +++ b/spec/syntax-spec.coffee @@ -2,7 +2,7 @@ path = require 'path' temp = require 'temp' -fdescribe "the `syntax` global", -> +describe "the `syntax` global", -> beforeEach -> waitsForPromise -> From 5b6e0b769d966ccc7de9279ab4d42ff7dd1877b9 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:50:01 -0800 Subject: [PATCH 26/96] Fix specs for Tokenized Buffer --- spec/tokenized-buffer-spec.coffee | 68 +++++++++++++++++++------------ 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index a9df78a56..2fad95256 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -5,11 +5,13 @@ describe "TokenizedBuffer", -> [tokenizedBuffer, buffer, changeHandler] = [] beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) # enable async tokenization TokenizedBuffer.prototype.chunkSize = 5 jasmine.unspy(TokenizedBuffer.prototype, 'tokenizeInBackground') + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + startTokenizing = (tokenizedBuffer) -> tokenizedBuffer.setVisible(true) @@ -311,10 +313,13 @@ describe "TokenizedBuffer", -> describe "when the buffer contains hard-tabs", -> beforeEach -> - atom.packages.activatePackage('language-coffee-script', sync: true) - buffer = atom.project.bufferForPathSync('sample-with-tabs.coffee') - tokenizedBuffer = new TokenizedBuffer({buffer}) - startTokenizing(tokenizedBuffer) + waitsForPromise -> + atom.packages.activatePackage('language-coffee-script') + + runs -> + buffer = atom.project.bufferForPathSync('sample-with-tabs.coffee') + tokenizedBuffer = new TokenizedBuffer({buffer}) + startTokenizing(tokenizedBuffer) afterEach -> tokenizedBuffer.destroy() @@ -341,14 +346,17 @@ describe "TokenizedBuffer", -> describe "when the buffer contains surrogate pairs", -> beforeEach -> - atom.packages.activatePackage('language-javascript', sync: true) - buffer = atom.project.bufferForPathSync 'sample-with-pairs.js' - buffer.setText """ - 'abc\uD835\uDF97def' - //\uD835\uDF97xyz - """ - tokenizedBuffer = new TokenizedBuffer({buffer}) - fullyTokenize(tokenizedBuffer) + waitsForPromise -> + atom.packages.activatePackage('language-javascript') + + runs -> + buffer = atom.project.bufferForPathSync 'sample-with-pairs.js' + buffer.setText """ + 'abc\uD835\uDF97def' + //\uD835\uDF97xyz + """ + tokenizedBuffer = new TokenizedBuffer({buffer}) + fullyTokenize(tokenizedBuffer) afterEach -> tokenizedBuffer.destroy() @@ -379,22 +387,30 @@ describe "TokenizedBuffer", -> describe "when the grammar is updated because a grammar it includes is activated", -> it "retokenizes the buffer", -> - atom.packages.activatePackage('language-ruby-on-rails', sync: true) - atom.packages.activatePackage('language-ruby', sync: true) - buffer = atom.project.bufferForPathSync() - buffer.setText "
<%= User.find(2).full_name %>
" - tokenizedBuffer = new TokenizedBuffer({buffer}) - tokenizedBuffer.setGrammar(atom.syntax.selectGrammar('test.erb')) - fullyTokenize(tokenizedBuffer) + waitsForPromise -> + atom.packages.activatePackage('language-ruby-on-rails') - {tokens} = tokenizedBuffer.lineForScreenRow(0) - expect(tokens[0]).toEqual value: "
", scopes: ["text.html.ruby"] + waitsForPromise -> + atom.packages.activatePackage('language-ruby') - atom.packages.activatePackage('language-html', sync: true) - fullyTokenize(tokenizedBuffer) - {tokens} = tokenizedBuffer.lineForScreenRow(0) - expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"] + runs -> + buffer = atom.project.bufferForPathSync() + buffer.setText "
<%= User.find(2).full_name %>
" + tokenizedBuffer = new TokenizedBuffer({buffer}) + tokenizedBuffer.setGrammar(atom.syntax.selectGrammar('test.erb')) + fullyTokenize(tokenizedBuffer) + + {tokens} = tokenizedBuffer.lineForScreenRow(0) + expect(tokens[0]).toEqual value: "
", scopes: ["text.html.ruby"] + + waitsForPromise -> + atom.packages.activatePackage('language-html') + + runs -> + fullyTokenize(tokenizedBuffer) + {tokens} = tokenizedBuffer.lineForScreenRow(0) + expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"] describe ".tokenForPosition(position)", -> afterEach -> From 2a2858554ae4595304e146e08112cd159ab1bc14 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 15:50:50 -0800 Subject: [PATCH 27/96] Remove synchronous package loading shims --- src/atom-package.coffee | 15 --------------- src/package-manager.coffee | 15 ++------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/atom-package.coffee b/src/atom-package.coffee index b0a187a3a..b44b4233e 100644 --- a/src/atom-package.coffee +++ b/src/atom-package.coffee @@ -73,21 +73,6 @@ class AtomPackage extends Package @activationDeferred.promise - # Deprecated - activateSync: ({immediate}={}) -> - @activateResources() - if @metadata.activationEvents? and not immediate - @subscribeToActivationEvents() - else - try - @activateConfig() - @activateStylesheets() - if @requireMainModule() - @mainModule.activate(atom.packages.getPackageState(@name) ? {}) - @mainActivated = true - catch e - console.warn "Failed to activate package named '#{@name}'", e.stack - activateNow: -> try @activateConfig() diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 03052512f..52ea5fedc 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -81,26 +81,15 @@ class PackageManager @observeDisabledPackages() # Activate a single package by name - activatePackage: (name, options={}) -> - if options.sync? or options.immediate? - return @activatePackageSync(name, options) - + activatePackage: (name) -> if pack = @getActivePackage(name) Q(pack) else pack = @loadPackage(name) - pack.activate(options).then => + pack.activate().then => @activePackages[pack.name] = pack pack - # Deprecated - activatePackageSync: (name, options) -> - return pack if pack = @getActivePackage(name) - if pack = @loadPackage(name) - @activePackages[pack.name] = pack - pack.activateSync(options) - pack - # Deactivate all packages deactivatePackages: -> @deactivatePackage(pack.name) for pack in @getLoadedPackages() From 3951c4551997961dec84c9dab94a7c22fbe51e94 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 16:04:56 -0800 Subject: [PATCH 28/96] Update apm --- vendor/apm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/apm b/vendor/apm index ce140e662..0ed2a1ef7 160000 --- a/vendor/apm +++ b/vendor/apm @@ -1 +1 @@ -Subproject commit ce140e66283c07f5837dd999e75580f3757a249a +Subproject commit 0ed2a1ef753c65361314a5fb3934338d068e8821 From e4f6eb17a0b808be5584f17c98484405b09b9cc2 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 16:17:18 -0800 Subject: [PATCH 29/96] Upgrade to archive-view@0.22.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8aa19b53e..258d8ccce 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "base16-tomorrow-dark-theme": "0.11.0", "solarized-dark-syntax": "0.9.0", "solarized-light-syntax": "0.5.0", - "archive-view": "0.21.0", + "archive-view": "0.22.0", "autocomplete": "0.22.0", "autoflow": "0.13.0", "autosave": "0.10.0", From 7cccd5f9206034967c0baf06b52830795bd06df4 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 16:22:52 -0800 Subject: [PATCH 30/96] Upgrade to autoflow@0.14.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 258d8ccce..154bd17e3 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "solarized-light-syntax": "0.5.0", "archive-view": "0.22.0", "autocomplete": "0.22.0", - "autoflow": "0.13.0", + "autoflow": "0.14.0", "autosave": "0.10.0", "background-tips": "0.6.0", "bookmarks": "0.18.0", From abe630937ef7b56fd0a25865d41d2aa02eb18f32 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 16:26:03 -0800 Subject: [PATCH 31/96] Upgrade to bookmarks@0.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 154bd17e3..840de0dc4 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "autoflow": "0.14.0", "autosave": "0.10.0", "background-tips": "0.6.0", - "bookmarks": "0.18.0", + "bookmarks": "0.19.0", "bracket-matcher": "0.20.0", "command-logger": "0.11.0", "command-palette": "0.16.0", From 6f422ce56b78470721f36a7a401f0738058e4812 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 10 Feb 2014 16:32:41 -0800 Subject: [PATCH 32/96] Upgrade to autosave@0.11.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 840de0dc4..5fbee3a41 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "archive-view": "0.22.0", "autocomplete": "0.22.0", "autoflow": "0.14.0", - "autosave": "0.10.0", + "autosave": "0.11.0", "background-tips": "0.6.0", "bookmarks": "0.19.0", "bracket-matcher": "0.20.0", From b65004319137596f1e5860ee5642276b4db50380 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 16:33:12 -0800 Subject: [PATCH 33/96] Upgrade to background-tips@0.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fbee3a41..717306da0 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "autocomplete": "0.22.0", "autoflow": "0.14.0", "autosave": "0.11.0", - "background-tips": "0.6.0", + "background-tips": "0.7.0", "bookmarks": "0.19.0", "bracket-matcher": "0.20.0", "command-logger": "0.11.0", From 1645efa2ced3390f64843bfc90c211f43aaa81b8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 14:16:19 -0800 Subject: [PATCH 34/96] Clear conflict when the buffer is saved --- spec/text-buffer-spec.coffee | 17 +++++++++++++++++ src/text-buffer.coffee | 1 + 2 files changed, 18 insertions(+) diff --git a/spec/text-buffer-spec.coffee b/spec/text-buffer-spec.coffee index 7f26c663b..70e1a773f 100644 --- a/spec/text-buffer-spec.coffee +++ b/spec/text-buffer-spec.coffee @@ -571,6 +571,23 @@ describe 'TextBuffer', -> saveBuffer.reload() expect(events).toEqual ['will-reload', 'reloaded'] + it "no longer reports being in conflict", -> + saveBuffer.setText('a') + saveBuffer.save() + saveBuffer.setText('ab') + + fs.writeFileSync(saveBuffer.getPath(), 'c') + conflictHandler = jasmine.createSpy('conflictHandler') + saveBuffer.on 'contents-conflicted', conflictHandler + + waitsFor -> + conflictHandler.callCount > 0 + + runs -> + expect(saveBuffer.isInConflict()).toBe true + saveBuffer.save() + expect(saveBuffer.isInConflict()).toBe false + describe "when the buffer has no path", -> it "throws an exception", -> saveBuffer = atom.project.bufferForPathSync(null) diff --git a/src/text-buffer.coffee b/src/text-buffer.coffee index 044f89946..f34f657ae 100644 --- a/src/text-buffer.coffee +++ b/src/text-buffer.coffee @@ -196,6 +196,7 @@ class TextBuffer extends TextBufferCore @setPath(path) @cachedDiskContents = @getText() @file.write(@getText()) + @conflict = false @emitModifiedStatusChanged(false) @emit 'saved', this From 1436b8eb5e71dd2456faa36b59ebc67c198b0427 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 14:18:42 -0800 Subject: [PATCH 35/96] Rename path variables to filePath --- src/text-buffer.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/text-buffer.coffee b/src/text-buffer.coffee index f34f657ae..552e44137 100644 --- a/src/text-buffer.coffee +++ b/src/text-buffer.coffee @@ -165,14 +165,14 @@ class TextBuffer extends TextBufferCore # Sets the path for the file. # - # path - A {String} representing the new file path - setPath: (path) -> - return if path == @getPath() + # filePath - A {String} representing the new file path + setPath: (filePath) -> + return if filePath == @getPath() @file?.off() - if path - @file = new File(path) + if filePath + @file = new File(filePath) @subscribeToFile() else @file = null @@ -188,12 +188,12 @@ class TextBuffer extends TextBufferCore # Saves the buffer at a specific path. # - # path - The path to save at. - saveAs: (path) -> - unless path then throw new Error("Can't save buffer with no file path") + # filePath - The path to save at. + saveAs: (filePath) -> + unless filePath then throw new Error("Can't save buffer with no file path") @emit 'will-be-saved', this - @setPath(path) + @setPath(filePath) @cachedDiskContents = @getText() @file.write(@getText()) @conflict = false From d9ddf516f8750fb7979356de81ca7019529e771d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 14:21:55 -0800 Subject: [PATCH 36/96] :memo: Clarify TextBuffer::isInConflict --- src/text-buffer.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/text-buffer.coffee b/src/text-buffer.coffee index 552e44137..2adc613c0 100644 --- a/src/text-buffer.coffee +++ b/src/text-buffer.coffee @@ -213,7 +213,10 @@ class TextBuffer extends TextBufferCore else not @isEmpty() - # Identifies if a buffer is in a git conflict with `HEAD`. + # Is the buffer's text in conflict with the text on disk? + # + # This occurs when the buffer's file changes on disk while the buffer has + # unsaved changes. # # Returns a {Boolean}. isInConflict: -> @conflict From af1f57048b0fba52ef0776a81e68ccd12fd3c166 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 08:55:45 -0800 Subject: [PATCH 37/96] Add Pane::getActiveItem --- src/pane.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pane.coffee b/src/pane.coffee index a3d2be56c..652b05f5f 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -85,6 +85,12 @@ class Pane extends Model getItems: -> @items.slice() + # Public: Get the active pane item in this pane. + # + # Returns a pane item. + getActiveItem: -> + @activeItem + # Public: Returns the item at the specified index. itemAtIndex: (index) -> @items[index] From 51fbb1be0789c4707a6cca73af9430c26a92a1e0 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 08:55:45 -0800 Subject: [PATCH 38/96] Add Pane::getActiveItem --- src/pane-view.coffee | 2 +- src/pane.coffee | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pane-view.coffee b/src/pane-view.coffee index 111e52510..09cc2a62b 100644 --- a/src/pane-view.coffee +++ b/src/pane-view.coffee @@ -27,7 +27,7 @@ class PaneView extends View 'destroyItem', 'destroyItems', 'destroyActiveItem', 'destroyInactiveItems', 'saveActiveItem', 'saveActiveItemAs', 'saveItem', 'saveItemAs', 'saveItems', 'itemForUri', 'activateItemForUri', 'promptToSaveItem', 'copyActiveItem', 'isActive', - 'activate', toProperty: 'model' + 'activate', 'getActiveItem', toProperty: 'model' previousActiveItem: null diff --git a/src/pane.coffee b/src/pane.coffee index a3d2be56c..652b05f5f 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -85,6 +85,12 @@ class Pane extends Model getItems: -> @items.slice() + # Public: Get the active pane item in this pane. + # + # Returns a pane item. + getActiveItem: -> + @activeItem + # Public: Returns the item at the specified index. itemAtIndex: (index) -> @items[index] From 05769f8a49abda563726710aedf8b3ae7d455fc0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 16:44:35 -0800 Subject: [PATCH 39/96] :lipstick: One property per line --- static/jasmine.less | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/jasmine.less b/static/jasmine.less index 7c2084807..caf7ae509 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -20,8 +20,17 @@ body { list-style: none; } -#HTMLReporter { font-size: 11px; font-family: Monaco, Consolas, monospace; line-height: 1.6em; color: #333333; } -#HTMLReporter #jasmine_content { position: fixed; right: 100%; } +#HTMLReporter { + font-size: 11px; + font-family: Monaco, Consolas, monospace; + line-height: 1.6em; + color: #333333; +} + +#HTMLReporter #jasmine_content { + position: fixed; + right: 100%; +} #HTMLReporter .symbolHeader { background-color: #222; From cf73dd467a712b82534eee7d5f328d181a4155e1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 16:48:29 -0800 Subject: [PATCH 40/96] Pad stack traces --- spec/atom-reporter.coffee | 4 ++-- static/jasmine.less | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index b542e20e5..aef8c325c 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -16,7 +16,7 @@ formatStackTrace = (stackTrace) -> module.exports = class AtomReporter extends View @content: -> - @div id: 'HTMLReporter', class: 'jasmine_reporter', => + @div id: 'HTMLReporter', class: 'jasmine_reporter spec-reporter', => @div outlet: 'specPopup', class: "spec-popup" @div outlet: "suites" @div outlet: 'coreArea', => @@ -218,7 +218,7 @@ class SpecResultView extends View stackTrace = formatStackTrace(result.trace.stack) @specFailures.append $$ -> @div result.message, class: 'resultMessage fail' - @div stackTrace, class: 'stackTrace' if stackTrace + @div stackTrace, class: 'stack-trace padded' if stackTrace attach: -> @parentSuiteView().append this diff --git a/static/jasmine.less b/static/jasmine.less index caf7ae509..58bc7be40 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -166,15 +166,16 @@ body { font-size: 15px } -#HTMLReporter .stackTrace { - font-size: 12px; - padding: 5px; - margin: 5px 0 0 0; - border-radius: 2px; - line-height: 18px; - color: #666666; - border: 1px solid #ddd; - background: white; - white-space: pre; - overflow: auto; +.spec-reporter { + .stack-trace { + font-size: 12px; + margin: 5px 0 0 0; + border-radius: 2px; + line-height: 18px; + color: #666666; + border: 1px solid #ddd; + background: white; + white-space: pre; + overflow: auto; + } } From ecf4dbefe3efaf948599222149aa75915fd8f1af Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 16:59:30 -0800 Subject: [PATCH 41/96] Sanitize duplicate error and [object Object]. lines --- spec/atom-reporter.coffee | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index aef8c325c..2f67505a7 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -3,7 +3,7 @@ _ = require 'underscore-plus' {convertStackTrace} = require 'coffeestack' sourceMaps = {} -formatStackTrace = (stackTrace) -> +formatStackTrace = (message='', stackTrace) -> return stackTrace unless stackTrace jasminePattern = /^\s*at\s+.*\(?.*\/jasmine(-[^\/]*)?\.js:\d+:\d+\)?\s*$/ @@ -11,7 +11,19 @@ formatStackTrace = (stackTrace) -> for line in stackTrace.split('\n') convertedLines.push(line) unless jasminePattern.test(line) - convertStackTrace(convertedLines.join('\n'), sourceMaps) + stackTrace = convertStackTrace(convertedLines.join('\n'), sourceMaps) + lines = stackTrace.split('\n') + + # Remove first line of stack when it is the same as the error message + errorMatch = lines[0]?.match(/^Error: (.*)/) + lines.shift() if message.trim() is errorMatch?[1]?.trim() + + # Remove prefix of lines matching: at [object Object]. (path:1:2) + for line, index in lines + prefixMatch = line.match(/at \[object Object\]\. \(([^\)]+)\)/) + lines[index] = "at #{prefixMatch[1]}" if prefixMatch + + lines.join('\n') module.exports = class AtomReporter extends View @@ -215,7 +227,7 @@ class SpecResultView extends View @description.text @spec.description for result in @spec.results().getItems() when not result.passed() - stackTrace = formatStackTrace(result.trace.stack) + stackTrace = formatStackTrace(result.message, result.trace.stack) @specFailures.append $$ -> @div result.message, class: 'resultMessage fail' @div stackTrace, class: 'stack-trace padded' if stackTrace From 99c2c32e1e61e7af5a0548d7633b3fd27bf5ea73 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 17:06:35 -0800 Subject: [PATCH 42/96] Nest styles --- spec/atom-reporter.coffee | 2 +- static/jasmine.less | 251 ++++++++++++++++++++------------------ 2 files changed, 133 insertions(+), 120 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 2f67505a7..a5fe991eb 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -28,7 +28,7 @@ formatStackTrace = (message='', stackTrace) -> module.exports = class AtomReporter extends View @content: -> - @div id: 'HTMLReporter', class: 'jasmine_reporter spec-reporter', => + @div class: 'jasmine_reporter spec-reporter', => @div outlet: 'specPopup', class: "spec-popup" @div outlet: "suites" @div outlet: 'coreArea', => diff --git a/static/jasmine.less b/static/jasmine.less index 58bc7be40..d4f2c9d2e 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -20,153 +20,166 @@ body { list-style: none; } -#HTMLReporter { +.spec-reporter { font-size: 11px; font-family: Monaco, Consolas, monospace; line-height: 1.6em; color: #333333; -} -#HTMLReporter #jasmine_content { - position: fixed; - right: 100%; -} + #jasmine_content { + position: fixed; + right: 100%; + } -#HTMLReporter .symbolHeader { - background-color: #222; - color: #c2c2c2; - font-size: 12px; - margin: 0; - padding: 5px 2px 2px 2px; -} + .symbolHeader { + background-color: #222; + color: #c2c2c2; + font-size: 12px; + margin: 0; + padding: 5px 2px 2px 2px; + } -#HTMLReporter .symbolSummary { - background-color: #222; - overflow: hidden; - margin: 0; -} + .symbolSummary { + background-color: #222; + overflow: hidden; + margin: 0; + } -#HTMLReporter .symbolSummary li { - float: left; - line-height: 10px; - height: 10px; - width: 10px; - font-size: 10px; -} + .symbolSummary li { + float: left; + line-height: 10px; + height: 10px; + width: 10px; + font-size: 10px; -#HTMLReporter .symbolSummary li.passed { color: #63AD75 } -#HTMLReporter .symbolSummary li.failed { color: #FF3F05 } -#HTMLReporter .symbolSummary li.skipped { color: #444 } -#HTMLReporter .symbolSummary li.pending { color: #111 } + &.passed { + color: #63AD75; + } -#HTMLReporter .symbolSummary li:before { content: "\02022"; } + &.failed { + color: #FF3F05; + } -#HTMLReporter .symbolSummary li:hover { - color: white; -} + &.skipped { + color: #444 + } -#HTMLReporter .status { - font-size: 20px; - color: #222; - background-color: #E5FFC0; - line-height: 2em; - padding: 2px; - border: 2px solid #222; - border-left: 0; - border-right: 0; - text-align: center; -} + &.pending { + color: #111; + } -#HTMLReporter .status.failed { - color: white; - background-color: rgba(204,51,63,1.0); -} + &:before { + content: "\02022"; + } -#HTMLReporter .status .spec-count { - float: left; -} + &:hover { + color: white; + } + } -#HTMLReporter .status .message { -} + .status { + font-size: 20px; + color: #222; + background-color: #E5FFC0; + line-height: 2em; + padding: 2px; + border: 2px solid #222; + border-left: 0; + border-right: 0; + text-align: center; -#HTMLReporter .status .time { - float: right; -} + &.failed { + color: white; + background-color: rgba(204,51,63,1.0); + } -#HTMLReporter .results .suite + .suite, #HTMLReporter .results .spec + .spec { - border-radius: 0; -} + .spec-count { + float: left; + } -#HTMLReporter .results .suite, #HTMLReporter .results .spec { - border: 2px solid #222; - border-radius: 7px 0 0 0; - border-right: none; - border-bottom: none; - padding: 5px; - padding-right: 0; - padding-bottom: 0; -} + .time { + float: right; + } + } -#HTMLReporter .results .suite:first-child { - border-radius: 0; - border: 2px solid #6A4A3C; - border-top: 0; - border-left: 0; - border-right: 0; -} + .results { + .suite + .suite, + .spec + .spec { + border-radius: 0; + } -#HTMLReporter .results .suite { - border: 2px solid #6A4A3C; - border-radius: 7px 0 0 0; - border-right: none; - border-bottom: none; - padding: 5px; - padding-right: 0; - padding-bottom: 0; - background-color:rgba(204,51,63,0.33); -} + .suite, + .spec { + border: 2px solid #222; + border-radius: 7px 0 0 0; + border-right: none; + border-bottom: none; + padding: 5px; + padding-right: 0; + padding-bottom: 0; + } -#HTMLReporter .results .spec { - padding: 10px; - background-color:rgba(204,51,63,1.0); -} + .suite:first-child { + border-radius: 0; + border: 2px solid #6A4A3C; + border-top: 0; + border-left: 0; + border-right: 0; + } -#HTMLReporter .results .suite > .suite, #HTMLReporter .results .suite > .spec { - margin-left: 5px -} + .suite { + border: 2px solid #6A4A3C; + border-radius: 7px 0 0 0; + border-right: none; + border-bottom: none; + padding: 5px; + padding-right: 0; + padding-bottom: 0; + background-color:rgba(204,51,63,0.33); + } -#HTMLReporter .results .description { - color: white; - font-size: 15px; - padding-bottom: 10px -} + .spec { + padding: 10px; + background-color:rgba(204,51,63,1.0); + } -#HTMLReporter .results .spec .spec-toggle { - font-family: Octicons Regular; - color: white; - font-size: 20px; - float: right; - cursor: pointer; - text-shadow: 3px 3px #222; - opacity: 0; -} + .suite > .suite, + .suite > .spec { + margin-left: 5px + } -#HTMLReporter .results .spec .spec-toggle:hover { - text-shadow: none; - padding-top: 3px; -} + .description { + color: white; + font-size: 15px; + padding-bottom: 10px + } -#HTMLReporter .results .spec:hover .spec-toggle { - opacity: 1; -} + .spec .spec-toggle { + font-family: Octicons Regular; + color: white; + font-size: 20px; + float: right; + cursor: pointer; + text-shadow: 3px 3px #222; + opacity: 0; + } -#HTMLReporter .resultMessage { - padding-top: 5px; - color: #fff; - font-size: 15px -} + .spec .spec-toggle:hover { + text-shadow: none; + padding-top: 3px; + } + + .spec:hover .spec-toggle { + opacity: 1; + } + } + + .resultMessage { + padding-top: 5px; + color: #fff; + font-size: 15px + } -.spec-reporter { .stack-trace { font-size: 12px; margin: 5px 0 0 0; From 91bd852812c6855bfd79551a4538cfa313581698 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 17:09:14 -0800 Subject: [PATCH 43/96] Use hyphen separated class names --- spec/atom-reporter.coffee | 14 +++++----- static/jasmine.less | 54 +++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index a5fe991eb..f292c0c41 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -32,14 +32,14 @@ class AtomReporter extends View @div outlet: 'specPopup', class: "spec-popup" @div outlet: "suites" @div outlet: 'coreArea', => - @div outlet: 'coreHeader', class: 'symbolHeader' - @ul outlet: 'coreSummary', class: 'symbolSummary list-unstyled' + @div outlet: 'coreHeader', class: 'symbol-header' + @ul outlet: 'coreSummary', class: 'symbol-summary list-unstyled' @div outlet: 'bundledArea', => - @div outlet: 'bundledHeader', class: 'symbolHeader' - @ul outlet: 'bundledSummary', class: 'symbolSummary list-unstyled' + @div outlet: 'bundledHeader', class: 'symbol-header' + @ul outlet: 'bundledSummary', class: 'symbol-summary list-unstyled' @div outlet: 'userArea', => - @div outlet: 'userHeader', class: 'symbolHeader' - @ul outlet: 'userSummary', class: 'symbolSummary list-unstyled' + @div outlet: 'userHeader', class: 'symbol-header' + @ul outlet: 'userSummary', class: 'symbol-summary list-unstyled' @div outlet: "status", class: 'status', => @div outlet: "time", class: 'time' @div outlet: "specCount", class: 'spec-count' @@ -229,7 +229,7 @@ class SpecResultView extends View for result in @spec.results().getItems() when not result.passed() stackTrace = formatStackTrace(result.message, result.trace.stack) @specFailures.append $$ -> - @div result.message, class: 'resultMessage fail' + @div result.message, class: 'result-message fail' @div stackTrace, class: 'stack-trace padded' if stackTrace attach: -> diff --git a/static/jasmine.less b/static/jasmine.less index d4f2c9d2e..b7a30f5c7 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -31,7 +31,7 @@ body { right: 100%; } - .symbolHeader { + .symbol-header { background-color: #222; color: #c2c2c2; font-size: 12px; @@ -39,41 +39,41 @@ body { padding: 5px 2px 2px 2px; } - .symbolSummary { + .symbol-summary { background-color: #222; overflow: hidden; margin: 0; - } - .symbolSummary li { - float: left; - line-height: 10px; - height: 10px; - width: 10px; - font-size: 10px; + li { + float: left; + line-height: 10px; + height: 10px; + width: 10px; + font-size: 10px; - &.passed { - color: #63AD75; - } + &.passed { + color: #63AD75; + } - &.failed { - color: #FF3F05; - } + &.failed { + color: #FF3F05; + } - &.skipped { - color: #444 - } + &.skipped { + color: #444 + } - &.pending { - color: #111; - } + &.pending { + color: #111; + } - &:before { - content: "\02022"; - } + &:before { + content: "\02022"; + } - &:hover { - color: white; + &:hover { + color: white; + } } } @@ -174,7 +174,7 @@ body { } } - .resultMessage { + .result-message { padding-top: 5px; color: #fff; font-size: 15px From 89b240cd4f9a58ea4094796c7185e3f9fd83b16a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 17:52:24 -0800 Subject: [PATCH 44/96] Use pre element for stack traces --- spec/atom-reporter.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index f292c0c41..6608bea06 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -230,7 +230,7 @@ class SpecResultView extends View stackTrace = formatStackTrace(result.message, result.trace.stack) @specFailures.append $$ -> @div result.message, class: 'result-message fail' - @div stackTrace, class: 'stack-trace padded' if stackTrace + @pre stackTrace, class: 'stack-trace padded' if stackTrace attach: -> @parentSuiteView().append this From 919fafc7a436ae3d24beac22f2bd3577e5d2ccc9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 17:52:42 -0800 Subject: [PATCH 45/96] Trim stack trace lines --- spec/atom-reporter.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 6608bea06..3cc1491b5 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -23,6 +23,7 @@ formatStackTrace = (message='', stackTrace) -> prefixMatch = line.match(/at \[object Object\]\. \(([^\)]+)\)/) lines[index] = "at #{prefixMatch[1]}" if prefixMatch + lines = lines.map (line) -> line.trim() lines.join('\n') module.exports = From 8b94fef8061f26b793c3ee228dd010f6bad7249a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 17:52:55 -0800 Subject: [PATCH 46/96] Use alert class for status area --- spec/atom-reporter.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 3cc1491b5..19ce17989 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -41,7 +41,7 @@ class AtomReporter extends View @div outlet: 'userArea', => @div outlet: 'userHeader', class: 'symbol-header' @ul outlet: 'userSummary', class: 'symbol-summary list-unstyled' - @div outlet: "status", class: 'status', => + @div outlet: "status", class: 'status alert alert-success', => @div outlet: "time", class: 'time' @div outlet: "specCount", class: 'spec-count' @div outlet: "message", class: 'message' @@ -128,7 +128,7 @@ class AtomReporter extends View updateStatusView: (spec) -> if @failedCount > 0 - @status.addClass('failed') unless @status.hasClass('failed') + @status.addClass('alert-danger').removeClass('alert-success') @updateSpecCounts() From 0d724bb00d1e2329c4989861991ab4b44de72dee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:31:45 -0800 Subject: [PATCH 47/96] Drop colon suffix --- spec/atom-reporter.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 19ce17989..8a50d2ed8 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -158,15 +158,15 @@ class AtomReporter extends View @userSummary.append symbol if coreSpecs > 0 - @coreHeader.text("Core Specs (#{coreSpecs}):") + @coreHeader.text("Core Specs (#{coreSpecs})") else @coreArea.hide() if bundledPackageSpecs > 0 - @bundledHeader.text("Bundled Package Specs (#{bundledPackageSpecs}):") + @bundledHeader.text("Bundled Package Specs (#{bundledPackageSpecs})") else @bundledArea.hide() if userPackageSpecs > 0 - @userHeader.text("User Package Specs (#{userPackageSpecs}):") + @userHeader.text("User Package Specs (#{userPackageSpecs})") else @userArea.hide() From 1c51f512ea42d734dfeb90e74b4acaa4ea93a6ea Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:31:56 -0800 Subject: [PATCH 48/96] Add symbol-area class --- spec/atom-reporter.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 8a50d2ed8..a27f945f1 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -30,15 +30,15 @@ module.exports = class AtomReporter extends View @content: -> @div class: 'jasmine_reporter spec-reporter', => - @div outlet: 'specPopup', class: "spec-popup" + @div outlet: 'specPopup', class: "spec-popup alert alert-info" @div outlet: "suites" - @div outlet: 'coreArea', => + @div outlet: 'coreArea', class: 'symbol-area', => @div outlet: 'coreHeader', class: 'symbol-header' @ul outlet: 'coreSummary', class: 'symbol-summary list-unstyled' - @div outlet: 'bundledArea', => + @div outlet: 'bundledArea', class: 'symbol-area', => @div outlet: 'bundledHeader', class: 'symbol-header' @ul outlet: 'bundledSummary', class: 'symbol-summary list-unstyled' - @div outlet: 'userArea', => + @div outlet: 'userArea', class: 'symbol-area', => @div outlet: 'userHeader', class: 'symbol-header' @ul outlet: 'userSummary', class: 'symbol-summary list-unstyled' @div outlet: "status", class: 'status alert alert-success', => From 8be5f7d6c8d7fc4cc5ee1183d8f79d3bfd2bae4c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:32:15 -0800 Subject: [PATCH 49/96] Use bootstrap to style spec reporter --- static/jasmine.less | 150 +++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 94 deletions(-) diff --git a/static/jasmine.less b/static/jasmine.less index b7a30f5c7..2a671d570 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -1,17 +1,14 @@ -@import "octicon-mixins.less"; +@import "octicon-mixins"; @font-face { .octicon-font(); } body { - background-color: #ddd; + background-color: #fff; padding: 0; } .spec-popup { position: absolute; - background-color: #ddd; - border: 2px solid black; - padding: 5px; font-size: 13px; display: none; } @@ -22,9 +19,8 @@ body { .spec-reporter { font-size: 11px; - font-family: Monaco, Consolas, monospace; line-height: 1.6em; - color: #333333; + color: #333; #jasmine_content { position: fixed; @@ -32,19 +28,24 @@ body { } .symbol-header { - background-color: #222; - color: #c2c2c2; font-size: 12px; margin: 0; - padding: 5px 2px 2px 2px; + padding-bottom: 5px; + } + + .symbol-area { + margin: 10px; + padding: 10px; + border: 1px solid #ddd; + border-radius: 2px; } .symbol-summary { - background-color: #222; overflow: hidden; margin: 0; li { + font-family: Monaco, Consolas, monospace; float: left; line-height: 10px; height: 10px; @@ -52,47 +53,35 @@ body { font-size: 10px; &.passed { - color: #63AD75; + color: #5cb85c; } &.failed { - color: #FF3F05; + color: #d9534f; } &.skipped { - color: #444 + color: #ddd; } &.pending { - color: #111; + color: #eee; } &:before { content: "\02022"; } - - &:hover { - color: white; - } } } .status { font-size: 20px; - color: #222; - background-color: #E5FFC0; line-height: 2em; - padding: 2px; - border: 2px solid #222; - border-left: 0; - border-right: 0; + padding: 5px; + border-radius: 0; + margin: 0; text-align: center; - &.failed { - color: white; - background-color: rgba(204,51,63,1.0); - } - .spec-count { float: left; } @@ -103,81 +92,56 @@ body { } .results { - .suite + .suite, - .spec + .spec { - border-radius: 0; + padding: 10px; + + .description { + font-size: 16px; + padding: 5px 0 5px 0; } - .suite, - .spec { - border: 2px solid #222; - border-radius: 7px 0 0 0; - border-right: none; - border-bottom: none; - padding: 5px; - padding-right: 0; - padding-bottom: 0; - } + > .suite { + > .description { + font-size: 18px; + font-weight: bold; + } - .suite:first-child { - border-radius: 0; - border: 2px solid #6A4A3C; - border-top: 0; - border-left: 0; - border-right: 0; - } - - .suite { - border: 2px solid #6A4A3C; - border-radius: 7px 0 0 0; - border-right: none; - border-bottom: none; - padding: 5px; - padding-right: 0; - padding-bottom: 0; - background-color:rgba(204,51,63,0.33); + margin-bottom: 20px; } .spec { - padding: 10px; - background-color:rgba(204,51,63,1.0); + margin-top: 5px; + padding: 0 10px 10px 10px; + border-left: 3px solid #d9534f; + + .spec-toggle { + font-family: Octicons Regular; + font-size: 20px; + float: right; + cursor: pointer; + opacity: 0; + color: #999; + } + + .spec-toggle:hover { + color: #333; + } + + &:hover .spec-toggle { + opacity: 1; + } } .suite > .suite, .suite > .spec { - margin-left: 5px - } - - .description { - color: white; - font-size: 15px; - padding-bottom: 10px - } - - .spec .spec-toggle { - font-family: Octicons Regular; - color: white; - font-size: 20px; - float: right; - cursor: pointer; - text-shadow: 3px 3px #222; - opacity: 0; - } - - .spec .spec-toggle:hover { - text-shadow: none; - padding-top: 3px; - } - - .spec:hover .spec-toggle { - opacity: 1; + margin-left: 10px; } } .result-message { - padding-top: 5px; - color: #fff; - font-size: 15px + font-size: 16px; + font-weight: bold; + color: #d9534f; + padding: 5px 0 5px 0; } .stack-trace { @@ -185,10 +149,8 @@ body { margin: 5px 0 0 0; border-radius: 2px; line-height: 18px; - color: #666666; + color: #666; border: 1px solid #ddd; - background: white; - white-space: pre; overflow: auto; } } From 6776fa4f0dcad56c36e6f0f7124a38417ee62d70 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:40:37 -0800 Subject: [PATCH 50/96] Remove border from symbol area --- static/jasmine.less | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/static/jasmine.less b/static/jasmine.less index 2a671d570..cb6f8370b 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -28,16 +28,14 @@ body { } .symbol-header { - font-size: 12px; + font-size: 16px; + font-weight: bold; margin: 0; - padding-bottom: 5px; + padding-bottom: 10px; } .symbol-area { - margin: 10px; padding: 10px; - border: 1px solid #ddd; - border-radius: 2px; } .symbol-summary { From fd005380b0bb6a246bd3f2990e26c59afe503cd8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:40:49 -0800 Subject: [PATCH 51/96] Use package name in label --- spec/atom-reporter.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index a27f945f1..49a614271 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -1,6 +1,7 @@ -{View, $, $$} = require '../src/space-pen-extensions' +path = require 'path' _ = require 'underscore-plus' {convertStackTrace} = require 'coffeestack' +{View, $, $$} = require '../src/space-pen-extensions' sourceMaps = {} formatStackTrace = (message='', stackTrace) -> @@ -166,7 +167,12 @@ class AtomReporter extends View else @bundledArea.hide() if userPackageSpecs > 0 - @userHeader.text("User Package Specs (#{userPackageSpecs})") + if coreSpecs is 0 and bundledPackageSpecs is 0 + packageFolderName = path.basename(path.dirname(specs[0].specDirectory)) + packageName = _.undasherize(_.uncamelcase(packageFolderName)) + @userHeader.text("#{packageName} Specs (#{userPackageSpecs})") + else + @userHeader.text("User Package Specs (#{userPackageSpecs})") else @userArea.hide() From c882d73527d4717ca55074e07cb0edef6034b222 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 18:53:06 -0800 Subject: [PATCH 52/96] Add it prefix to failure descriptions --- spec/atom-reporter.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 49a614271..55e8a7de3 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -231,7 +231,10 @@ class SpecResultView extends View initialize: (@spec) -> @addClass("spec-view-#{@spec.id}") - @description.text @spec.description + + description = @spec.description + description = "it #{description}" if description.indexOf('it ') isnt 0 + @description.text(description) for result in @spec.results().getItems() when not result.passed() stackTrace = formatStackTrace(result.message, result.trace.stack) From 4b2e8f8713310a089b8d6680830c5d0ca3620512 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 19:01:04 -0800 Subject: [PATCH 53/96] Use fold/unfold octicons --- spec/atom-reporter.coffee | 4 ++-- static/jasmine.less | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 55e8a7de3..f5116936a 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -117,7 +117,7 @@ class AtomReporter extends View element = $(currentTarget) specFailures = element.parent().find('.spec-failures') specFailures.toggle() - if specFailures.is(":visible") then element.text "\uf03d" else element.html "\uf03f" + element.toggleClass('folded') false updateSpecCounts: -> @@ -224,7 +224,7 @@ class SuiteResultView extends View class SpecResultView extends View @content: -> @div class: 'spec', => - @div "\uf03d", class: 'spec-toggle' + @div class: 'spec-toggle' @div outlet: 'description', class: 'description' @div outlet: 'specFailures', class: 'spec-failures' spec: null diff --git a/static/jasmine.less b/static/jasmine.less index cb6f8370b..733bcc8b5 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -1,7 +1,5 @@ @import "octicon-mixins"; -@font-face { .octicon-font(); } - body { background-color: #fff; padding: 0; @@ -112,12 +110,15 @@ body { border-left: 3px solid #d9534f; .spec-toggle { - font-family: Octicons Regular; - font-size: 20px; + .octicon(fold); float: right; cursor: pointer; opacity: 0; color: #999; + + &.folded { + .octicon(unfold); + } } .spec-toggle:hover { From 6a408a3a5511a1cf6f00e8aaaba374ada8e895d0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 19:03:55 -0800 Subject: [PATCH 54/96] Make symbol-header font size 18px --- static/jasmine.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/jasmine.less b/static/jasmine.less index 733bcc8b5..3de0abcb0 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -26,7 +26,7 @@ body { } .symbol-header { - font-size: 16px; + font-size: 18px; font-weight: bold; margin: 0; padding-bottom: 10px; From d9e4b9d199320923d6521fd1e355c2c4d0232755 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 19:10:54 -0800 Subject: [PATCH 55/96] Remove redundant spec count --- spec/atom-reporter.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index f5116936a..c1a8fdbb5 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -170,7 +170,7 @@ class AtomReporter extends View if coreSpecs is 0 and bundledPackageSpecs is 0 packageFolderName = path.basename(path.dirname(specs[0].specDirectory)) packageName = _.undasherize(_.uncamelcase(packageFolderName)) - @userHeader.text("#{packageName} Specs (#{userPackageSpecs})") + @userHeader.text("#{packageName} Specs") else @userHeader.text("User Package Specs (#{userPackageSpecs})") else From b6710b54cfe3eb76f4c56ef48ac5f295129c653f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 19:12:54 -0800 Subject: [PATCH 56/96] Add comment about package specs label --- spec/atom-reporter.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index c1a8fdbb5..a90f3f45e 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -168,7 +168,9 @@ class AtomReporter extends View @bundledArea.hide() if userPackageSpecs > 0 if coreSpecs is 0 and bundledPackageSpecs is 0 - packageFolderName = path.basename(path.dirname(specs[0].specDirectory)) + # Package specs being run, show a more descriptive label + {specDirectory} = specs[0] + packageFolderName = path.basename(path.dirname(specDirectory)) packageName = _.undasherize(_.uncamelcase(packageFolderName)) @userHeader.text("#{packageName} Specs") else From 4743cf89dcc80efc6d3ebf69167a7e8900b2a6fd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 19:19:56 -0800 Subject: [PATCH 57/96] Ignore lines after the first jasmine line --- spec/atom-reporter.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index a90f3f45e..39da3231c 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -8,9 +8,11 @@ formatStackTrace = (message='', stackTrace) -> return stackTrace unless stackTrace jasminePattern = /^\s*at\s+.*\(?.*\/jasmine(-[^\/]*)?\.js:\d+:\d+\)?\s*$/ + firstJasmineLinePattern = /^\s*at \/.*\/jasmine(-[^\/]*)?\.js:\d+:\d+\)?\s*$/ convertedLines = [] for line in stackTrace.split('\n') convertedLines.push(line) unless jasminePattern.test(line) + break if firstJasmineLinePattern.test(line) stackTrace = convertStackTrace(convertedLines.join('\n'), sourceMaps) lines = stackTrace.split('\n') From d9b14dc4921170bf5d4a1807cff86ac52248fd2c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 20:52:35 -0800 Subject: [PATCH 58/96] :lipstick: Use Date.now() --- spec/atom-reporter.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 39da3231c..5d1c81bf6 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -61,7 +61,7 @@ class AtomReporter extends View reportRunnerStarting: (runner) -> @handleEvents() - @startedAt = new Date() + @startedAt = Date.now() specs = runner.specs() @totalSpecCount = specs.length @addSpecs(specs) @@ -78,7 +78,7 @@ class AtomReporter extends View reportSpecResults: (spec) -> @completeSpecCount++ - spec.endedAt = new Date().getTime() + spec.endedAt = Date.now() @specComplete(spec) @updateStatusView(spec) @@ -139,7 +139,7 @@ class AtomReporter extends View rootSuite = rootSuite.parentSuite while rootSuite.parentSuite @message.text rootSuite.description - time = "#{Math.round((spec.endedAt - @startedAt.getTime()) / 10)}" + time = "#{Math.round((spec.endedAt - @startedAt) / 10)}" time = "0#{time}" if time.length < 3 @time[0].textContent = "#{time[0...-2]}.#{time[-2..]}s" From 830a8ddc0379bdec794e26668a31395b6e1d2925 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 20:59:38 -0800 Subject: [PATCH 59/96] Use bootstrap tooltips --- spec/atom-reporter.coffee | 19 +------------------ static/jasmine.less | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 5d1c81bf6..21850eba3 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -33,7 +33,6 @@ module.exports = class AtomReporter extends View @content: -> @div class: 'jasmine_reporter spec-reporter', => - @div outlet: 'specPopup', class: "spec-popup alert alert-info" @div outlet: "suites" @div outlet: 'coreArea', class: 'symbol-area', => @div outlet: 'coreHeader', class: 'symbol-header' @@ -99,22 +98,6 @@ class AtomReporter extends View @specFilter(parent) handleEvents: -> - $(document).on "mouseover", ".spec-summary", ({currentTarget}) => - element = $(currentTarget) - description = element.data("description") - return unless description - - clearTimeout @timeoutId if @timeoutId? - @specPopup.show() - spec = _.find(window.timedSpecs, ({fullName}) -> description is fullName) - description = "#{description} #{spec.time}ms" if spec - @specPopup.text description - {left, top} = element.offset() - left += 20 - top += 20 - @specPopup.offset({left, top}) - @timeoutId = setTimeout((=> @specPopup.hide()), 3000) - $(document).on "click", ".spec-toggle", ({currentTarget}) => element = $(currentTarget) specFailures = element.parent().find('.spec-failures') @@ -186,7 +169,7 @@ class AtomReporter extends View specComplete: (spec) -> specSummaryElement = $("#spec-summary-#{spec.id}") specSummaryElement.removeClass('pending') - specSummaryElement.data("description", spec.getFullName()) + specSummaryElement.setTooltip(title: spec.getFullName(), container: '.spec-reporter') results = spec.results() if results.skipped diff --git a/static/jasmine.less b/static/jasmine.less index 3de0abcb0..0b3778753 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -5,12 +5,6 @@ body { padding: 0; } -.spec-popup { - position: absolute; - font-size: 13px; - display: none; -} - .list-unstyled { list-style: none; } @@ -152,4 +146,21 @@ body { border: 1px solid #ddd; overflow: auto; } + + .tooltip { + .tooltip-inner { + border: 1px solid #ccc; + background: #fff; + color: #666; + max-width: 400px; + } + + &.in { + opacity: 1; + } + + .tooltip-arrow { + visibility: hidden; + } + } } From 4c60c40eb8722ce64b7e51f9d9d6f01e4b7c06b6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 21:00:12 -0800 Subject: [PATCH 60/96] Nest list-unstyled rule --- static/jasmine.less | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/jasmine.less b/static/jasmine.less index 0b3778753..c2c579cba 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -1,22 +1,22 @@ @import "octicon-mixins"; +#jasmine_content { + position: fixed; + right: 100%; +} + body { background-color: #fff; padding: 0; } -.list-unstyled { - list-style: none; -} - .spec-reporter { font-size: 11px; line-height: 1.6em; color: #333; - #jasmine_content { - position: fixed; - right: 100%; + .list-unstyled { + list-style: none; } .symbol-header { From 0eb874864c4a00a8ee6573a85d1f1a0ea7356791 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 21:03:22 -0800 Subject: [PATCH 61/96] Remove unused specFilter method --- spec/atom-reporter.coffee | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 21850eba3..e04c77639 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -84,19 +84,6 @@ class AtomReporter extends View reportSpecStarting: (spec) -> @specStarted(spec) - specFilter: (spec) -> - globalFocusPriority = jasmine.getEnv().focusPriority - parent = spec.parentSuite ? spec.suite - - if !globalFocusPriority - true - else if spec.focusPriority >= globalFocusPriority - true - else if not parent - false - else - @specFilter(parent) - handleEvents: -> $(document).on "click", ".spec-toggle", ({currentTarget}) => element = $(currentTarget) From 750e3565fd6c3ed8dba46cbbe7b56fae70c0b4dd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 10 Feb 2014 21:10:01 -0800 Subject: [PATCH 62/96] Remove unused margin styles --- static/jasmine.less | 2 -- 1 file changed, 2 deletions(-) diff --git a/static/jasmine.less b/static/jasmine.less index c2c579cba..aced4f449 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -22,7 +22,6 @@ body { .symbol-header { font-size: 18px; font-weight: bold; - margin: 0; padding-bottom: 10px; } @@ -69,7 +68,6 @@ body { line-height: 2em; padding: 5px; border-radius: 0; - margin: 0; text-align: center; .spec-count { From c19c4a5e275ad8f2f8fa88e564f1171eb84ad06d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 08:58:30 -0800 Subject: [PATCH 63/96] Remove unused class --- spec/atom-reporter.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index e04c77639..ac3e71044 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -32,7 +32,7 @@ formatStackTrace = (message='', stackTrace) -> module.exports = class AtomReporter extends View @content: -> - @div class: 'jasmine_reporter spec-reporter', => + @div class: 'spec-reporter', => @div outlet: "suites" @div outlet: 'coreArea', class: 'symbol-area', => @div outlet: 'coreHeader', class: 'symbol-header' From 4bfc0e8ea1a214ee0df3bc51385906abaf2de5ee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:00:59 -0800 Subject: [PATCH 64/96] Remove ivars assigned in initialize --- spec/atom-reporter.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index ac3e71044..65221c644 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -177,8 +177,6 @@ class SuiteResultView extends View @div class: 'suite', => @div outlet: 'description', class: 'description' - suite: null - initialize: (@suite) -> @attr('id', "suite-view-#{@suite.id}") @description.html @suite.description @@ -201,7 +199,6 @@ class SpecResultView extends View @div class: 'spec-toggle' @div outlet: 'description', class: 'description' @div outlet: 'specFailures', class: 'spec-failures' - spec: null initialize: (@spec) -> @addClass("spec-view-#{@spec.id}") From aef3332a09d39a96f29dc3f0a1dce019d93f39fb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:02:41 -0800 Subject: [PATCH 65/96] Set suite description as text --- spec/atom-reporter.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 65221c644..8ce4e34f1 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -179,7 +179,7 @@ class SuiteResultView extends View initialize: (@suite) -> @attr('id', "suite-view-#{@suite.id}") - @description.html @suite.description + @description.text(@suite.description) attach: -> (@parentSuiteView() or $('.results')).append this From 069ead6b1c1193e6545fd49af88b23d6db384a43 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:21:21 -0800 Subject: [PATCH 66/96] Show failure count at end --- spec/atom-reporter.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 8ce4e34f1..c366ec250 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -69,9 +69,12 @@ class AtomReporter extends View reportRunnerResults: (runner) -> @updateSpecCounts() if @failedCount == 0 - @message.text "Success!" + @message.text "Specs Passed" else - @message.text "Game Over" + if @failedCount is 1 + @message.text "#{@failedCount} Failure" + else + @message.text "#{@failedCount} Failures" reportSuiteResults: (suite) -> From 848d77d3eb02176c442f0fc440667757f1ab465d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:23:12 -0800 Subject: [PATCH 67/96] Show 0 failures when all pass --- spec/atom-reporter.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index c366ec250..717217c65 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -68,13 +68,10 @@ class AtomReporter extends View reportRunnerResults: (runner) -> @updateSpecCounts() - if @failedCount == 0 - @message.text "Specs Passed" + if @failedCount is 1 + @message.text "#{@failedCount} failure" else - if @failedCount is 1 - @message.text "#{@failedCount} Failure" - else - @message.text "#{@failedCount} Failures" + @message.text "#{@failedCount} failures" reportSuiteResults: (suite) -> From 4b529ae1674149534bca95ec75807e9551ba4570 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 09:33:12 -0800 Subject: [PATCH 68/96] Make methods private --- src/pane.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 652b05f5f..6998ad938 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -111,15 +111,15 @@ class Pane extends Model else @activateItemAtIndex(@items.length - 1) - # Public: Returns the index of the current active item. + # Returns the index of the current active item. getActiveItemIndex: -> @items.indexOf(@activeItem) - # Public: Makes the item at the given index active. + # Makes the item at the given index active. activateItemAtIndex: (index) -> @activateItem(@itemAtIndex(index)) - # Public: Makes the given item active, adding the item if necessary. + # Makes the given item active, adding the item if necessary. activateItem: (item) -> if item? @addItem(item) From a2fcc7aa7a30111fe7fde8c7607ef9276f14a05d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 10:58:24 -0800 Subject: [PATCH 69/96] Add Workspace::getActiveEditor and Pane::getActiveEditor --- src/pane.coffee | 7 +++++++ src/workspace.coffee | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/pane.coffee b/src/pane.coffee index 6998ad938..763c37519 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -3,6 +3,7 @@ {Model, Sequence} = require 'theorist' Serializable = require 'serializable' PaneAxis = require './pane-axis' +Editor = require './editor' PaneView = null # Public: A container for multiple items, one of which is *active* at a given @@ -91,6 +92,12 @@ class Pane extends Model getActiveItem: -> @activeItem + # Public: Returns an {Editor} if the pane item is an {Editor}, or null + # otherwise. + getActiveEditor: -> + console.log + @activeItem if @activeItem instanceof Editor + # Public: Returns the item at the specified index. itemAtIndex: (index) -> @items[index] diff --git a/src/workspace.coffee b/src/workspace.coffee index d8cd563fa..c123131e7 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -155,6 +155,11 @@ class Workspace extends Model destroyActivePane: -> @activePane?.destroy() + # Public: Returns an {Editor} if the active pane item is an {Editor}, + # or null otherwise. + getActiveEditor: -> + @activePane?.getActiveEditor() + increaseFontSize: -> atom.config.set("editor.fontSize", atom.config.get("editor.fontSize") + 1) From d5c4b746081f7804c6a20375a9f57fb1871c657d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 10:58:32 -0800 Subject: [PATCH 70/96] :fire: whitespace --- spec/spec-helper.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index e1610748c..8e9fa939d 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -169,7 +169,6 @@ addCustomMatchers = (spec) -> element = element.get(0) if element.jquery element.webkitMatchesSelector(":focus") or element.querySelector(":focus") - window.keyIdentifierForKey = (key) -> if key.length > 1 # named key key From 71ae6b28dd7a53bf6069d826f41921fe7ec00466 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 11:40:12 -0800 Subject: [PATCH 71/96] Upgrade to markdown-preview@0.26.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c1733c42..804b7cbf0 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "image-view": "0.19.0", "keybinding-resolver": "0.9.0", "link": "0.17.0", - "markdown-preview": "0.25.1", + "markdown-preview": "0.26.0", "metrics": "0.26.0", "package-generator": "0.26.0", "release-notes": "0.18.0", From 1bc38c191f085ef94c691e9f3f42e1bad73fda2c Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 12:44:41 -0800 Subject: [PATCH 72/96] Upgrade to markdown-preview@0.27.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 19d71a844..824250272 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "image-view": "0.19.0", "keybinding-resolver": "0.10.0", "link": "0.17.0", - "markdown-preview": "0.26.0", + "markdown-preview": "0.27.0", "metrics": "0.26.0", "package-generator": "0.26.0", "release-notes": "0.20.0", From 0ea03bc389fa2888378a25c0bea7c39b57c79c9d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 12:52:35 -0800 Subject: [PATCH 73/96] Upgrade to markdown-preview@0.28.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 824250272..da750307a 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "image-view": "0.19.0", "keybinding-resolver": "0.10.0", "link": "0.17.0", - "markdown-preview": "0.27.0", + "markdown-preview": "0.28.0", "metrics": "0.26.0", "package-generator": "0.26.0", "release-notes": "0.20.0", From 16ab2031fa078797db14a049e0263047933b850b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 15:13:32 -0800 Subject: [PATCH 74/96] Upgrade to markdown-preview@0.28.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 804b7cbf0..753d22f73 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "image-view": "0.19.0", "keybinding-resolver": "0.9.0", "link": "0.17.0", - "markdown-preview": "0.26.0", + "markdown-preview": "0.28.0", "metrics": "0.26.0", "package-generator": "0.26.0", "release-notes": "0.18.0", From d7fabc5a5808d334819bf48dc1b9284764934a0a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:38:42 -0800 Subject: [PATCH 75/96] Map cmd-_ to window:decrease-font-size Makes it consistent with increase-font-size having two keybindings --- keymaps/darwin.cson | 1 + keymaps/win32.cson | 1 + 2 files changed, 2 insertions(+) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index c93079efa..32508b7a2 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -68,6 +68,7 @@ 'cmd-=': 'window:increase-font-size' 'cmd-+': 'window:increase-font-size' 'cmd--': 'window:decrease-font-size' + 'cmd-_': 'window:decrease-font-size' 'cmd-k up': 'pane:split-up' # Atom Specific 'cmd-k down': 'pane:split-down' # Atom Specific diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 9c78e3622..4a0cc96d3 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -40,6 +40,7 @@ 'ctrl-=': 'window:increase-font-size' 'ctrl-+': 'window:increase-font-size' 'ctrl--': 'window:decrease-font-size' + 'ctrl-_': 'window:decrease-font-size' 'ctrl-k up': 'pane:split-up' # Atom Specific 'ctrl-k down': 'pane:split-down' # Atom Specific From dda412d5ec38a9cb27402ce3e6f17a3cda8d03b0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:58:40 -0800 Subject: [PATCH 76/96] Add window:reset-font-size command --- keymaps/darwin.cson | 1 + keymaps/win32.cson | 1 + spec/config-spec.coffee | 13 +++++++++++++ src/config.coffee | 8 ++++++++ src/workspace-view.coffee | 1 + src/workspace.coffee | 3 +++ 6 files changed, 27 insertions(+) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 32508b7a2..307a023df 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -69,6 +69,7 @@ 'cmd-+': 'window:increase-font-size' 'cmd--': 'window:decrease-font-size' 'cmd-_': 'window:decrease-font-size' + 'cmd-0': 'window:reset-font-size' 'cmd-k up': 'pane:split-up' # Atom Specific 'cmd-k down': 'pane:split-down' # Atom Specific diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 4a0cc96d3..e11d4c2f2 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -41,6 +41,7 @@ 'ctrl-+': 'window:increase-font-size' 'ctrl--': 'window:decrease-font-size' 'ctrl-_': 'window:decrease-font-size' + 'ctrl-0': 'window:reset-font-size' 'ctrl-k up': 'pane:split-up' # Atom Specific 'ctrl-k down': 'pane:split-down' # Atom Specific diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 9f8afa408..02ef6d6d8 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -63,6 +63,19 @@ describe "Config", -> atom.config.toggle('foo.a') expect(atom.config.get('foo.a')).toBe false + describe ".restoreDefault(keyPath)", -> + it "sets the value of the key path to its default", -> + atom.config.setDefaults('a', b: 3) + atom.config.set('a.b', 4) + expect(atom.config.get('a.b')).toBe 4 + atom.config.restoreDefault('a.b') + expect(atom.config.get('a.b')).toBe 3 + + atom.config.set('a.c', 5) + expect(atom.config.get('a.c')).toBe 5 + atom.config.restoreDefault('a.c') + expect(atom.config.get('a.c')).toBeUndefined() + describe ".pushAtKeyPath(keyPath, value)", -> it "pushes the given value to the array at the key path and updates observers", -> atom.config.set("foo.bar.baz", ["a"]) diff --git a/src/config.coffee b/src/config.coffee index 7896fa795..775d051ee 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -150,6 +150,14 @@ class Config toggle: (keyPath) -> @set(keyPath, !@get(keyPath)) + # Public: Restore the key path to its default value. + # + # keyPath - The {String} name of the key. + # + # Returns the new value. + restoreDefault: (keyPath) -> + @set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath)) + # Public: Push the value to the array at the key path. # # keyPath - The {String} key path. diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 9b66cae78..acf631a81 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -117,6 +117,7 @@ class WorkspaceView extends View @command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(atom.project.getPath(), 'spec')) @command 'window:increase-font-size', => @increaseFontSize() @command 'window:decrease-font-size', => @decreaseFontSize() + @command 'window:reset-font-size', => @model.resetFontSize() @command 'window:focus-next-pane', => @focusNextPane() @command 'window:focus-previous-pane', => @focusPreviousPane() diff --git a/src/workspace.coffee b/src/workspace.coffee index c123131e7..945ee9b6c 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -167,6 +167,9 @@ class Workspace extends Model fontSize = atom.config.get("editor.fontSize") atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1 + resetFontSize: -> + atom.config.restoreDefault("editor.fontSize") + # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) -> if uri = item.getUri?() From 211d222291528521ba2bc5ec2e34c6b9bf06a3ab Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:00:13 -0800 Subject: [PATCH 77/96] Remove auto-indent conflict with increase zoom --- keymaps/darwin.cson | 1 - keymaps/win32.cson | 1 - 2 files changed, 2 deletions(-) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 307a023df..750a1468f 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -124,7 +124,6 @@ 'alt-cmd-z': 'editor:checkout-head-revision' 'cmd-<': 'editor:scroll-to-cursor' 'alt-cmd-ctrl-f': 'editor:fold-selection' - 'cmd-=': 'editor:auto-indent' # Sublime Parity 'cmd-enter': 'editor:newline-below' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index e11d4c2f2..ca306414e 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -71,7 +71,6 @@ 'alt-ctrl-z': 'editor:checkout-head-revision' 'ctrl-<': 'editor:scroll-to-cursor' 'alt-ctrl-f': 'editor:fold-selection' - 'ctrl-=': 'editor:auto-indent' # Sublime Parity 'ctrl-enter': 'editor:newline-below' From 4d230a051798ad7f1910c034e10ee7cd2c908432 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:15:45 -0800 Subject: [PATCH 78/96] :memo: Pluralize line --- src/editor.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 3ce83a16e..082b9e636 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -621,7 +621,7 @@ class Editor extends Model largestFoldStartingAtScreenRow: (screenRow) -> @displayBuffer.largestFoldStartingAtScreenRow(screenRow) - # Public: Moves the selected line up one row. + # Public: Moves the selected lines up one row. moveLineUp: -> selection = @getSelectedBufferRange() return if selection.start.row is 0 @@ -655,7 +655,7 @@ class Editor extends Model @setSelectedBufferRange(selection.translate([-1]), preserveFolds: true) - # Public: Moves the selected line down one row. + # Public: Moves the selected lines down one row. moveLineDown: -> selection = @getSelectedBufferRange() lastRow = @buffer.getLastRow() From d8da977b206c35860ca43012c7d018e662dfff5d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:15:50 -0800 Subject: [PATCH 79/96] Add failing spec --- spec/editor-view-spec.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index b63079d11..6ec581b8d 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2631,6 +2631,16 @@ describe "EditorView", -> editorView.trigger 'editor:move-line-down' expect(editor.getCursorBufferPosition()).toEqual [1, 2] + describe "when the line below is folder", -> + it "moves the line around the fold", -> + editor.setCursorBufferPosition([0, 0]) + editor.foldBufferRow(2) + editorView.trigger 'editor:move-line-down' + + expect(editor.getCursorBufferPosition()).toEqual [10, 0] + expect(buffer.lineForRow(0)).toBe ' var sort = function(items) {' + expect(buffer.lineForRow(10)).toBe 'var quicksort = function () {' + describe "when the cursor is on the last line", -> it "does not move the line", -> editor.moveCursorToBottom() From f9cdc4883e3aa16526c82c4cf963bd92ed39a051 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:36:43 -0800 Subject: [PATCH 80/96] Move around folds when moving lines down --- spec/editor-view-spec.coffee | 6 +++--- src/editor.coffee | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index 6ec581b8d..af00b65de 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2634,12 +2634,12 @@ describe "EditorView", -> describe "when the line below is folder", -> it "moves the line around the fold", -> editor.setCursorBufferPosition([0, 0]) - editor.foldBufferRow(2) + editor.foldBufferRow(1) editorView.trigger 'editor:move-line-down' - expect(editor.getCursorBufferPosition()).toEqual [10, 0] + expect(editor.getCursorBufferPosition()).toEqual [9, 0] expect(buffer.lineForRow(0)).toBe ' var sort = function(items) {' - expect(buffer.lineForRow(10)).toBe 'var quicksort = function () {' + expect(buffer.lineForRow(9)).toBe 'var quicksort = function () {' describe "when the cursor is on the last line", -> it "does not move the line", -> diff --git a/src/editor.coffee b/src/editor.coffee index 082b9e636..55b15859e 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -667,6 +667,12 @@ class Editor extends Model rows = [selection.end.row..selection.start.row] if selection.start.row isnt selection.end.row and selection.end.column is 0 rows.shift() unless @isFoldedAtBufferRow(selection.end.row) + + # Move line around the fold that is directly below the selection + insertDelta = 1 + if foldRange = @languageMode.rowRangeForFoldAtBufferRow(selection.end.row + 1) + insertDelta += foldRange[1] - foldRange[0] + for row in rows screenRow = @screenPositionForBufferPosition([row]).row if @isFoldedAtScreenRow(screenRow) @@ -684,14 +690,15 @@ class Editor extends Model endPosition = [endRow + 1] lines = @buffer.getTextInRange([[startRow], endPosition]) @buffer.deleteRows(startRow, endRow) - insertPosition = Point.min([startRow + 1], @buffer.getEofPosition()) + + insertPosition = Point.min([startRow + insertDelta], @buffer.getEofPosition()) if insertPosition.row is @buffer.getLastRow() and insertPosition.column > 0 lines = "\n#{lines}" @buffer.insert(insertPosition, lines) @foldBufferRow(foldedRow) for foldedRow in foldedRows - @setSelectedBufferRange(selection.translate([1]), preserveFolds: true) + @setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true) # Public: Duplicates the current line. # From 2579f2993babbe3541b673f7c5fe09113b2ad33b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:38:09 -0800 Subject: [PATCH 81/96] :lipstick: folded not folder --- spec/editor-view-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index af00b65de..864f3e229 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2631,7 +2631,7 @@ describe "EditorView", -> editorView.trigger 'editor:move-line-down' expect(editor.getCursorBufferPosition()).toEqual [1, 2] - describe "when the line below is folder", -> + describe "when the line below is folded", -> it "moves the line around the fold", -> editor.setCursorBufferPosition([0, 0]) editor.foldBufferRow(1) From a93bfb5f8ce4917d13c56da1c9c7336bb483dcb2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 11:05:10 -0800 Subject: [PATCH 82/96] Make sure moved lines don't go into a fold --- spec/editor-view-spec.coffee | 18 ++++++++++++++++++ src/editor.coffee | 11 +++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index 864f3e229..16e8c9a28 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2640,6 +2640,24 @@ describe "EditorView", -> expect(editor.getCursorBufferPosition()).toEqual [9, 0] expect(buffer.lineForRow(0)).toBe ' var sort = function(items) {' expect(buffer.lineForRow(9)).toBe 'var quicksort = function () {' + expect(editor.isFoldedAtBufferRow(0)).toBe true + expect(editor.isFoldedAtBufferRow(9)).toBe false + + describe "when line below is empty and the line below that is folded", -> + it "moves the line to the empty line", -> + editor.setCursorBufferPosition([0, Infinity]) + editor.insertText('\n') + editor.setCursorBufferPosition([0, 0]) + editor.foldBufferRow(2) + editorView.trigger 'editor:move-line-down' + + expect(editor.getCursorBufferPosition()).toEqual [1, 0] + expect(buffer.lineForRow(0)).toBe '' + expect(buffer.lineForRow(1)).toBe 'var quicksort = function () {' + expect(buffer.lineForRow(2)).toBe ' var sort = function(items) {' + expect(editor.isFoldedAtBufferRow(0)).toBe false + expect(editor.isFoldedAtBufferRow(1)).toBe false + expect(editor.isFoldedAtBufferRow(2)).toBe true describe "when the cursor is on the last line", -> it "does not move the line", -> diff --git a/src/editor.coffee b/src/editor.coffee index 55b15859e..2e3ac07cc 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -670,8 +670,9 @@ class Editor extends Model # Move line around the fold that is directly below the selection insertDelta = 1 - if foldRange = @languageMode.rowRangeForFoldAtBufferRow(selection.end.row + 1) - insertDelta += foldRange[1] - foldRange[0] + if @isFoldedAtBufferRow(selection.end.row + 1) + foldRange = @languageMode.rowRangeForFoldAtBufferRow(selection.end.row + 1) + insertDelta += foldRange[1] - foldRange[0] if foldRange? for row in rows screenRow = @screenPositionForBufferPosition([row]).row @@ -694,6 +695,12 @@ class Editor extends Model insertPosition = Point.min([startRow + insertDelta], @buffer.getEofPosition()) if insertPosition.row is @buffer.getLastRow() and insertPosition.column > 0 lines = "\n#{lines}" + + # Make sure the inserted text doesn't go into an existing fold + if @isFoldedAtBufferRow(insertPosition.row) + @destroyFoldsContainingBufferRow(insertPosition.row) + foldedRows.push(insertPosition.row + startRow - endRow + 1) + @buffer.insert(insertPosition, lines) @foldBufferRow(foldedRow) for foldedRow in foldedRows From 04c59952d5fed75a27fbf155f34a88b47c85c447 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 11:29:47 -0800 Subject: [PATCH 83/96] Support moving down folds around folds --- spec/editor-view-spec.coffee | 20 ++++++++++++++++++++ src/editor.coffee | 16 +++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index 16e8c9a28..5ee3ce4fc 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2643,6 +2643,26 @@ describe "EditorView", -> expect(editor.isFoldedAtBufferRow(0)).toBe true expect(editor.isFoldedAtBufferRow(9)).toBe false + describe "when the line being moved is folded", -> + it "moves the fold around the fold below it", -> + editor.setCursorBufferPosition([0, 0]) + editor.insertText """ + var a = function() { + b = 3; + }; + + """ + editor.foldBufferRow(0) + editor.foldBufferRow(3) + editor.setCursorBufferPosition([0, 0]) + editorView.trigger 'editor:move-line-down' + + expect(editor.getCursorBufferPosition()).toEqual [13, 0] + expect(buffer.lineForRow(0)).toBe 'var quicksort = function () {' + expect(buffer.lineForRow(13)).toBe 'var a = function() {' + expect(editor.isFoldedAtBufferRow(0)).toBe true + expect(editor.isFoldedAtBufferRow(13)).toBe true + describe "when line below is empty and the line below that is folded", -> it "moves the line to the empty line", -> editor.setCursorBufferPosition([0, Infinity]) diff --git a/src/editor.coffee b/src/editor.coffee index 2e3ac07cc..e08de5eae 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -669,10 +669,12 @@ class Editor extends Model rows.shift() unless @isFoldedAtBufferRow(selection.end.row) # Move line around the fold that is directly below the selection - insertDelta = 1 - if @isFoldedAtBufferRow(selection.end.row + 1) - foldRange = @languageMode.rowRangeForFoldAtBufferRow(selection.end.row + 1) - insertDelta += foldRange[1] - foldRange[0] if foldRange? + followingScreenRow = @screenPositionForBufferPosition([selection.end.row]).translate([1]) + followingBufferRow = @bufferPositionForScreenPosition(followingScreenRow).row + if fold = @largestFoldContainingBufferRow(followingBufferRow) + insertDelta = fold.getBufferRange().getRowCount() + else + insertDelta = 1 for row in rows screenRow = @screenPositionForBufferPosition([row]).row @@ -680,7 +682,7 @@ class Editor extends Model bufferRange = @bufferRangeForScreenRange([[screenRow], [screenRow + 1]]) startRow = bufferRange.start.row endRow = bufferRange.end.row - 1 - foldedRows.push(endRow + 1) + foldedRows.push(endRow + insertDelta) else startRow = row endRow = row @@ -697,9 +699,9 @@ class Editor extends Model lines = "\n#{lines}" # Make sure the inserted text doesn't go into an existing fold - if @isFoldedAtBufferRow(insertPosition.row) + if fold = @displayBuffer.largestFoldStartingAtBufferRow(insertPosition.row) @destroyFoldsContainingBufferRow(insertPosition.row) - foldedRows.push(insertPosition.row + startRow - endRow + 1) + foldedRows.push(insertPosition.row + fold.getBufferRange().getRowCount()) @buffer.insert(insertPosition, lines) From 905e456a153e3099bc49c93b8561c30bd270e9af Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 11:31:20 -0800 Subject: [PATCH 84/96] Only fold valid buffer rows --- src/editor.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index e08de5eae..fde4fbfef 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -705,7 +705,9 @@ class Editor extends Model @buffer.insert(insertPosition, lines) - @foldBufferRow(foldedRow) for foldedRow in foldedRows + # Restore folds that existed before the lines were moved + for foldedRow in foldedRows when foldedRow <= @getLastBufferRow() + @foldBufferRow(foldedRow) @setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true) From 32a15796c18bc29f19c94acb035631808fdecf84 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 11:33:42 -0800 Subject: [PATCH 85/96] Mention screen rows are used --- src/editor.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index fde4fbfef..664b34de6 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -621,7 +621,7 @@ class Editor extends Model largestFoldStartingAtScreenRow: (screenRow) -> @displayBuffer.largestFoldStartingAtScreenRow(screenRow) - # Public: Moves the selected lines up one row. + # Public: Moves the selected lines up one screen row. moveLineUp: -> selection = @getSelectedBufferRange() return if selection.start.row is 0 @@ -655,7 +655,7 @@ class Editor extends Model @setSelectedBufferRange(selection.translate([-1]), preserveFolds: true) - # Public: Moves the selected lines down one row. + # Public: Moves the selected lines down one screen row. moveLineDown: -> selection = @getSelectedBufferRange() lastRow = @buffer.getLastRow() From de88d6b62424f2120bac1bbeacf551f3721b0118 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 13:15:52 -0800 Subject: [PATCH 86/96] Support moving up folds around folds --- spec/editor-view-spec.coffee | 48 +++++++++++++++++++++++++++++++++++- src/editor.coffee | 35 +++++++++++++++++++------- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index 5ee3ce4fc..fb0e6c915 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -2532,6 +2532,52 @@ describe "EditorView", -> editorView.trigger 'editor:move-line-up' expect(editor.getCursorBufferPosition()).toEqual [0,2] + describe "when the line above is folded", -> + it "moves the line around the fold", -> + editor.foldBufferRow(1) + editor.setCursorBufferPosition([10, 0]) + editorView.trigger 'editor:move-line-up' + + expect(editor.getCursorBufferPosition()).toEqual [1, 0] + expect(buffer.lineForRow(1)).toBe '' + expect(buffer.lineForRow(2)).toBe ' var sort = function(items) {' + expect(editor.isFoldedAtBufferRow(1)).toBe false + expect(editor.isFoldedAtBufferRow(2)).toBe true + + describe "when the line being moved is folded", -> + it "moves the fold around the fold above it", -> + editor.setCursorBufferPosition([0, 0]) + editor.insertText """ + var a = function() { + b = 3; + }; + + """ + editor.foldBufferRow(0) + editor.foldBufferRow(3) + editor.setCursorBufferPosition([3, 0]) + editorView.trigger 'editor:move-line-up' + + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + expect(buffer.lineForRow(0)).toBe 'var quicksort = function () {' + expect(buffer.lineForRow(13)).toBe 'var a = function() {' + editor.logScreenLines() + expect(editor.isFoldedAtBufferRow(0)).toBe true + expect(editor.isFoldedAtBufferRow(13)).toBe true + + describe "when the line above is empty and the line above that is folded", -> + it "moves the line to the empty line", -> + editor.foldBufferRow(2) + editor.setCursorBufferPosition([11, 0]) + editorView.trigger 'editor:move-line-up' + + expect(editor.getCursorBufferPosition()).toEqual [10, 0] + expect(buffer.lineForRow(9)).toBe ' };' + expect(buffer.lineForRow(10)).toBe ' return sort(Array.apply(this, arguments));' + expect(buffer.lineForRow(11)).toBe '' + expect(editor.isFoldedAtBufferRow(2)).toBe true + expect(editor.isFoldedAtBufferRow(10)).toBe false + describe "where there is a selection", -> describe "when the selection falls inside the line", -> it "maintains the selection", -> @@ -2663,7 +2709,7 @@ describe "EditorView", -> expect(editor.isFoldedAtBufferRow(0)).toBe true expect(editor.isFoldedAtBufferRow(13)).toBe true - describe "when line below is empty and the line below that is folded", -> + describe "when the line below is empty and the line below that is folded", -> it "moves the line to the empty line", -> editor.setCursorBufferPosition([0, Infinity]) editor.insertText('\n') diff --git a/src/editor.coffee b/src/editor.coffee index 664b34de6..693f0d675 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -628,32 +628,49 @@ class Editor extends Model lastRow = @buffer.getLastRow() return if selection.isEmpty() and selection.start.row is lastRow and @buffer.getLastLine() is '' + # Move line around the fold that is directly above the selection + precedingScreenRow = @screenPositionForBufferPosition([selection.start.row]).translate([-1]) + precedingBufferRow = @bufferPositionForScreenPosition(precedingScreenRow).row + if fold = @largestFoldContainingBufferRow(precedingBufferRow) + insertDelta = fold.getBufferRange().getRowCount() + else + insertDelta = 1 + @transact => foldedRows = [] rows = [selection.start.row..selection.end.row] if selection.start.row isnt selection.end.row and selection.end.column is 0 rows.pop() unless @isFoldedAtBufferRow(selection.end.row) for row in rows - screenRow = @screenPositionForBufferPosition([row]).row - if @isFoldedAtScreenRow(screenRow) - bufferRange = @bufferRangeForScreenRange([[screenRow], [screenRow + 1]]) + if fold = @displayBuffer.largestFoldStartingAtBufferRow(row) + bufferRange = fold.getBufferRange() startRow = bufferRange.start.row - endRow = bufferRange.end.row - 1 - foldedRows.push(endRow - 1) + endRow = bufferRange.end.row + foldedRows.push(startRow - insertDelta) else startRow = row endRow = row + insertPosition = Point.fromObject([startRow - insertDelta]) endPosition = Point.min([endRow + 1], @buffer.getEofPosition()) lines = @buffer.getTextInRange([[startRow], endPosition]) if endPosition.row is lastRow and endPosition.column > 0 and not @buffer.lineEndingForRow(endPosition.row) lines = "#{lines}\n" + @buffer.deleteRows(startRow, endRow) - @buffer.insert([startRow - 1], lines) - @foldBufferRow(foldedRow) for foldedRow in foldedRows + # Make sure the inserted text doesn't go into an existing fold + if fold = @displayBuffer.largestFoldStartingAtBufferRow(insertPosition.row) + @destroyFoldsContainingBufferRow(insertPosition.row) + foldedRows.push(insertPosition.row + endRow - startRow + fold.getBufferRange().getRowCount()) - @setSelectedBufferRange(selection.translate([-1]), preserveFolds: true) + @buffer.insert(insertPosition, lines) + + # Restore folds that existed before the lines were moved + for foldedRow in foldedRows when 0 <= foldedRow <= @getLastBufferRow() + @foldBufferRow(foldedRow) + + @setSelectedBufferRange(selection.translate([-insertDelta]), preserveFolds: true) # Public: Moves the selected lines down one screen row. moveLineDown: -> @@ -706,7 +723,7 @@ class Editor extends Model @buffer.insert(insertPosition, lines) # Restore folds that existed before the lines were moved - for foldedRow in foldedRows when foldedRow <= @getLastBufferRow() + for foldedRow in foldedRows when 0 <= foldedRow <= @getLastBufferRow() @foldBufferRow(foldedRow) @setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true) From 04d858474252b1b71b313e601ee8f4d000fb9840 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 13:16:58 -0800 Subject: [PATCH 87/96] Use fold directly --- src/editor.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 693f0d675..c9e15a883 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -694,11 +694,10 @@ class Editor extends Model insertDelta = 1 for row in rows - screenRow = @screenPositionForBufferPosition([row]).row - if @isFoldedAtScreenRow(screenRow) - bufferRange = @bufferRangeForScreenRange([[screenRow], [screenRow + 1]]) + if fold = @displayBuffer.largestFoldStartingAtBufferRow(row) + bufferRange = fold.getBufferRange() startRow = bufferRange.start.row - endRow = bufferRange.end.row - 1 + endRow = bufferRange.end.row foldedRows.push(endRow + insertDelta) else startRow = row From d6fc3e6d0145ba6cdc101f498f4fd52d87ea0808 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 13:18:10 -0800 Subject: [PATCH 88/96] Move insertDelta computation under transact call --- src/editor.coffee | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index c9e15a883..adfcd2c65 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -628,19 +628,20 @@ class Editor extends Model lastRow = @buffer.getLastRow() return if selection.isEmpty() and selection.start.row is lastRow and @buffer.getLastLine() is '' - # Move line around the fold that is directly above the selection - precedingScreenRow = @screenPositionForBufferPosition([selection.start.row]).translate([-1]) - precedingBufferRow = @bufferPositionForScreenPosition(precedingScreenRow).row - if fold = @largestFoldContainingBufferRow(precedingBufferRow) - insertDelta = fold.getBufferRange().getRowCount() - else - insertDelta = 1 - @transact => foldedRows = [] rows = [selection.start.row..selection.end.row] if selection.start.row isnt selection.end.row and selection.end.column is 0 rows.pop() unless @isFoldedAtBufferRow(selection.end.row) + + # Move line around the fold that is directly above the selection + precedingScreenRow = @screenPositionForBufferPosition([selection.start.row]).translate([-1]) + precedingBufferRow = @bufferPositionForScreenPosition(precedingScreenRow).row + if fold = @largestFoldContainingBufferRow(precedingBufferRow) + insertDelta = fold.getBufferRange().getRowCount() + else + insertDelta = 1 + for row in rows if fold = @displayBuffer.largestFoldStartingAtBufferRow(row) bufferRange = fold.getBufferRange() From 0e60d73b1047246cb2e6ddbd054c32a0303ef687 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:17:38 -0800 Subject: [PATCH 89/96] Use info alert until suite completes or failure occurs --- spec/atom-reporter.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 717217c65..aca1da3ff 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -43,7 +43,7 @@ class AtomReporter extends View @div outlet: 'userArea', class: 'symbol-area', => @div outlet: 'userHeader', class: 'symbol-header' @ul outlet: 'userSummary', class: 'symbol-summary list-unstyled' - @div outlet: "status", class: 'status alert alert-success', => + @div outlet: "status", class: 'status alert alert-info', => @div outlet: "time", class: 'time' @div outlet: "specCount", class: 'spec-count' @div outlet: "message", class: 'message' @@ -68,6 +68,7 @@ class AtomReporter extends View reportRunnerResults: (runner) -> @updateSpecCounts() + @status.addClass('alert-success').removeClass('alert-info') if @failedCount is 0 if @failedCount is 1 @message.text "#{@failedCount} failure" else @@ -101,7 +102,7 @@ class AtomReporter extends View updateStatusView: (spec) -> if @failedCount > 0 - @status.addClass('alert-danger').removeClass('alert-success') + @status.addClass('alert-danger').removeClass('alert-info') @updateSpecCounts() From f9d70e56236251b8faad69cafdd6998755101fea Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:19:46 -0800 Subject: [PATCH 90/96] Make skipped specs yellowish --- static/jasmine.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/jasmine.less b/static/jasmine.less index aced4f449..432f44c0f 100644 --- a/static/jasmine.less +++ b/static/jasmine.less @@ -50,7 +50,7 @@ body { } &.skipped { - color: #ddd; + color: #f0ad4e; } &.pending { From 1302a38ddf3a67dd5e6b53cd39354dff81705f34 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 11 Feb 2014 16:47:44 -0800 Subject: [PATCH 91/96] Upgrade to find-and-replace@0.82.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da750307a..9edc28134 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "editor-stats": "0.13.0", "exception-reporting": "0.13.0", "feedback": "0.23.0", - "find-and-replace": "0.81.0", + "find-and-replace": "0.82.0", "fuzzy-finder": "0.34.0", "gists": "0.17.0", "git-diff": "0.24.0", From 7d7f208fc5aa6df1623d832a122ae1ad59be4374 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:46:56 -0800 Subject: [PATCH 92/96] Add missing keybidings to menu This was caused by the test element not simulating a div element with the .workspace class. --- src/menu-manager.coffee | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 710d7e377..1ad4e32bb 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -48,14 +48,19 @@ class MenuManager includeSelector: (selector) -> return true if document.body.webkitMatchesSelector(selector) - # Simulate an .editor element attached to a body element that has the same - # classes as the current body element. + # Simulate an .editor element attached to a .workspace element attached to + # a body element that has the same classes as the current body element. unless @testEditor? - @testEditor = document.createElement('div') - @testEditor.classList.add('editor') testBody = document.createElement('body') testBody.classList.add(document.body.classList.toString().split(' ')...) - testBody.appendChild(@testEditor) + + testWorkspace = document.createElement('body') + testWorkspace.classList.add(document.body.querySelector('.workspace').classList.toString().split(' ')...) + testBody.appendChild(testWorkspace) + + @testEditor = document.createElement('div') + @testEditor.classList.add('editor') + testWorkspace.appendChild(@testEditor) @testEditor.webkitMatchesSelector(selector) From 8b1b3d237d39694375c4bd19e42f6b69208e9354 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:53:00 -0800 Subject: [PATCH 93/96] Init pendingUpdateOperation in ctor --- src/menu-manager.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 1ad4e32bb..f5a80e622 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -11,9 +11,8 @@ fs = require 'fs-plus' # An instance of this class is always available as the `atom.menu` global. module.exports = class MenuManager - pendingUpdateOperation: null - constructor: ({@resourcePath}) -> + @pendingUpdateOperation = null @template = [] atom.keymap.on 'bundled-keymaps-loaded', => @loadPlatformItems() From 29cbea4d50aee62ac113a16a27b694e9b4b43fbb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:53:36 -0800 Subject: [PATCH 94/96] :memo: optional not option --- src/menu-manager.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index f5a80e622..66fbe49ef 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -31,7 +31,8 @@ class MenuManager # items - An {Array} of menu item {Object}s containing the keys: # :label - The {String} menu label. # :submenu - An optional {Array} of sub menu items. - # :command - An option {String} command to trigger when the item is clicked. + # :command - An optional {String} command to trigger when the item is + # clicked. # # Returns nothing. add: (items) -> From cc890ebdc0754da17fa8e9245c2f28da47be7bbb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 16:56:29 -0800 Subject: [PATCH 95/96] Add editor.fontFamily config default This causes it to display in the settings view. --- src/editor-view.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 19636802a..a666c653c 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -26,6 +26,7 @@ module.exports = class EditorView extends View @characterWidthCache: {} @configDefaults: + fontFamily: '' fontSize: 20 showInvisibles: false showIndentGuide: false From fb73240654d4419d4955b35e3e54645fe0c2a27e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 17:13:37 -0800 Subject: [PATCH 96/96] Guard against non-existent .workspace element --- src/menu-manager.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 66fbe49ef..82e8512a7 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -52,10 +52,12 @@ class MenuManager # a body element that has the same classes as the current body element. unless @testEditor? testBody = document.createElement('body') - testBody.classList.add(document.body.classList.toString().split(' ')...) + testBody.classList.add(@classesForElement(document.body)...) testWorkspace = document.createElement('body') - testWorkspace.classList.add(document.body.querySelector('.workspace').classList.toString().split(' ')...) + workspaceClasses = @classesForElement(document.body.querySelector('.workspace')) ? ['.workspace'] + testWorkspace.classList.add(workspaceClasses...) + testBody.appendChild(testWorkspace) @testEditor = document.createElement('div') @@ -114,3 +116,7 @@ class MenuManager label.replace(/\&/g, '') else label + + # Get an {Array} of {String} classes for the given element. + classesForElement: (element) -> + element?.classList.toString().split(' ') ? []