From 13f220d285f7e1cd04fd1cccf3a641643c9572f5 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 14 Dec 2015 20:30:34 -0800 Subject: [PATCH 01/16] :memo: Linkify all docs mentions of Promises --- src/default-directory-provider.coffee | 2 +- src/project.coffee | 4 ++-- src/workspace.coffee | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index da2d17593..6b05a582f 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -37,7 +37,7 @@ class DefaultDirectoryProvider # * `uri` {String} The path to the directory to add. This is guaranteed not to # be contained by a {Directory} in `atom.project`. # - # Returns a Promise that resolves to: + # Returns a {Promise} that resolves to: # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURI: (uri) -> diff --git a/src/project.coffee b/src/project.coffee index d59c041cb..eebab7079 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -329,7 +329,7 @@ class Project extends Model # # * `filePath` A {String} representing a path. If `null`, an "Untitled" buffer is created. # - # Returns a promise that resolves to the {TextBuffer}. + # Returns a {Promise} that resolves to the {TextBuffer}. bufferForPath: (absoluteFilePath) -> existingBuffer = @findBufferForPath(absoluteFilePath) if absoluteFilePath? if existingBuffer @@ -349,7 +349,7 @@ class Project extends Model # * `absoluteFilePath` A {String} representing a path. # * `text` The {String} text to use as a buffer. # - # Returns a promise that resolves to the {TextBuffer}. + # Returns a {Promise} that resolves to the {TextBuffer}. buildBuffer: (absoluteFilePath) -> buffer = new TextBuffer({filePath: absoluteFilePath}) @addBuffer(buffer) diff --git a/src/workspace.coffee b/src/workspace.coffee index f64f58ee0..41838d8bf 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -403,7 +403,7 @@ class Workspace extends Model # If `false`, only the active pane will be searched for # an existing item for the same URI. Defaults to `false`. # - # Returns a promise that resolves to the {TextEditor} for the file URI. + # Returns a {Promise} that resolves to the {TextEditor} for the file URI. open: (uri, options={}) -> searchAllPanes = options.searchAllPanes split = options.split @@ -544,7 +544,7 @@ class Workspace extends Model # Public: Asynchronously reopens the last-closed item's URI if it hasn't already been # reopened. # - # Returns a promise that is resolved when the item is opened + # Returns a {Promise} that is resolved when the item is opened reopenItem: -> if uri = @destroyedItemURIs.pop() @open(uri) @@ -881,7 +881,7 @@ class Workspace extends Model # with number of paths searched. # * `iterator` {Function} callback on each file found. # - # Returns a `Promise` with a `cancel()` method that will cancel all + # Returns a {Promise} with a `cancel()` method that will cancel all # of the underlying searches that were started as part of this scan. scan: (regex, options={}, iterator) -> if _.isFunction(options) @@ -984,7 +984,7 @@ class Workspace extends Model # * `iterator` A {Function} callback on each file with replacements: # * `options` {Object} with keys `filePath` and `replacements`. # - # Returns a `Promise`. + # Returns a {Promise}. replace: (regex, replacementText, filePaths, iterator) -> new Promise (resolve, reject) => openPaths = (buffer.getPath() for buffer in @project.getBuffers()) From 80a8f83f04857a3a0a5a74425f397990dcbe9bf8 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 16:32:02 -0500 Subject: [PATCH 02/16] :arrow_up: nodegit@0.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36f7f937b..03e8cd8d0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "less-cache": "0.22", "line-top-index": "0.2.0", "marked": "^0.3.4", - "nodegit": "0.7.0", + "nodegit": "0.8.0", "normalize-package-data": "^2.0.0", "nslog": "^3", "oniguruma": "^5", From 0332c8aab384eb9ba5f33da90f6303de10ff7781 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 16:33:20 -0500 Subject: [PATCH 03/16] Enable thread safety. --- src/git-repository-async.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 5e5a07ea9..f40172c69 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -32,6 +32,8 @@ export default class GitRepositoryAsync { } constructor (_path, options = {}) { + Git.enableThreadSafety() + this.emitter = new Emitter() this.subscriptions = new CompositeDisposable() this.pathStatusCache = {} From d9cf7a73c6cfd94707184e90cdc2bd1ec3ce133b Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 17:02:18 -0500 Subject: [PATCH 04/16] Wait a tick before checking for path subscriptions? --- spec/spec-helper.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 758a232aa..9527c3322 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -112,6 +112,7 @@ afterEach -> document.getElementById('jasmine-content').innerHTML = '' unless window.debugContent + waits(0) ensureNoPathSubscriptions() waits(0) # yield to ui thread to make screen update more frequently From e5aebcb351cd9f6b1665b5bbeb453a3cc8642e4e Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 17:36:22 -0500 Subject: [PATCH 05/16] Revert "Wait a tick before checking for path subscriptions?" This reverts commit d9cf7a73c6cfd94707184e90cdc2bd1ec3ce133b. --- spec/spec-helper.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 9527c3322..758a232aa 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -112,7 +112,6 @@ afterEach -> document.getElementById('jasmine-content').innerHTML = '' unless window.debugContent - waits(0) ensureNoPathSubscriptions() waits(0) # yield to ui thread to make screen update more frequently From 1fb137676988208fdd9bca8bbf167e56db47fd55 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 17:40:14 -0500 Subject: [PATCH 06/16] Even more async. --- spec/git-repository-async-spec.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index 17c3a4eb2..e1b48da4c 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -234,7 +234,7 @@ describe('GitRepositoryAsync', () => { let filePath let editor - beforeEach(() => { + beforeEach(async () => { spyOn(atom, 'confirm') const workingDirPath = copyRepository() @@ -242,12 +242,7 @@ describe('GitRepositoryAsync', () => { filePath = path.join(workingDirPath, 'a.txt') fs.writeFileSync(filePath, 'ch ch changes') - waitsForPromise(() => atom.workspace.open(filePath)) - runs(() => editor = atom.workspace.getActiveTextEditor()) - }) - - afterEach(() => { - editor = null + editor = await atom.workspace.open(filePath) }) it('displays a confirmation dialog by default', async () => { From 7ab501ce9d3556641a086f208dd76e51c44742e7 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 15 Jan 2016 17:42:48 -0500 Subject: [PATCH 07/16] Disable the test for now. --- spec/git-repository-async-spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index e1b48da4c..dfc3d5803 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -230,7 +230,9 @@ describe('GitRepositoryAsync', () => { }) }) - describe('.checkoutHeadForEditor(editor)', () => { + // @joshaber: Disabling for now. There seems to be some race with path + // subscriptions leading to intermittent test failures, e.g.: https://travis-ci.org/atom/atom/jobs/102702554 + xdescribe('.checkoutHeadForEditor(editor)', () => { let filePath let editor From 5a2c8ff9622b2359011f1aa297c3d28c04ef103f Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Sat, 16 Jan 2016 13:21:11 +0530 Subject: [PATCH 08/16] Update license year to 2016 --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index bbb875dc2..4e47b02a2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2015 GitHub Inc. +Copyright (c) 2016 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From 44894203e7f309cbac52bf5e062d0ed25213ac3b Mon Sep 17 00:00:00 2001 From: Josh Abernathy Date: Sun, 17 Jan 2016 00:07:50 -0500 Subject: [PATCH 09/16] Force 32-bit binaries from node-pre-gyp. --- script/bootstrap | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script/bootstrap b/script/bootstrap index 72c12aedf..f3b210d2a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -89,6 +89,11 @@ function bootstrap() { // proper binaries. var electronVersion = require('../package.json').electronVersion; moduleInstallEnv.npm_config_target = electronVersion; + + // Atom on Windows is always 32-bit currently. + if (process.platform === 'win32') { + moduleInstallEnv.npm_config_target_arch = 'ia32'; + } var moduleInstallOptions = {env: moduleInstallEnv}; if (process.argv.indexOf('--no-quiet') === -1) { From e87c90449e9f800123d417ad24594bb08b7db543 Mon Sep 17 00:00:00 2001 From: Josh Abernathy Date: Sun, 17 Jan 2016 15:45:30 -0500 Subject: [PATCH 10/16] Revert "Always set the architecture to ia32 on Windows." This reverts commit 5c77effc207fbe383a95b4b01c28a491d5e67039. --- script/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index f3b210d2a..6eebebe9a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -107,7 +107,7 @@ function bootstrap() { // apm ships with 32-bit node so make sure its native modules are compiled // for a 32-bit target architecture - if (process.platform === 'win32') + if (process.env.JANKY_SHA1 && process.platform === 'win32') apmInstallCommand += ' --arch=ia32'; var commands = [ From 032a734325cfcab15792458174648a5a9126f6fa Mon Sep 17 00:00:00 2001 From: Josh Abernathy Date: Sun, 17 Jan 2016 15:47:18 -0500 Subject: [PATCH 11/16] A better description of why we're forcing 32-bit. --- script/bootstrap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index 6eebebe9a..83ec712ff 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -90,7 +90,8 @@ function bootstrap() { var electronVersion = require('../package.json').electronVersion; moduleInstallEnv.npm_config_target = electronVersion; - // Atom on Windows is always 32-bit currently. + // Force 32-bit modules on Windows. + // /cc https://github.com/atom/atom/issues/10450 if (process.platform === 'win32') { moduleInstallEnv.npm_config_target_arch = 'ia32'; } From 962308509b5452eb9e4d37badf32eedc7cc7f7b1 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 18 Jan 2016 16:11:40 -0800 Subject: [PATCH 12/16] Honor `created()` function for an item in a submenu. Fixes #10483. --- src/context-menu-manager.coffee | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 869076beb..88cdc67b2 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -136,12 +136,9 @@ class ContextMenuManager for itemSet in matchingItemSets for item in itemSet.items - continue if item.devMode and not @devMode - item = Object.create(item) - if typeof item.shouldDisplay is 'function' - continue unless item.shouldDisplay(event) - item.created?(event) - MenuHelpers.merge(currentTargetItems, item, itemSet.specificity) + itemForEvent = @cloneItemForEvent(item, event) + if itemForEvent + MenuHelpers.merge(currentTargetItems, itemForEvent, itemSet.specificity) for item in currentTargetItems MenuHelpers.merge(template, item, false) @@ -150,6 +147,19 @@ class ContextMenuManager template + # Returns an object compatible with `::add()` or `null`. + cloneItemForEvent: (item, event) -> + return null if item.devMode and not @devMode + item = Object.create(item) + if typeof item.shouldDisplay is 'function' + return null unless item.shouldDisplay(event) + item.created?(event) + if Array.isArray(item.submenu) + item.submenu = item.submenu + .map((item) => @cloneItemForEvent(item, event)) + .filter((item) -> item isnt null) + return item + convertLegacyItemsBySelector: (legacyItemsBySelector, devMode) -> itemsBySelector = {} From f8d20760afb403a42bbedcf9dacd0775bf385360 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 18 Jan 2016 16:33:35 -0800 Subject: [PATCH 13/16] Revert "Honor `created()` function for an item in a submenu." This reverts commit 962308509b5452eb9e4d37badf32eedc7cc7f7b1. --- src/context-menu-manager.coffee | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 88cdc67b2..869076beb 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -136,9 +136,12 @@ class ContextMenuManager for itemSet in matchingItemSets for item in itemSet.items - itemForEvent = @cloneItemForEvent(item, event) - if itemForEvent - MenuHelpers.merge(currentTargetItems, itemForEvent, itemSet.specificity) + continue if item.devMode and not @devMode + item = Object.create(item) + if typeof item.shouldDisplay is 'function' + continue unless item.shouldDisplay(event) + item.created?(event) + MenuHelpers.merge(currentTargetItems, item, itemSet.specificity) for item in currentTargetItems MenuHelpers.merge(template, item, false) @@ -147,19 +150,6 @@ class ContextMenuManager template - # Returns an object compatible with `::add()` or `null`. - cloneItemForEvent: (item, event) -> - return null if item.devMode and not @devMode - item = Object.create(item) - if typeof item.shouldDisplay is 'function' - return null unless item.shouldDisplay(event) - item.created?(event) - if Array.isArray(item.submenu) - item.submenu = item.submenu - .map((item) => @cloneItemForEvent(item, event)) - .filter((item) -> item isnt null) - return item - convertLegacyItemsBySelector: (legacyItemsBySelector, devMode) -> itemsBySelector = {} From 9917ed39aa30e00e3300638e5da5a4dd6559b6b4 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 18 Jan 2016 16:34:36 -0800 Subject: [PATCH 14/16] Honor `created()` function for an item in a submenu. Fixes #10483. --- src/context-menu-manager.coffee | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 869076beb..88cdc67b2 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -136,12 +136,9 @@ class ContextMenuManager for itemSet in matchingItemSets for item in itemSet.items - continue if item.devMode and not @devMode - item = Object.create(item) - if typeof item.shouldDisplay is 'function' - continue unless item.shouldDisplay(event) - item.created?(event) - MenuHelpers.merge(currentTargetItems, item, itemSet.specificity) + itemForEvent = @cloneItemForEvent(item, event) + if itemForEvent + MenuHelpers.merge(currentTargetItems, itemForEvent, itemSet.specificity) for item in currentTargetItems MenuHelpers.merge(template, item, false) @@ -150,6 +147,19 @@ class ContextMenuManager template + # Returns an object compatible with `::add()` or `null`. + cloneItemForEvent: (item, event) -> + return null if item.devMode and not @devMode + item = Object.create(item) + if typeof item.shouldDisplay is 'function' + return null unless item.shouldDisplay(event) + item.created?(event) + if Array.isArray(item.submenu) + item.submenu = item.submenu + .map((item) => @cloneItemForEvent(item, event)) + .filter((item) -> item isnt null) + return item + convertLegacyItemsBySelector: (legacyItemsBySelector, devMode) -> itemsBySelector = {} From 04b100fab86eec6148176cab6ac70bf95000de15 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 18 Jan 2016 16:36:49 -0800 Subject: [PATCH 15/16] Revert "Honor `created()` function for an item in a submenu." This reverts commit 9917ed39aa30e00e3300638e5da5a4dd6559b6b4. Sorry, apparently I don't know how to use Git anymore. I'm just trying to put this up for review and it went straight to master instead. --- src/context-menu-manager.coffee | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 88cdc67b2..869076beb 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -136,9 +136,12 @@ class ContextMenuManager for itemSet in matchingItemSets for item in itemSet.items - itemForEvent = @cloneItemForEvent(item, event) - if itemForEvent - MenuHelpers.merge(currentTargetItems, itemForEvent, itemSet.specificity) + continue if item.devMode and not @devMode + item = Object.create(item) + if typeof item.shouldDisplay is 'function' + continue unless item.shouldDisplay(event) + item.created?(event) + MenuHelpers.merge(currentTargetItems, item, itemSet.specificity) for item in currentTargetItems MenuHelpers.merge(template, item, false) @@ -147,19 +150,6 @@ class ContextMenuManager template - # Returns an object compatible with `::add()` or `null`. - cloneItemForEvent: (item, event) -> - return null if item.devMode and not @devMode - item = Object.create(item) - if typeof item.shouldDisplay is 'function' - return null unless item.shouldDisplay(event) - item.created?(event) - if Array.isArray(item.submenu) - item.submenu = item.submenu - .map((item) => @cloneItemForEvent(item, event)) - .filter((item) -> item isnt null) - return item - convertLegacyItemsBySelector: (legacyItemsBySelector, devMode) -> itemsBySelector = {} From a797c9b9f8ebca19cf879751230a37e2433cd14b Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Tue, 19 Jan 2016 09:53:07 -0500 Subject: [PATCH 16/16] :arrow_up: language-javascript@0.106.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d8d6d975..8adda4a92 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "language-html": "0.44.0", "language-hyperlink": "0.16.0", "language-java": "0.17.0", - "language-javascript": "0.105.0", + "language-javascript": "0.106.0", "language-json": "0.17.3", "language-less": "0.29.0", "language-make": "0.21.0",