From e5901d7414563e71f74646dd8c0c8713697be33a Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sat, 4 Nov 2017 18:12:08 +0100 Subject: [PATCH 001/184] Activate package when deserializing --- src/package.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/package.coffee b/src/package.coffee index 1635c75dc..b46481e82 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -26,6 +26,7 @@ class Package mainModule: null mainInitialized: false mainActivated: false + deserialized: false ### Section: Construction @@ -380,6 +381,7 @@ class Package @deserializerManager.add name: deserializerName, deserialize: (state, atomEnvironment) => + @deserialized = true @registerViewProviders() @requireMainModule() @initializeIfNeeded() @@ -611,7 +613,7 @@ class Package @mainModulePath = fs.resolveExtension(mainModulePath, ["", CompileCache.supportedExtensions...]) activationShouldBeDeferred: -> - @hasActivationCommands() or @hasActivationHooks() or @hasDeferredURIHandler() + (@hasActivationCommands() or @hasActivationHooks() or @hasDeferredURIHandler()) and not @deserialized hasActivationHooks: -> @getActivationHooks()?.length > 0 From 9a402392abc92e7c60ba14efd718830750d3593a Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Thu, 9 Nov 2017 01:28:11 +0100 Subject: [PATCH 002/184] Add specs --- .../index.js | 25 +++++++++ .../package.json | 14 +++++ spec/package-manager-spec.js | 53 ++++++++++++++++++- spec/package-spec.coffee | 4 +- src/package.coffee | 5 +- 5 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 spec/fixtures/packages/package-with-activation-commands-and-deserializers/index.js create mode 100644 spec/fixtures/packages/package-with-activation-commands-and-deserializers/package.json diff --git a/spec/fixtures/packages/package-with-activation-commands-and-deserializers/index.js b/spec/fixtures/packages/package-with-activation-commands-and-deserializers/index.js new file mode 100644 index 000000000..28c7c70b4 --- /dev/null +++ b/spec/fixtures/packages/package-with-activation-commands-and-deserializers/index.js @@ -0,0 +1,25 @@ +module.exports = { + activateCallCount: 0, + activationCommandCallCount: 0, + + initialize() {}, + activate () { + this.activateCallCount++ + + atom.commands.add('atom-workspace', 'activation-command-2', () => this.activationCommandCallCount++) + }, + + deserializeMethod1 (state) { + return { + wasDeserializedBy: 'deserializeMethod1', + state: state + } + }, + + deserializeMethod2 (state) { + return { + wasDeserializedBy: 'deserializeMethod2', + state: state + } + } +} diff --git a/spec/fixtures/packages/package-with-activation-commands-and-deserializers/package.json b/spec/fixtures/packages/package-with-activation-commands-and-deserializers/package.json new file mode 100644 index 000000000..0a1ded445 --- /dev/null +++ b/spec/fixtures/packages/package-with-activation-commands-and-deserializers/package.json @@ -0,0 +1,14 @@ +{ + "name": "package-with-activation-commands-and-deserializers", + "version": "1.0.0", + "main": "./index", + "activationCommands": { + "atom-workspace": [ + "activation-command-2" + ] + }, + "deserializers": { + "Deserializer1": "deserializeMethod1", + "Deserializer2": "deserializeMethod2" + } +} diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index 0b26bf839..c3d7e355c 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -514,6 +514,10 @@ describe('PackageManager', () => { }) describe('when the package has a main module', () => { + beforeEach(() => { + spyOn(Package.prototype, 'requireMainModule').andCallThrough() + }) + describe('when the metadata specifies a main module path˜', () => { it('requires the module at the specified path', async () => { const mainModule = require('./fixtures/packages/package-with-main/main-module') @@ -555,10 +559,9 @@ describe('PackageManager', () => { mainModule = require('./fixtures/packages/package-with-activation-commands/index') mainModule.activationCommandCallCount = 0 spyOn(mainModule, 'activate').andCallThrough() - spyOn(Package.prototype, 'requireMainModule').andCallThrough() workspaceCommandListener = jasmine.createSpy('workspaceCommandListener') - registration = atom.commands.add('.workspace', 'activation-command', workspaceCommandListener) + registration = atom.commands.add('atom-workspace', 'activation-command', workspaceCommandListener) promise = atom.packages.activatePackage('package-with-activation-commands') }) @@ -661,6 +664,52 @@ describe('PackageManager', () => { expect(notificationEvent.message).toContain('Failed to load the package-with-invalid-settings package settings') expect(notificationEvent.options.packageName).toEqual('package-with-invalid-settings') }) + + describe('when the package metadata includes both activation commands and deserializers', () => { + let mainModule, promise, workspaceCommandListener, registration + + beforeEach(() => { + jasmine.attachToDOM(atom.workspace.getElement()) + mainModule = require('./fixtures/packages/package-with-activation-commands-and-deserializers/index') + mainModule.activationCommandCallCount = 0 + spyOn(mainModule, 'activate').andCallThrough() + workspaceCommandListener = jasmine.createSpy('workspaceCommandListener') + registration = atom.commands.add('.workspace', 'activation-command-2', workspaceCommandListener) + + promise = atom.packages.activatePackage('package-with-activation-commands-and-deserializers') + }) + + afterEach(() => { + if (registration) { + registration.dispose() + } + mainModule = null + }) + + it('activates the package when a deserializer is called', async () => { + expect(Package.prototype.requireMainModule.callCount).toBe(0) + + const state1 = {deserializer: 'Deserializer1', a: 'b'} + expect(atom.deserializers.deserialize(state1)).toEqual({ + wasDeserializedBy: 'deserializeMethod1', + state: state1 + }) + + await promise + expect(Package.prototype.requireMainModule.callCount).toBe(1) + }) + + it('defers requiring/activating the main module until an activation event bubbles to the root view', async () => { + expect(Package.prototype.requireMainModule.callCount).toBe(0) + + atom.workspace.getElement().dispatchEvent(new CustomEvent('activation-command-2', {bubbles: true})) + + await promise + expect(mainModule.activate.callCount).toBe(1) + expect(mainModule.activationCommandCallCount).toBe(1) + expect(Package.prototype.requireMainModule.callCount).toBe(1) + }) + }) }) }) diff --git a/spec/package-spec.coffee b/spec/package-spec.coffee index e7bfd0249..37ba29883 100644 --- a/spec/package-spec.coffee +++ b/spec/package-spec.coffee @@ -4,9 +4,9 @@ ThemePackage = require '../src/theme-package' {mockLocalStorage} = require './spec-helper' describe "Package", -> - build = (constructor, path) -> + build = (constructor, packagePath) -> new constructor( - path: path, packageManager: atom.packages, config: atom.config, + path: packagePath, packageManager: atom.packages, config: atom.config, styleManager: atom.styles, notificationManager: atom.notifications, keymapManager: atom.keymaps, commandRegistry: atom.command, grammarRegistry: atom.grammars, themeManager: atom.themes, diff --git a/src/package.coffee b/src/package.coffee index b46481e82..46a9a82a8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -184,6 +184,7 @@ class Package @requireMainModule() unless @mainModule? @configSchemaRegisteredOnActivate = @registerConfigSchemaFromMainModule() @registerViewProviders() + @activateResources() @activateStylesheets() if @mainModule? and not @mainActivated @initializeIfNeeded() @@ -382,9 +383,7 @@ class Package name: deserializerName, deserialize: (state, atomEnvironment) => @deserialized = true - @registerViewProviders() - @requireMainModule() - @initializeIfNeeded() + @activateNow() @mainModule[methodName](state, atomEnvironment) return From 2da5f45c28e8e8bf466fed89414f969654c0cea7 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Tue, 14 Nov 2017 00:47:05 +0100 Subject: [PATCH 003/184] Allow activation to be deferred if `workspaceOpeners` is present Fixes the case where `pane:reopen-closed-item` is called and the item happens to be a URI for a package whose activation is deferred --- src/package.coffee | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index 46a9a82a8..d16c05c5f 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -194,6 +194,7 @@ class Package @activateServices() @activationCommandSubscriptions?.dispose() @activationHookSubscriptions?.dispose() + @workspaceOpenerSubscriptions?.dispose() catch error @handleError("Failed to activate the #{@name} package", error) @@ -612,22 +613,26 @@ class Package @mainModulePath = fs.resolveExtension(mainModulePath, ["", CompileCache.supportedExtensions...]) activationShouldBeDeferred: -> - (@hasActivationCommands() or @hasActivationHooks() or @hasDeferredURIHandler()) and not @deserialized - - hasActivationHooks: -> - @getActivationHooks()?.length > 0 + (@hasActivationCommands() or @hasActivationHooks() or @hasWorkspaceOpeners() or @hasDeferredURIHandler()) and not @deserialized hasActivationCommands: -> for selector, commands of @getActivationCommands() return true if commands.length > 0 false + hasActivationHooks: -> + @getActivationHooks()?.length > 0 + + hasWorkspaceOpeners: -> + @getWorkspaceOpeners()?.length > 0 + hasDeferredURIHandler: -> @getURIHandler() and @getURIHandler().deferActivation isnt false subscribeToDeferredActivation: -> @subscribeToActivationCommands() @subscribeToActivationHooks() + @subscribeToWorkspaceOpeners() subscribeToActivationCommands: -> @activationCommandSubscriptions = new CompositeDisposable @@ -693,6 +698,29 @@ class Package @activationHooks = _.uniq(@activationHooks) + subscribeToWorkspaceOpeners: -> + @workspaceOpenerSubscriptions = new CompositeDisposable + for opener in @getWorkspaceOpeners() + do (opener) => + @workspaceOpenerSubscriptions.add atom.workspace.addOpener (filePath) => + if filePath is opener + @activateNow() + @workspaceOpenerSubscriptions.dispose() + atom.workspace.open(opener) + + getWorkspaceOpeners: -> + return @workspaceOpeners if @workspaceOpeners? + + @workspaceOpeners = [] + + if @metadata.workspaceOpeners? + if _.isArray(@metadata.workspaceOpeners) + @workspaceOpeners.push(@metadata.workspaceOpeners...) + else if _.isString(@metadata.workspaceOpeners) + @workspaceOpeners.push(@metadata.workspaceOpeners) + + @workspaceOpeners = _.uniq(@workspaceOpeners) + getURIHandler: -> @metadata?.uriHandler From 2eb9fc184bdb7ea58ac17f8b5185891603fbe698 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 15 Nov 2017 00:42:15 +0100 Subject: [PATCH 004/184] Oops --- spec/package-manager-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index c3d7e355c..96444b659 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -664,6 +664,7 @@ describe('PackageManager', () => { expect(notificationEvent.message).toContain('Failed to load the package-with-invalid-settings package settings') expect(notificationEvent.options.packageName).toEqual('package-with-invalid-settings') }) + }) describe('when the package metadata includes both activation commands and deserializers', () => { let mainModule, promise, workspaceCommandListener, registration @@ -710,7 +711,6 @@ describe('PackageManager', () => { expect(Package.prototype.requireMainModule.callCount).toBe(1) }) }) - }) }) describe('when the package metadata includes `activationHooks`', () => { From c747711be50e4c53e465c12ebf434745832c9934 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 15 Nov 2017 00:53:56 +0100 Subject: [PATCH 005/184] Add specs for workspaceOpeners --- .../index.coffee | 1 + .../package.json | 5 ++++ .../index.coffee | 9 ++++++ .../package.cson | 5 ++++ spec/package-manager-spec.js | 29 +++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 spec/fixtures/packages/package-with-empty-workspace-openers/index.coffee create mode 100644 spec/fixtures/packages/package-with-empty-workspace-openers/package.json create mode 100644 spec/fixtures/packages/package-with-workspace-openers/index.coffee create mode 100644 spec/fixtures/packages/package-with-workspace-openers/package.cson diff --git a/spec/fixtures/packages/package-with-empty-workspace-openers/index.coffee b/spec/fixtures/packages/package-with-empty-workspace-openers/index.coffee new file mode 100644 index 000000000..78d8802a9 --- /dev/null +++ b/spec/fixtures/packages/package-with-empty-workspace-openers/index.coffee @@ -0,0 +1 @@ +module.exports = activate: -> diff --git a/spec/fixtures/packages/package-with-empty-workspace-openers/package.json b/spec/fixtures/packages/package-with-empty-workspace-openers/package.json new file mode 100644 index 000000000..6f0bbca4c --- /dev/null +++ b/spec/fixtures/packages/package-with-empty-workspace-openers/package.json @@ -0,0 +1,5 @@ +{ + "name": "package-with-empty-workspace-openers", + "version": "0.1.0", + "workspaceOpeners": [] +} diff --git a/spec/fixtures/packages/package-with-workspace-openers/index.coffee b/spec/fixtures/packages/package-with-workspace-openers/index.coffee new file mode 100644 index 000000000..227447421 --- /dev/null +++ b/spec/fixtures/packages/package-with-workspace-openers/index.coffee @@ -0,0 +1,9 @@ +module.exports = + activateCallCount: 0 + openerCount: 0 + + activate: -> + @activateCallCount++ + atom.workspace.addOpener (filePath) => + if filePath is 'atom://fictitious' + @openerCount++ diff --git a/spec/fixtures/packages/package-with-workspace-openers/package.cson b/spec/fixtures/packages/package-with-workspace-openers/package.cson new file mode 100644 index 000000000..c7d5047c9 --- /dev/null +++ b/spec/fixtures/packages/package-with-workspace-openers/package.cson @@ -0,0 +1,5 @@ +{ + "name": "package-with-workspace-openers", + "version": "0.1.0", + "workspaceOpeners": ['atom://fictitious'] +} diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index 96444b659..ae969a740 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -772,6 +772,35 @@ describe('PackageManager', () => { }) }) + describe('when the package metadata includes `workspaceOpeners`', () => { + let mainModule, promise + + beforeEach(() => { + mainModule = require('./fixtures/packages/package-with-workspace-openers/index') + spyOn(mainModule, 'activate').andCallThrough() + spyOn(Package.prototype, 'requireMainModule').andCallThrough() + }) + + it('defers requiring/activating the main module until a registered opener is called', async () => { + promise = atom.packages.activatePackage('package-with-workspace-openers') + expect(Package.prototype.requireMainModule.callCount).toBe(0) + atom.workspace.open('atom://fictitious') + + await promise + expect(Package.prototype.requireMainModule.callCount).toBe(1) + expect(mainModule.openerCount).toBe(1) + }) + + it('activates the package immediately when the events are empty', async () => { + mainModule = require('./fixtures/packages/package-with-empty-workspace-openers/index') + spyOn(mainModule, 'activate').andCallThrough() + + atom.packages.activatePackage('package-with-empty-workspace-openers') + + expect(mainModule.activate.callCount).toBe(1) + }) + }) + describe('when the package has no main module', () => { it('does not throw an exception', () => { spyOn(console, 'error') From 590b68628908b552f24d033121d03044b32d9ece Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 15 Nov 2017 01:16:00 +0100 Subject: [PATCH 006/184] Reorganize specs --- spec/package-manager-spec.js | 153 +++++++++++++++++------------------ 1 file changed, 75 insertions(+), 78 deletions(-) diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index ae969a740..1bc990e86 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -711,93 +711,91 @@ describe('PackageManager', () => { expect(Package.prototype.requireMainModule.callCount).toBe(1) }) }) - }) - describe('when the package metadata includes `activationHooks`', () => { - let mainModule, promise + describe('when the package metadata includes `activationHooks`', () => { + let mainModule, promise - beforeEach(() => { - mainModule = require('./fixtures/packages/package-with-activation-hooks/index') - spyOn(mainModule, 'activate').andCallThrough() - spyOn(Package.prototype, 'requireMainModule').andCallThrough() + beforeEach(() => { + mainModule = require('./fixtures/packages/package-with-activation-hooks/index') + spyOn(mainModule, 'activate').andCallThrough() + }) + + it('defers requiring/activating the main module until an triggering of an activation hook occurs', async () => { + promise = atom.packages.activatePackage('package-with-activation-hooks') + expect(Package.prototype.requireMainModule.callCount).toBe(0) + atom.packages.triggerActivationHook('language-fictitious:grammar-used') + atom.packages.triggerDeferredActivationHooks() + + await promise + expect(Package.prototype.requireMainModule.callCount).toBe(1) + }) + + it('does not double register activation hooks when deactivating and reactivating', async () => { + promise = atom.packages.activatePackage('package-with-activation-hooks') + expect(mainModule.activate.callCount).toBe(0) + atom.packages.triggerActivationHook('language-fictitious:grammar-used') + atom.packages.triggerDeferredActivationHooks() + + await promise + expect(mainModule.activate.callCount).toBe(1) + + await atom.packages.deactivatePackage('package-with-activation-hooks') + + promise = atom.packages.activatePackage('package-with-activation-hooks') + atom.packages.triggerActivationHook('language-fictitious:grammar-used') + atom.packages.triggerDeferredActivationHooks() + + await promise + expect(mainModule.activate.callCount).toBe(2) + }) + + it('activates the package immediately when activationHooks is empty', async () => { + mainModule = require('./fixtures/packages/package-with-empty-activation-hooks/index') + spyOn(mainModule, 'activate').andCallThrough() + + expect(Package.prototype.requireMainModule.callCount).toBe(0) + + await atom.packages.activatePackage('package-with-empty-activation-hooks') + expect(mainModule.activate.callCount).toBe(1) + expect(Package.prototype.requireMainModule.callCount).toBe(1) + }) + + it('activates the package immediately if the activation hook had already been triggered', async () => { + atom.packages.triggerActivationHook('language-fictitious:grammar-used') + atom.packages.triggerDeferredActivationHooks() + expect(Package.prototype.requireMainModule.callCount).toBe(0) + + await atom.packages.activatePackage('package-with-activation-hooks') + expect(Package.prototype.requireMainModule.callCount).toBe(1) + }) }) - it('defers requiring/activating the main module until an triggering of an activation hook occurs', async () => { - promise = atom.packages.activatePackage('package-with-activation-hooks') - expect(Package.prototype.requireMainModule.callCount).toBe(0) - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + describe('when the package metadata includes `workspaceOpeners`', () => { + let mainModule, promise - await promise - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) + beforeEach(() => { + mainModule = require('./fixtures/packages/package-with-workspace-openers/index') + spyOn(mainModule, 'activate').andCallThrough() + }) - it('does not double register activation hooks when deactivating and reactivating', async () => { - promise = atom.packages.activatePackage('package-with-activation-hooks') - expect(mainModule.activate.callCount).toBe(0) - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + it('defers requiring/activating the main module until a registered opener is called', async () => { + promise = atom.packages.activatePackage('package-with-workspace-openers') + expect(Package.prototype.requireMainModule.callCount).toBe(0) + atom.workspace.open('atom://fictitious') - await promise - expect(mainModule.activate.callCount).toBe(1) + await promise + expect(Package.prototype.requireMainModule.callCount).toBe(1) + expect(mainModule.openerCount).toBe(1) + }) - await atom.packages.deactivatePackage('package-with-activation-hooks') + it('activates the package immediately when the events are empty', async () => { + mainModule = require('./fixtures/packages/package-with-empty-workspace-openers/index') + spyOn(mainModule, 'activate').andCallThrough() - promise = atom.packages.activatePackage('package-with-activation-hooks') - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + atom.packages.activatePackage('package-with-empty-workspace-openers') - await promise - expect(mainModule.activate.callCount).toBe(2) - }) - - it('activates the package immediately when activationHooks is empty', async () => { - mainModule = require('./fixtures/packages/package-with-empty-activation-hooks/index') - spyOn(mainModule, 'activate').andCallThrough() - - expect(Package.prototype.requireMainModule.callCount).toBe(0) - - await atom.packages.activatePackage('package-with-empty-activation-hooks') - expect(mainModule.activate.callCount).toBe(1) - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) - - it('activates the package immediately if the activation hook had already been triggered', async () => { - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() - expect(Package.prototype.requireMainModule.callCount).toBe(0) - - await atom.packages.activatePackage('package-with-activation-hooks') - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) - }) - - describe('when the package metadata includes `workspaceOpeners`', () => { - let mainModule, promise - - beforeEach(() => { - mainModule = require('./fixtures/packages/package-with-workspace-openers/index') - spyOn(mainModule, 'activate').andCallThrough() - spyOn(Package.prototype, 'requireMainModule').andCallThrough() - }) - - it('defers requiring/activating the main module until a registered opener is called', async () => { - promise = atom.packages.activatePackage('package-with-workspace-openers') - expect(Package.prototype.requireMainModule.callCount).toBe(0) - atom.workspace.open('atom://fictitious') - - await promise - expect(Package.prototype.requireMainModule.callCount).toBe(1) - expect(mainModule.openerCount).toBe(1) - }) - - it('activates the package immediately when the events are empty', async () => { - mainModule = require('./fixtures/packages/package-with-empty-workspace-openers/index') - spyOn(mainModule, 'activate').andCallThrough() - - atom.packages.activatePackage('package-with-empty-workspace-openers') - - expect(mainModule.activate.callCount).toBe(1) + expect(mainModule.activate.callCount).toBe(1) + }) }) }) @@ -1117,7 +1115,6 @@ describe('PackageManager', () => { }) }) - describe("URI handler registration", () => { it("registers the package's specified URI handler", async () => { const uri = 'atom://package-with-uri-handler/some/url?with=args' From 8920450a34dcfb642d55240a89d75933d228e2bd Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 29 Nov 2017 21:24:16 +0100 Subject: [PATCH 007/184] :fire: old package.coffee --- src/package.coffee | 877 --------------------------------------------- 1 file changed, 877 deletions(-) delete mode 100644 src/package.coffee diff --git a/src/package.coffee b/src/package.coffee deleted file mode 100644 index d16c05c5f..000000000 --- a/src/package.coffee +++ /dev/null @@ -1,877 +0,0 @@ -path = require 'path' - -_ = require 'underscore-plus' -async = require 'async' -CSON = require 'season' -fs = require 'fs-plus' -{Emitter, CompositeDisposable} = require 'event-kit' - -CompileCache = require './compile-cache' -ModuleCache = require './module-cache' -ScopedProperties = require './scoped-properties' -BufferedProcess = require './buffered-process' - -# Extended: Loads and activates a package's main module and resources such as -# stylesheets, keymaps, grammar, editor properties, and menus. -module.exports = -class Package - keymaps: null - menus: null - stylesheets: null - stylesheetDisposables: null - grammars: null - settings: null - mainModulePath: null - resolvedMainModulePath: false - mainModule: null - mainInitialized: false - mainActivated: false - deserialized: false - - ### - Section: Construction - ### - - constructor: (params) -> - { - @path, @metadata, @bundledPackage, @preloadedPackage, @packageManager, @config, @styleManager, @commandRegistry, - @keymapManager, @notificationManager, @grammarRegistry, @themeManager, - @menuManager, @contextMenuManager, @deserializerManager, @viewRegistry - } = params - - @emitter = new Emitter - @metadata ?= @packageManager.loadPackageMetadata(@path) - @bundledPackage ?= @packageManager.isBundledPackagePath(@path) - @name = @metadata?.name ? params.name ? path.basename(@path) - @reset() - - ### - Section: Event Subscription - ### - - # Essential: Invoke the given callback when all packages have been activated. - # - # * `callback` {Function} - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidDeactivate: (callback) -> - @emitter.on 'did-deactivate', callback - - ### - Section: Instance Methods - ### - - enable: -> - @config.removeAtKeyPath('core.disabledPackages', @name) - - disable: -> - @config.pushAtKeyPath('core.disabledPackages', @name) - - isTheme: -> - @metadata?.theme? - - measure: (key, fn) -> - startTime = Date.now() - value = fn() - @[key] = Date.now() - startTime - value - - getType: -> 'atom' - - getStyleSheetPriority: -> 0 - - preload: -> - @loadKeymaps() - @loadMenus() - @registerDeserializerMethods() - @activateCoreStartupServices() - @registerURIHandler() - @configSchemaRegisteredOnLoad = @registerConfigSchemaFromMetadata() - @requireMainModule() - @settingsPromise = @loadSettings() - - @activationDisposables = new CompositeDisposable - @activateKeymaps() - @activateMenus() - settings.activate() for settings in @settings - @settingsActivated = true - - finishLoading: -> - @measure 'loadTime', => - @path = path.join(@packageManager.resourcePath, @path) - ModuleCache.add(@path, @metadata) - - @loadStylesheets() - # Unfortunately some packages are accessing `@mainModulePath`, so we need - # to compute that variable eagerly also for preloaded packages. - @getMainModulePath() - - load: -> - @measure 'loadTime', => - try - ModuleCache.add(@path, @metadata) - - @loadKeymaps() - @loadMenus() - @loadStylesheets() - @registerDeserializerMethods() - @activateCoreStartupServices() - @registerURIHandler() - @registerTranspilerConfig() - @configSchemaRegisteredOnLoad = @registerConfigSchemaFromMetadata() - @settingsPromise = @loadSettings() - if @shouldRequireMainModuleOnLoad() and not @mainModule? - @requireMainModule() - catch error - @handleError("Failed to load the #{@name} package", error) - this - - unload: -> - @unregisterTranspilerConfig() - - shouldRequireMainModuleOnLoad: -> - not ( - @metadata.deserializers? or - @metadata.viewProviders? or - @metadata.configSchema? or - @activationShouldBeDeferred() or - localStorage.getItem(@getCanDeferMainModuleRequireStorageKey()) is 'true' - ) - - reset: -> - @stylesheets = [] - @keymaps = [] - @menus = [] - @grammars = [] - @settings = [] - @mainInitialized = false - @mainActivated = false - - initializeIfNeeded: -> - return if @mainInitialized - @measure 'initializeTime', => - try - # The main module's `initialize()` method is guaranteed to be called - # before its `activate()`. This gives you a chance to handle the - # serialized package state before the package's derserializers and view - # providers are used. - @requireMainModule() unless @mainModule? - @mainModule.initialize?(@packageManager.getPackageState(@name) ? {}) - @mainInitialized = true - catch error - @handleError("Failed to initialize the #{@name} package", error) - return - - activate: -> - @grammarsPromise ?= @loadGrammars() - @activationPromise ?= - new Promise (resolve, reject) => - @resolveActivationPromise = resolve - @measure 'activateTime', => - try - @activateResources() - if @activationShouldBeDeferred() - @subscribeToDeferredActivation() - else - @activateNow() - catch error - @handleError("Failed to activate the #{@name} package", error) - - Promise.all([@grammarsPromise, @settingsPromise, @activationPromise]) - - activateNow: -> - try - @requireMainModule() unless @mainModule? - @configSchemaRegisteredOnActivate = @registerConfigSchemaFromMainModule() - @registerViewProviders() - @activateResources() - @activateStylesheets() - if @mainModule? and not @mainActivated - @initializeIfNeeded() - @mainModule.activateConfig?() - @mainModule.activate?(@packageManager.getPackageState(@name) ? {}) - @mainActivated = true - @activateServices() - @activationCommandSubscriptions?.dispose() - @activationHookSubscriptions?.dispose() - @workspaceOpenerSubscriptions?.dispose() - catch error - @handleError("Failed to activate the #{@name} package", error) - - @resolveActivationPromise?() - - registerConfigSchemaFromMetadata: -> - if configSchema = @metadata.configSchema - @config.setSchema @name, {type: 'object', properties: configSchema} - true - else - false - - registerConfigSchemaFromMainModule: -> - if @mainModule? and not @configSchemaRegisteredOnLoad - if @mainModule.config? and typeof @mainModule.config is 'object' - @config.setSchema @name, {type: 'object', properties: @mainModule.config} - return true - false - - # TODO: Remove. Settings view calls this method currently. - activateConfig: -> - return if @configSchemaRegisteredOnLoad - @requireMainModule() - @registerConfigSchemaFromMainModule() - - activateStylesheets: -> - return if @stylesheetsActivated - - @stylesheetDisposables = new CompositeDisposable - - priority = @getStyleSheetPriority() - for [sourcePath, source] in @stylesheets - if match = path.basename(sourcePath).match(/[^.]*\.([^.]*)\./) - context = match[1] - else if @metadata.theme is 'syntax' - context = 'atom-text-editor' - else - context = undefined - - @stylesheetDisposables.add( - @styleManager.addStyleSheet( - source, - { - sourcePath, - priority, - context, - skipDeprecatedSelectorsTransformation: @bundledPackage - } - ) - ) - @stylesheetsActivated = true - - activateResources: -> - @activationDisposables ?= new CompositeDisposable - - keymapIsDisabled = _.include(@config.get("core.packagesWithKeymapsDisabled") ? [], @name) - if keymapIsDisabled - @deactivateKeymaps() - else unless @keymapActivated - @activateKeymaps() - - unless @menusActivated - @activateMenus() - - unless @grammarsActivated - grammar.activate() for grammar in @grammars - @grammarsActivated = true - - unless @settingsActivated - settings.activate() for settings in @settings - @settingsActivated = true - - activateKeymaps: -> - return if @keymapActivated - - @keymapDisposables = new CompositeDisposable() - - validateSelectors = not @preloadedPackage - @keymapDisposables.add(@keymapManager.add(keymapPath, map, 0, validateSelectors)) for [keymapPath, map] in @keymaps - @menuManager.update() - - @keymapActivated = true - - deactivateKeymaps: -> - return if not @keymapActivated - - @keymapDisposables?.dispose() - @menuManager.update() - - @keymapActivated = false - - hasKeymaps: -> - for [path, map] in @keymaps - if map.length > 0 - return true - false - - activateMenus: -> - validateSelectors = not @preloadedPackage - for [menuPath, map] in @menus when map['context-menu']? - try - itemsBySelector = map['context-menu'] - @activationDisposables.add(@contextMenuManager.add(itemsBySelector, validateSelectors)) - catch error - if error.code is 'EBADSELECTOR' - error.message += " in #{menuPath}" - error.stack += "\n at #{menuPath}:1:1" - throw error - - for [menuPath, map] in @menus when map['menu']? - @activationDisposables.add(@menuManager.add(map['menu'])) - - @menusActivated = true - - activateServices: -> - for name, {versions} of @metadata.providedServices - servicesByVersion = {} - for version, methodName of versions - if typeof @mainModule[methodName] is 'function' - servicesByVersion[version] = @mainModule[methodName]() - @activationDisposables.add @packageManager.serviceHub.provide(name, servicesByVersion) - - for name, {versions} of @metadata.consumedServices - for version, methodName of versions - if typeof @mainModule[methodName] is 'function' - @activationDisposables.add @packageManager.serviceHub.consume(name, version, @mainModule[methodName].bind(@mainModule)) - return - - registerURIHandler: -> - handlerConfig = @getURIHandler() - if methodName = handlerConfig?.method - @uriHandlerSubscription = @packageManager.registerURIHandlerForPackage @name, (args...) => - @handleURI(methodName, args) - - unregisterURIHandler: -> - @uriHandlerSubscription?.dispose() - - handleURI: (methodName, args) -> - @activate().then => @mainModule[methodName]?.apply(@mainModule, args) - @activateNow() unless @mainActivated - - registerTranspilerConfig: -> - if @metadata.atomTranspilers - CompileCache.addTranspilerConfigForPath(@path, @name, @metadata, @metadata.atomTranspilers) - - unregisterTranspilerConfig: -> - if @metadata.atomTranspilers - CompileCache.removeTranspilerConfigForPath(@path) - - loadKeymaps: -> - if @bundledPackage and @packageManager.packagesCache[@name]? - @keymaps = (["core:#{keymapPath}", keymapObject] for keymapPath, keymapObject of @packageManager.packagesCache[@name].keymaps) - else - @keymaps = @getKeymapPaths().map (keymapPath) -> [keymapPath, CSON.readFileSync(keymapPath, allowDuplicateKeys: false) ? {}] - return - - loadMenus: -> - if @bundledPackage and @packageManager.packagesCache[@name]? - @menus = (["core:#{menuPath}", menuObject] for menuPath, menuObject of @packageManager.packagesCache[@name].menus) - else - @menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath) ? {}] - return - - getKeymapPaths: -> - keymapsDirPath = path.join(@path, 'keymaps') - if @metadata.keymaps - @metadata.keymaps.map (name) -> fs.resolve(keymapsDirPath, name, ['json', 'cson', '']) - else - fs.listSync(keymapsDirPath, ['cson', 'json']) - - getMenuPaths: -> - menusDirPath = path.join(@path, 'menus') - if @metadata.menus - @metadata.menus.map (name) -> fs.resolve(menusDirPath, name, ['json', 'cson', '']) - else - fs.listSync(menusDirPath, ['cson', 'json']) - - loadStylesheets: -> - @stylesheets = @getStylesheetPaths().map (stylesheetPath) => - [stylesheetPath, @themeManager.loadStylesheet(stylesheetPath, true)] - - registerDeserializerMethods: -> - if @metadata.deserializers? - Object.keys(@metadata.deserializers).forEach (deserializerName) => - methodName = @metadata.deserializers[deserializerName] - @deserializerManager.add - name: deserializerName, - deserialize: (state, atomEnvironment) => - @deserialized = true - @activateNow() - @mainModule[methodName](state, atomEnvironment) - return - - activateCoreStartupServices: -> - if directoryProviderService = @metadata.providedServices?['atom.directory-provider'] - @requireMainModule() - servicesByVersion = {} - for version, methodName of directoryProviderService.versions - if typeof @mainModule[methodName] is 'function' - servicesByVersion[version] = @mainModule[methodName]() - @packageManager.serviceHub.provide('atom.directory-provider', servicesByVersion) - - registerViewProviders: -> - if @metadata.viewProviders? and not @registeredViewProviders - @requireMainModule() - @metadata.viewProviders.forEach (methodName) => - @viewRegistry.addViewProvider (model) => - @initializeIfNeeded() - @mainModule[methodName](model) - @registeredViewProviders = true - - getStylesheetsPath: -> - path.join(@path, 'styles') - - getStylesheetPaths: -> - if @bundledPackage and @packageManager.packagesCache[@name]?.styleSheetPaths? - styleSheetPaths = @packageManager.packagesCache[@name].styleSheetPaths - styleSheetPaths.map (styleSheetPath) => path.join(@path, styleSheetPath) - else - stylesheetDirPath = @getStylesheetsPath() - if @metadata.mainStyleSheet - [fs.resolve(@path, @metadata.mainStyleSheet)] - else if @metadata.styleSheets - @metadata.styleSheets.map (name) -> fs.resolve(stylesheetDirPath, name, ['css', 'less', '']) - else if indexStylesheet = fs.resolve(@path, 'index', ['css', 'less']) - [indexStylesheet] - else - fs.listSync(stylesheetDirPath, ['css', 'less']) - - loadGrammarsSync: -> - return if @grammarsLoaded - - if @preloadedPackage and @packageManager.packagesCache[@name]? - grammarPaths = @packageManager.packagesCache[@name].grammarPaths - else - grammarPaths = fs.listSync(path.join(@path, 'grammars'), ['json', 'cson']) - - for grammarPath in grammarPaths - if @preloadedPackage and @packageManager.packagesCache[@name]? - grammarPath = path.resolve(@packageManager.resourcePath, grammarPath) - - try - grammar = @grammarRegistry.readGrammarSync(grammarPath) - grammar.packageName = @name - grammar.bundledPackage = @bundledPackage - @grammars.push(grammar) - grammar.activate() - catch error - console.warn("Failed to load grammar: #{grammarPath}", error.stack ? error) - - @grammarsLoaded = true - @grammarsActivated = true - - loadGrammars: -> - return Promise.resolve() if @grammarsLoaded - - loadGrammar = (grammarPath, callback) => - if @preloadedPackage - grammarPath = path.resolve(@packageManager.resourcePath, grammarPath) - - @grammarRegistry.readGrammar grammarPath, (error, grammar) => - if error? - detail = "#{error.message} in #{grammarPath}" - stack = "#{error.stack}\n at #{grammarPath}:1:1" - @notificationManager.addFatalError("Failed to load a #{@name} package grammar", {stack, detail, packageName: @name, dismissable: true}) - else - grammar.packageName = @name - grammar.bundledPackage = @bundledPackage - @grammars.push(grammar) - grammar.activate() if @grammarsActivated - callback() - - new Promise (resolve) => - if @preloadedPackage and @packageManager.packagesCache[@name]? - grammarPaths = @packageManager.packagesCache[@name].grammarPaths - async.each grammarPaths, loadGrammar, -> resolve() - else - grammarsDirPath = path.join(@path, 'grammars') - fs.exists grammarsDirPath, (grammarsDirExists) -> - return resolve() unless grammarsDirExists - - fs.list grammarsDirPath, ['json', 'cson'], (error, grammarPaths=[]) -> - async.each grammarPaths, loadGrammar, -> resolve() - - loadSettings: -> - @settings = [] - - loadSettingsFile = (settingsPath, callback) => - ScopedProperties.load settingsPath, @config, (error, settings) => - if error? - detail = "#{error.message} in #{settingsPath}" - stack = "#{error.stack}\n at #{settingsPath}:1:1" - @notificationManager.addFatalError("Failed to load the #{@name} package settings", {stack, detail, packageName: @name, dismissable: true}) - else - @settings.push(settings) - settings.activate() if @settingsActivated - callback() - - new Promise (resolve) => - if @preloadedPackage and @packageManager.packagesCache[@name]? - for settingsPath, scopedProperties of @packageManager.packagesCache[@name].settings - settings = new ScopedProperties("core:#{settingsPath}", scopedProperties ? {}, @config) - @settings.push(settings) - settings.activate() if @settingsActivated - resolve() - else - settingsDirPath = path.join(@path, 'settings') - fs.exists settingsDirPath, (settingsDirExists) -> - return resolve() unless settingsDirExists - - fs.list settingsDirPath, ['json', 'cson'], (error, settingsPaths=[]) -> - async.each settingsPaths, loadSettingsFile, -> resolve() - - serialize: -> - if @mainActivated - try - @mainModule?.serialize?() - catch e - console.error "Error serializing package '#{@name}'", e.stack - - deactivate: -> - @activationPromise = null - @resolveActivationPromise = null - @activationCommandSubscriptions?.dispose() - @activationHookSubscriptions?.dispose() - @configSchemaRegisteredOnActivate = false - @unregisterURIHandler() - @deactivateResources() - @deactivateKeymaps() - - unless @mainActivated - @emitter.emit 'did-deactivate' - return - - try - deactivationResult = @mainModule?.deactivate?() - catch e - console.error "Error deactivating package '#{@name}'", e.stack - - # We support then-able async promises as well as sync ones from deactivate - if typeof deactivationResult?.then is 'function' - deactivationResult.then => @afterDeactivation() - else - @afterDeactivation() - - afterDeactivation: -> - try - @mainModule?.deactivateConfig?() - catch e - console.error "Error deactivating package '#{@name}'", e.stack - @mainActivated = false - @mainInitialized = false - @emitter.emit 'did-deactivate' - - deactivateResources: -> - grammar.deactivate() for grammar in @grammars - settings.deactivate() for settings in @settings - @stylesheetDisposables?.dispose() - @activationDisposables?.dispose() - @keymapDisposables?.dispose() - @stylesheetsActivated = false - @grammarsActivated = false - @settingsActivated = false - @menusActivated = false - - reloadStylesheets: -> - try - @loadStylesheets() - catch error - @handleError("Failed to reload the #{@name} package stylesheets", error) - - @stylesheetDisposables?.dispose() - @stylesheetDisposables = new CompositeDisposable - @stylesheetsActivated = false - @activateStylesheets() - - requireMainModule: -> - if @bundledPackage and @packageManager.packagesCache[@name]? - if @packageManager.packagesCache[@name].main? - @mainModule = require(@packageManager.packagesCache[@name].main) - else if @mainModuleRequired - @mainModule - else if not @isCompatible() - console.warn """ - Failed to require the main module of '#{@name}' because it requires one or more incompatible native modules (#{_.pluck(@incompatibleModules, 'name').join(', ')}). - Run `apm rebuild` in the package directory and restart Atom to resolve. - """ - return - else - mainModulePath = @getMainModulePath() - if fs.isFileSync(mainModulePath) - @mainModuleRequired = true - - previousViewProviderCount = @viewRegistry.getViewProviderCount() - previousDeserializerCount = @deserializerManager.getDeserializerCount() - @mainModule = require(mainModulePath) - if (@viewRegistry.getViewProviderCount() is previousViewProviderCount and - @deserializerManager.getDeserializerCount() is previousDeserializerCount) - localStorage.setItem(@getCanDeferMainModuleRequireStorageKey(), 'true') - - getMainModulePath: -> - return @mainModulePath if @resolvedMainModulePath - @resolvedMainModulePath = true - - if @bundledPackage and @packageManager.packagesCache[@name]? - if @packageManager.packagesCache[@name].main - @mainModulePath = path.resolve(@packageManager.resourcePath, 'static', @packageManager.packagesCache[@name].main) - else - @mainModulePath = null - else - mainModulePath = - if @metadata.main - path.join(@path, @metadata.main) - else - path.join(@path, 'index') - @mainModulePath = fs.resolveExtension(mainModulePath, ["", CompileCache.supportedExtensions...]) - - activationShouldBeDeferred: -> - (@hasActivationCommands() or @hasActivationHooks() or @hasWorkspaceOpeners() or @hasDeferredURIHandler()) and not @deserialized - - hasActivationCommands: -> - for selector, commands of @getActivationCommands() - return true if commands.length > 0 - false - - hasActivationHooks: -> - @getActivationHooks()?.length > 0 - - hasWorkspaceOpeners: -> - @getWorkspaceOpeners()?.length > 0 - - hasDeferredURIHandler: -> - @getURIHandler() and @getURIHandler().deferActivation isnt false - - subscribeToDeferredActivation: -> - @subscribeToActivationCommands() - @subscribeToActivationHooks() - @subscribeToWorkspaceOpeners() - - subscribeToActivationCommands: -> - @activationCommandSubscriptions = new CompositeDisposable - for selector, commands of @getActivationCommands() - for command in commands - do (selector, command) => - # Add dummy command so it appears in menu. - # The real command will be registered on package activation - try - @activationCommandSubscriptions.add @commandRegistry.add selector, command, -> - catch error - if error.code is 'EBADSELECTOR' - metadataPath = path.join(@path, 'package.json') - error.message += " in #{metadataPath}" - error.stack += "\n at #{metadataPath}:1:1" - throw error - - @activationCommandSubscriptions.add @commandRegistry.onWillDispatch (event) => - return unless event.type is command - currentTarget = event.target - while currentTarget - if currentTarget.webkitMatchesSelector(selector) - @activationCommandSubscriptions.dispose() - @activateNow() - break - currentTarget = currentTarget.parentElement - return - return - - getActivationCommands: -> - return @activationCommands if @activationCommands? - - @activationCommands = {} - - if @metadata.activationCommands? - for selector, commands of @metadata.activationCommands - @activationCommands[selector] ?= [] - if _.isString(commands) - @activationCommands[selector].push(commands) - else if _.isArray(commands) - @activationCommands[selector].push(commands...) - - @activationCommands - - subscribeToActivationHooks: -> - @activationHookSubscriptions = new CompositeDisposable - for hook in @getActivationHooks() - do (hook) => - @activationHookSubscriptions.add(@packageManager.onDidTriggerActivationHook(hook, => @activateNow())) if hook? and _.isString(hook) and hook.trim().length > 0 - - return - - getActivationHooks: -> - return @activationHooks if @metadata? and @activationHooks? - - @activationHooks = [] - - if @metadata.activationHooks? - if _.isArray(@metadata.activationHooks) - @activationHooks.push(@metadata.activationHooks...) - else if _.isString(@metadata.activationHooks) - @activationHooks.push(@metadata.activationHooks) - - @activationHooks = _.uniq(@activationHooks) - - subscribeToWorkspaceOpeners: -> - @workspaceOpenerSubscriptions = new CompositeDisposable - for opener in @getWorkspaceOpeners() - do (opener) => - @workspaceOpenerSubscriptions.add atom.workspace.addOpener (filePath) => - if filePath is opener - @activateNow() - @workspaceOpenerSubscriptions.dispose() - atom.workspace.open(opener) - - getWorkspaceOpeners: -> - return @workspaceOpeners if @workspaceOpeners? - - @workspaceOpeners = [] - - if @metadata.workspaceOpeners? - if _.isArray(@metadata.workspaceOpeners) - @workspaceOpeners.push(@metadata.workspaceOpeners...) - else if _.isString(@metadata.workspaceOpeners) - @workspaceOpeners.push(@metadata.workspaceOpeners) - - @workspaceOpeners = _.uniq(@workspaceOpeners) - - getURIHandler: -> - @metadata?.uriHandler - - # Does the given module path contain native code? - isNativeModule: (modulePath) -> - try - fs.listSync(path.join(modulePath, 'build', 'Release'), ['.node']).length > 0 - catch error - false - - # Get an array of all the native modules that this package depends on. - # - # First try to get this information from - # @metadata._atomModuleCache.extensions. If @metadata._atomModuleCache doesn't - # exist, recurse through all dependencies. - getNativeModuleDependencyPaths: -> - nativeModulePaths = [] - - if @metadata._atomModuleCache? - relativeNativeModuleBindingPaths = @metadata._atomModuleCache.extensions?['.node'] ? [] - for relativeNativeModuleBindingPath in relativeNativeModuleBindingPaths - nativeModulePath = path.join(@path, relativeNativeModuleBindingPath, '..', '..', '..') - nativeModulePaths.push(nativeModulePath) - return nativeModulePaths - - traversePath = (nodeModulesPath) => - try - for modulePath in fs.listSync(nodeModulesPath) - nativeModulePaths.push(modulePath) if @isNativeModule(modulePath) - traversePath(path.join(modulePath, 'node_modules')) - return - - traversePath(path.join(@path, 'node_modules')) - nativeModulePaths - - ### - Section: Native Module Compatibility - ### - - # Extended: Are all native modules depended on by this package correctly - # compiled against the current version of Atom? - # - # Incompatible packages cannot be activated. - # - # Returns a {Boolean}, true if compatible, false if incompatible. - isCompatible: -> - return @compatible if @compatible? - - if @preloadedPackage - # Preloaded packages are always considered compatible - @compatible = true - else if @getMainModulePath() - @incompatibleModules = @getIncompatibleNativeModules() - @compatible = @incompatibleModules.length is 0 and not @getBuildFailureOutput()? - else - @compatible = true - - # Extended: Rebuild native modules in this package's dependencies for the - # current version of Atom. - # - # Returns a {Promise} that resolves with an object containing `code`, - # `stdout`, and `stderr` properties based on the results of running - # `apm rebuild` on the package. - rebuild: -> - new Promise (resolve) => - @runRebuildProcess (result) => - if result.code is 0 - global.localStorage.removeItem(@getBuildFailureOutputStorageKey()) - else - @compatible = false - global.localStorage.setItem(@getBuildFailureOutputStorageKey(), result.stderr) - global.localStorage.setItem(@getIncompatibleNativeModulesStorageKey(), '[]') - resolve(result) - - # Extended: If a previous rebuild failed, get the contents of stderr. - # - # Returns a {String} or null if no previous build failure occurred. - getBuildFailureOutput: -> - global.localStorage.getItem(@getBuildFailureOutputStorageKey()) - - runRebuildProcess: (callback) -> - stderr = '' - stdout = '' - new BufferedProcess({ - command: @packageManager.getApmPath() - args: ['rebuild', '--no-color'] - options: {cwd: @path} - stderr: (output) -> stderr += output - stdout: (output) -> stdout += output - exit: (code) -> callback({code, stdout, stderr}) - }) - - getBuildFailureOutputStorageKey: -> - "installed-packages:#{@name}:#{@metadata.version}:build-error" - - getIncompatibleNativeModulesStorageKey: -> - electronVersion = process.versions.electron - "installed-packages:#{@name}:#{@metadata.version}:electron-#{electronVersion}:incompatible-native-modules" - - getCanDeferMainModuleRequireStorageKey: -> - "installed-packages:#{@name}:#{@metadata.version}:can-defer-main-module-require" - - # Get the incompatible native modules that this package depends on. - # This recurses through all dependencies and requires all modules that - # contain a `.node` file. - # - # This information is cached in local storage on a per package/version basis - # to minimize the impact on startup time. - getIncompatibleNativeModules: -> - unless @packageManager.devMode - try - if arrayAsString = global.localStorage.getItem(@getIncompatibleNativeModulesStorageKey()) - return JSON.parse(arrayAsString) - - incompatibleNativeModules = [] - for nativeModulePath in @getNativeModuleDependencyPaths() - try - require(nativeModulePath) - catch error - try - version = require("#{nativeModulePath}/package.json").version - incompatibleNativeModules.push - path: nativeModulePath - name: path.basename(nativeModulePath) - version: version - error: error.message - - global.localStorage.setItem(@getIncompatibleNativeModulesStorageKey(), JSON.stringify(incompatibleNativeModules)) - incompatibleNativeModules - - handleError: (message, error) -> - if atom.inSpecMode() - throw error - - if error.filename and error.location and (error instanceof SyntaxError) - location = "#{error.filename}:#{error.location.first_line + 1}:#{error.location.first_column + 1}" - detail = "#{error.message} in #{location}" - stack = """ - SyntaxError: #{error.message} - at #{location} - """ - else if error.less and error.filename and error.column? and error.line? - # Less errors - location = "#{error.filename}:#{error.line}:#{error.column}" - detail = "#{error.message} in #{location}" - stack = """ - LessError: #{error.message} - at #{location} - """ - else - detail = error.message - stack = error.stack ? error - - @notificationManager.addFatalError(message, {stack, detail, packageName: @name, dismissable: true}) From 330876598c74b918a9ac536a6bdbcae94943dd32 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 4 Dec 2017 20:21:29 +0100 Subject: [PATCH 008/184] This return is needed --- src/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.js b/src/package.js index e4150e24c..c7275da65 100644 --- a/src/package.js +++ b/src/package.js @@ -937,7 +937,7 @@ class Package { if (filePath === opener) { this.activateNow() this.workspaceOpenerSubscriptions.dispose() - atom.workspace.open(opener) + return atom.workspace.open(opener) } })) }) From 39abd443986f35f4bcd09bc82ec2b9426f862e81 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 4 Dec 2017 20:21:50 +0100 Subject: [PATCH 009/184] Delay activation until initial package activation --- src/package.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/package.js b/src/package.js index c7275da65..96948885c 100644 --- a/src/package.js +++ b/src/package.js @@ -216,7 +216,6 @@ class Package { if (!this.mainModule) this.requireMainModule() this.configSchemaRegisteredOnActivate = this.registerConfigSchemaFromMainModule() this.registerViewProviders() - this.activateResources() this.activateStylesheets() if (this.mainModule && !this.mainActivated) { this.initializeIfNeeded() @@ -500,8 +499,10 @@ class Package { this.deserializerManager.add({ name: deserializerName, deserialize: (state, atomEnvironment) => { + this.registerViewProviders() + this.requireMainModule() + this.initializeIfNeeded() this.deserialized = true - this.activateNow() return this.mainModule[methodName](state, atomEnvironment) } }) From 90b051260ae8db21e0598d61c35a5892649d7e2a Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 4 Dec 2017 20:44:01 +0100 Subject: [PATCH 010/184] Activate package if a deserializer is called after initial package activation --- src/package.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/package.js b/src/package.js index 96948885c..9af403250 100644 --- a/src/package.js +++ b/src/package.js @@ -502,6 +502,18 @@ class Package { this.registerViewProviders() this.requireMainModule() this.initializeIfNeeded() + if (atomEnvironment.packages.hasActivatedInitialPackages()) { + // Only explicitly activate the package if initial packages + // have finished activating. This is because deserialization + // generally occurs at Atom startup, which happens before the + // workspace element is added to the DOM and is inconsistent with + // with when initial package activation occurs. Triggering activation + // immediately may cause problems with packages that expect to + // always have access to the workspace element. + // Otherwise, we just set the deserialized flag and package-manager + // will activate this package as normal during initial package activation. + this.activateNow() + } this.deserialized = true return this.mainModule[methodName](state, atomEnvironment) } From 838a7afbfc846fd773050b0fb0c9a8282f6c5f26 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 4 Dec 2017 20:44:12 +0100 Subject: [PATCH 011/184] Fix specs --- spec/package-manager-spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index 1bc990e86..44bd61c6c 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -671,6 +671,7 @@ describe('PackageManager', () => { beforeEach(() => { jasmine.attachToDOM(atom.workspace.getElement()) + spyOn(atom.packages, 'hasActivatedInitialPackages').andReturn(true) mainModule = require('./fixtures/packages/package-with-activation-commands-and-deserializers/index') mainModule.activationCommandCallCount = 0 spyOn(mainModule, 'activate').andCallThrough() @@ -691,7 +692,7 @@ describe('PackageManager', () => { expect(Package.prototype.requireMainModule.callCount).toBe(0) const state1 = {deserializer: 'Deserializer1', a: 'b'} - expect(atom.deserializers.deserialize(state1)).toEqual({ + expect(atom.deserializers.deserialize(state1, atom)).toEqual({ wasDeserializedBy: 'deserializeMethod1', state: state1 }) From 6cfc31d9f6ca4ea9ded00d1ead3f920d0e0468b2 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 18 Jan 2019 11:30:19 -0500 Subject: [PATCH 012/184] Use atom.workspace.createItemForURI This avoids nested atom.workspace.open calls, which don't work well, and has the same effect as createItemForURI will call the newly-added opener. --- src/package.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package.js b/src/package.js index 642ee06ed..542b77479 100644 --- a/src/package.js +++ b/src/package.js @@ -944,15 +944,15 @@ class Package { subscribeToWorkspaceOpeners () { this.workspaceOpenerSubscriptions = new CompositeDisposable() - this.getWorkspaceOpeners().forEach(opener => { + for (let opener of this.getWorkspaceOpeners()) { this.workspaceOpenerSubscriptions.add(atom.workspace.addOpener(filePath => { if (filePath === opener) { this.activateNow() this.workspaceOpenerSubscriptions.dispose() - return atom.workspace.open(opener) + return atom.workspace.createItemForURI(opener) } })) - }) + } } getWorkspaceOpeners () { From 44eeca6fc64b18b6ab01f5314a76ccdcdfe36bf3 Mon Sep 17 00:00:00 2001 From: Aerijo Date: Thu, 24 Jan 2019 16:00:32 +1000 Subject: [PATCH 013/184] Return tree sitter grammars too --- src/grammar-registry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 869a9fd1f..a2272760b 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -550,7 +550,7 @@ class GrammarRegistry { // // Returns a non-empty {Array} of {Grammar} instances. getGrammars () { - return this.textmateRegistry.getGrammars() + return [...this.textmateRegistry.getGrammars(), ...Object.values(this.treeSitterGrammarsById)] } scopeForId (id) { From da804a21ac0a23717ad3ebea46c8db7671d08f80 Mon Sep 17 00:00:00 2001 From: Aerijo Date: Thu, 24 Jan 2019 16:19:30 +1000 Subject: [PATCH 014/184] Make including tree sitter grammars optional --- packages/grammar-selector/lib/grammar-list-view.js | 8 +++++++- src/grammar-registry.js | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 557036af5..6942eef23 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -19,6 +19,12 @@ class GrammarListView { const div = document.createElement('div') div.classList.add('pull-right') + + if (grammar.constructor.name === "TreeSitterGrammar") { + console.log("TS", grammar) + // style here + } + if (grammar.scopeName) { const scopeName = document.createElement('scopeName') scopeName.classList.add('key-binding') // It will be styled the same as the keybindings in the command palette @@ -80,7 +86,7 @@ class GrammarListView { this.currentGrammar = this.autoDetect } - const grammars = atom.grammars.getGrammars().filter((grammar) => { + const grammars = atom.grammars.getGrammars(true).filter((grammar) => { return grammar !== atom.grammars.nullGrammar && grammar.name }) grammars.sort((a, b) => { diff --git a/src/grammar-registry.js b/src/grammar-registry.js index a2272760b..a96e7c647 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -549,8 +549,10 @@ class GrammarRegistry { // Extended: Get all the grammars in this registry. // // Returns a non-empty {Array} of {Grammar} instances. - getGrammars () { - return [...this.textmateRegistry.getGrammars(), ...Object.values(this.treeSitterGrammarsById)] + getGrammars (includeTreesitter = false) { + let grammars = this.textmateRegistry.getGrammars() + if (includeTreesitter) grammars = grammars.concat(Object.values(this.treeSitterGrammarsById)) + return grammars } scopeForId (id) { From 4c617cb9c8dbae2300737388a166c416b001da5f Mon Sep 17 00:00:00 2001 From: simurai Date: Wed, 13 Feb 2019 14:16:35 +0900 Subject: [PATCH 015/184] =?UTF-8?q?Add=20=E2=80=9CTree-sitter=E2=80=9D=20b?= =?UTF-8?q?adge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/grammar-selector/lib/grammar-list-view.js | 8 ++++++-- packages/grammar-selector/styles/grammar-selector.less | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 6942eef23..0caa19dae 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -22,12 +22,16 @@ class GrammarListView { if (grammar.constructor.name === "TreeSitterGrammar") { console.log("TS", grammar) - // style here + + const parser = document.createElement('span') + parser.classList.add('grammar-selector-parser', 'badge', 'badge-success') + parser.textContent = 'Tree-sitter' + div.appendChild(parser) } if (grammar.scopeName) { const scopeName = document.createElement('scopeName') - scopeName.classList.add('key-binding') // It will be styled the same as the keybindings in the command palette + scopeName.classList.add('badge', 'badge-info') scopeName.textContent = grammar.scopeName div.appendChild(scopeName) element.appendChild(div) diff --git a/packages/grammar-selector/styles/grammar-selector.less b/packages/grammar-selector/styles/grammar-selector.less index b10bb60f4..e4a6d538b 100644 --- a/packages/grammar-selector/styles/grammar-selector.less +++ b/packages/grammar-selector/styles/grammar-selector.less @@ -4,3 +4,7 @@ .grammar-status a:hover { color: @text-color; } + +.grammar-selector-parser { + margin-right: @component-padding; +} From 4abfa5fd0af8947e14959b67000798afa4d91692 Mon Sep 17 00:00:00 2001 From: simurai Date: Wed, 13 Feb 2019 16:45:54 +0900 Subject: [PATCH 016/184] Add description --- packages/grammar-selector/lib/grammar-list-view.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 0caa19dae..1d752b75f 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -26,6 +26,7 @@ class GrammarListView { const parser = document.createElement('span') parser.classList.add('grammar-selector-parser', 'badge', 'badge-success') parser.textContent = 'Tree-sitter' + parser.setAttribute('title', '(Recommended) A faster parser with improved syntax highlighting & code navigation support.') div.appendChild(parser) } From 2aef2daa259183440517d37ac9981fa66a3946e9 Mon Sep 17 00:00:00 2001 From: simurai Date: Wed, 13 Feb 2019 16:46:47 +0900 Subject: [PATCH 017/184] Remove console.log --- packages/grammar-selector/lib/grammar-list-view.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 1d752b75f..aec8e8066 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -21,8 +21,6 @@ class GrammarListView { div.classList.add('pull-right') if (grammar.constructor.name === "TreeSitterGrammar") { - console.log("TS", grammar) - const parser = document.createElement('span') parser.classList.add('grammar-selector-parser', 'badge', 'badge-success') parser.textContent = 'Tree-sitter' From 8d4b9c248596fb8432f7c1e5f883c934fa34e71b Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Sun, 17 Feb 2019 21:24:27 +1100 Subject: [PATCH 018/184] Allow hiding duplicates + stable sort TS --- .../grammar-selector/lib/grammar-list-view.js | 52 +++++++++++++++---- packages/grammar-selector/package.json | 5 ++ src/grammar-registry.js | 10 ++-- 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index aec8e8066..b6c7c633b 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -20,7 +20,7 @@ class GrammarListView { const div = document.createElement('div') div.classList.add('pull-right') - if (grammar.constructor.name === "TreeSitterGrammar") { + if (isTreeSitter(grammar)) { const parser = document.createElement('span') parser.classList.add('grammar-selector-parser', 'badge', 'badge-success') parser.textContent = 'Tree-sitter' @@ -82,28 +82,47 @@ class GrammarListView { async toggle () { if (this.panel != null) { this.cancel() - } else if (atom.workspace.getActiveTextEditor()) { - this.editor = atom.workspace.getActiveTextEditor() + return + } + + const editor = atom.workspace.getActiveTextEditor() + if (editor) { + this.editor = editor this.currentGrammar = this.editor.getGrammar() if (this.currentGrammar === atom.grammars.nullGrammar) { this.currentGrammar = this.autoDetect } - const grammars = atom.grammars.getGrammars(true).filter((grammar) => { + let grammars = atom.grammars.getGrammars({includeTreeSitter: true}).filter(grammar => { return grammar !== atom.grammars.nullGrammar && grammar.name }) + + if (atom.config.get("grammar-selector.hideDuplicateTextMateGrammars")) { + const oldGrammars = grammars + grammars = [] + const blacklist = new Set() + for (const grammar of oldGrammars) { + if (isTreeSitter(grammar)) { + blacklist.add(grammar.name) + grammars.push(grammar) + } + } + atom.grammars.getGrammars({includeTreeSitter: false}).forEach(grammar => { + if (grammar !== atom.grammars.nullGrammar && grammar.name && !blacklist.has(grammar.name)) { + grammars.push(grammar) + } + }) + } + grammars.sort((a, b) => { if (a.scopeName === 'text.plain') { return -1 } else if (b.scopeName === 'text.plain') { return 1 - } else if (a.name) { - return a.name.localeCompare(b.name) - } else if (a.scopeName) { - return a.scopeName.localeCompare(b.scopeName) - } else { - return 1 + } else if (a.name === b.name) { + return compareGrammarType(a, b) } + return a.name.localeCompare(b.name) }) grammars.unshift(this.autoDetect) await this.selectListView.update({items: grammars}) @@ -111,3 +130,16 @@ class GrammarListView { } } } + +function isTreeSitter (grammar) { + return grammar.constructor.name === "TreeSitterGrammar" +} + +function compareGrammarType (a, b) { + if (isTreeSitter(a)) { + return -1 + } else if (isTreeSitter(b)) { + return 1 + } + return 0 +} diff --git a/packages/grammar-selector/package.json b/packages/grammar-selector/package.json index 624cfe0bc..8e08012f0 100644 --- a/packages/grammar-selector/package.json +++ b/packages/grammar-selector/package.json @@ -37,6 +37,11 @@ "type": "boolean", "default": true, "description": "Show the active pane item's language on the right side of Atom's status bar, instead of the left." + }, + "hideDuplicateTextMateGrammars": { + "type": "boolean", + "default": true, + "description": "Hides the TextMate grammar when there is an existing Tree-sitter grammar" } } } diff --git a/src/grammar-registry.js b/src/grammar-registry.js index a96e7c647..8845705ae 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -549,10 +549,12 @@ class GrammarRegistry { // Extended: Get all the grammars in this registry. // // Returns a non-empty {Array} of {Grammar} instances. - getGrammars (includeTreesitter = false) { - let grammars = this.textmateRegistry.getGrammars() - if (includeTreesitter) grammars = grammars.concat(Object.values(this.treeSitterGrammarsById)) - return grammars + getGrammars (params = {includeTreeSitter: false}) { + let tmGrammars = this.textmateRegistry.getGrammars() + if (!params.includeTreeSitter) return tmGrammars + + let tsGrammars = Object.values(this.treeSitterGrammarsById) + return tsGrammars.concat(tmGrammars) } scopeForId (id) { From e9e52f5052d0a512e6e3ecd9eefb67bff8b4cc91 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 18 Feb 2019 09:28:56 +1100 Subject: [PATCH 019/184] Make method to assign specific grammar --- .../grammar-selector/lib/grammar-list-view.js | 2 +- src/grammar-registry.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index b6c7c633b..d4e4c863e 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -43,7 +43,7 @@ class GrammarListView { if (grammar === this.autoDetect) { atom.textEditors.clearGrammarOverride(this.editor) } else { - atom.textEditors.setGrammarOverride(this.editor, grammar.scopeName) + atom.grammars.assignGrammar(this.editor, grammar) } }, didCancelSelection: () => { diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 8845705ae..8858c504c 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -142,6 +142,22 @@ class GrammarRegistry { return true } + // Extended: Force a {TextBuffer} to use a different grammar than the + // one that would otherwise be selected for it. + // + // * `buffer` The {TextBuffer} whose grammar will be set. + // * `grammar` The {Grammar} of the desired languageMode. + // + // Returns a {Boolean} that indicates whether the assignment was sucessful + assignGrammar (buffer, grammar) { + if (buffer.getBuffer) buffer = buffer.getBuffer() + if (!grammar) return false + this.languageOverridesByBufferId.set(buffer.id, grammar.scopeName || null) + this.grammarScoresByBuffer.set(buffer, null) + buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(grammar, buffer)) + return true + } + // Extended: Get the `languageId` that has been explicitly assigned to // to the given buffer, if any. // From 2cb9bc46adfd6830e0e3a1029105c48a123547c0 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 18 Feb 2019 16:23:06 +1100 Subject: [PATCH 020/184] Fix specs --- .../grammar-selector/spec/grammar-selector-spec.js | 11 ++++------- src/grammar-registry.js | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index 21ea63d38..aaea64b42 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -8,6 +8,7 @@ describe('GrammarSelector', () => { beforeEach(async () => { jasmine.attachToDOM(atom.views.getView(atom.workspace)) atom.config.set('grammar-selector.showOnRightSideOfStatusBar', false) + atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false) await atom.packages.activatePackage('status-bar') await atom.packages.activatePackage('grammar-selector') @@ -30,13 +31,9 @@ describe('GrammarSelector', () => { await SelectListView.getScheduler().getNextUpdatePromise() const grammarView = atom.workspace.getModalPanels()[0].getItem().element - // TODO: Remove once Atom 1.23 reaches stable - if (parseFloat(atom.getVersion()) >= 1.23) { - // Do not take into account the two JS regex grammars or language-with-no-name - expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.length - 3) - } else { - expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.length - 1) - } + + // -1 for removing nullGrammar, +1 for adding "Auto Detect" + expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.filter(g => g.name).length) expect(grammarView.querySelectorAll('li')[0].textContent).toBe('Auto Detect') expect(grammarView.textContent.includes('source.a')).toBe(false) grammarView.querySelectorAll('li').forEach(li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name)) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 8858c504c..0bb60336d 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -458,7 +458,7 @@ class GrammarRegistry { } get grammars () { - return this.textmateRegistry.grammars + return this.getGrammars({includeTreeSitter: true}) } decodeTokens () { From 321b493f83c7beb4bbef34d2dd3efb858167f14c Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 18 Feb 2019 20:57:52 +1100 Subject: [PATCH 021/184] add specs --- .../spec/grammar-selector-spec.js | 84 +++++++++++++------ 1 file changed, 60 insertions(+), 24 deletions(-) diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index aaea64b42..460994053 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -27,25 +27,21 @@ describe('GrammarSelector', () => { describe('when grammar-selector:show is triggered', () => it('displays a list of all the available grammars', async () => { - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - const grammarView = atom.workspace.getModalPanels()[0].getItem().element + const grammarView = (await getGrammarView(editor)).element // -1 for removing nullGrammar, +1 for adding "Auto Detect" + // Tree-sitter names the regex and JSDoc grammars expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.filter(g => g.name).length) expect(grammarView.querySelectorAll('li')[0].textContent).toBe('Auto Detect') expect(grammarView.textContent.includes('source.a')).toBe(false) grammarView.querySelectorAll('li').forEach(li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name)) + expect(grammarView.textContent.includes("Tree-sitter")).toBe(true) // check we are showing and labelling Tree-sitter grammars }) ) describe('when a grammar is selected', () => it('sets the new grammar on the editor', async () => { - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - const grammarView = atom.workspace.getModalPanels()[0].getItem() + const grammarView = await getGrammarView(editor) grammarView.props.didConfirmSelection(textGrammar) expect(editor.getGrammar()).toBe(textGrammar) }) @@ -53,17 +49,11 @@ describe('GrammarSelector', () => { describe('when auto-detect is selected', () => it('restores the auto-detected grammar on the editor', async () => { - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - let grammarView = atom.workspace.getModalPanels()[0].getItem() + let grammarView = await getGrammarView(editor) grammarView.props.didConfirmSelection(textGrammar) expect(editor.getGrammar()).toBe(textGrammar) - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - grammarView = atom.workspace.getModalPanels()[0].getItem() + grammarView = await getGrammarView(editor) grammarView.props.didConfirmSelection(grammarView.items[0]) expect(editor.getGrammar()).toBe(jsGrammar) }) @@ -72,10 +62,7 @@ describe('GrammarSelector', () => { describe("when the editor's current grammar is the null grammar", () => it('displays Auto Detect as the selected grammar', async () => { editor.setGrammar(atom.grammars.nullGrammar) - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - const grammarView = atom.workspace.getModalPanels()[0].getItem().element + const grammarView = (await getGrammarView(editor)).element expect(grammarView.querySelector('li.active').textContent).toBe('Auto Detect') }) ) @@ -85,10 +72,7 @@ describe('GrammarSelector', () => { editor = await atom.workspace.open() expect(editor.getGrammar()).not.toBe(jsGrammar) - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - - const grammarView = atom.workspace.getModalPanels()[0].getItem() + const grammarView = await getGrammarView(editor) grammarView.props.didConfirmSelection(jsGrammar) expect(editor.getGrammar()).toBe(jsGrammar) }) @@ -170,6 +154,52 @@ describe('GrammarSelector', () => { }) ) + describe('when toggling hideDuplicateTextMateGrammars', () => { + it('shows only the Tree-sitter if true and both exist', async () => { + // the main JS grammar has both a TextMate and Tree-sitter implementation + atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', true) + const grammarView = await getGrammarView(editor) + const observedNames = new Set() + grammarView.element.querySelectorAll('li').forEach(li => { + const name = li.getAttribute('data-grammar') + expect(observedNames.has(name)).toBe(false) + observedNames.add(name) + }) + + // check the seen JS is actually the Tree-sitter one + const list = atom.workspace.getModalPanels()[0].item + for (const item of list.items) { + if (item.name === "JavaScript") { + expect(item.constructor.name === "TreeSitterGrammar") + } + } + }) + + it('shows both if false', async () => { + atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false) + const grammarView = await getGrammarView(editor) + let jsCount = 0 + grammarView.element.querySelectorAll('li').forEach(li => { + const name = li.getAttribute('data-grammar') + if (name === "JavaScript") jsCount++ + }) + expect(jsCount).toBe(2) + }) + }) + + describe('for every Tree-sitter grammar', () => { + it('adds a label to identify it as Tree-sitter', async () => { + const grammarView = await getGrammarView(editor) + const elements = grammarView.element.querySelectorAll('li') + const listItems = atom.workspace.getModalPanels()[0].item.items + for (let i = 0; i < listItems.length; i++) { + if (listItems[i].constructor.name === "TreeSitterGrammar") { + expect(elements[i].childNodes[1].childNodes[0].className.startsWith('grammar-selector-parser')).toBe(true) + } + } + }) + }) + describe('when clicked', () => it('shows the grammar selector modal', () => { const eventHandler = jasmine.createSpy('eventHandler') @@ -193,3 +223,9 @@ function getTooltipText (element) { const [tooltip] = atom.tooltips.findTooltips(element) return tooltip.getTitle() } + +async function getGrammarView (editor) { + atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') + await SelectListView.getScheduler().getNextUpdatePromise() + return atom.workspace.getModalPanels()[0].getItem() +} From 424c7123b8d0e39123d4c26902b37415871b49bc Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 4 Mar 2019 17:39:58 +1100 Subject: [PATCH 022/184] fix lints --- packages/grammar-selector/lib/grammar-list-view.js | 4 ++-- .../grammar-selector/spec/grammar-selector-spec.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 94849890e..eb06780df 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -96,7 +96,7 @@ module.exports = class GrammarListView { return grammar !== atom.grammars.nullGrammar && grammar.name }) - if (atom.config.get("grammar-selector.hideDuplicateTextMateGrammars")) { + if (atom.config.get('grammar-selector.hideDuplicateTextMateGrammars')) { const oldGrammars = grammars grammars = [] const blacklist = new Set() @@ -131,7 +131,7 @@ module.exports = class GrammarListView { } function isTreeSitter (grammar) { - return grammar.constructor.name === "TreeSitterGrammar" + return grammar.constructor.name === 'TreeSitterGrammar' } function compareGrammarType (a, b) { diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index 1144f903a..e1b27ff2a 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -36,7 +36,7 @@ describe('GrammarSelector', () => { expect(grammarView.querySelectorAll('li')[0].textContent).toBe('Auto Detect') expect(grammarView.textContent.includes('source.a')).toBe(false) grammarView.querySelectorAll('li').forEach(li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name)) - expect(grammarView.textContent.includes("Tree-sitter")).toBe(true) // check we are showing and labelling Tree-sitter grammars + expect(grammarView.textContent.includes('Tree-sitter')).toBe(true) // check we are showing and labelling Tree-sitter grammars }) ) @@ -185,8 +185,8 @@ describe('GrammarSelector', () => { // check the seen JS is actually the Tree-sitter one const list = atom.workspace.getModalPanels()[0].item for (const item of list.items) { - if (item.name === "JavaScript") { - expect(item.constructor.name === "TreeSitterGrammar") + if (item.name === 'JavaScript') { + expect(item.constructor.name === 'TreeSitterGrammar') } } }) @@ -197,7 +197,7 @@ describe('GrammarSelector', () => { let jsCount = 0 grammarView.element.querySelectorAll('li').forEach(li => { const name = li.getAttribute('data-grammar') - if (name === "JavaScript") jsCount++ + if (name === 'JavaScript') jsCount++ }) expect(jsCount).toBe(2) }) @@ -209,7 +209,7 @@ describe('GrammarSelector', () => { const elements = grammarView.element.querySelectorAll('li') const listItems = atom.workspace.getModalPanels()[0].item.items for (let i = 0; i < listItems.length; i++) { - if (listItems[i].constructor.name === "TreeSitterGrammar") { + if (listItems[i].constructor.name === 'TreeSitterGrammar') { expect(elements[i].childNodes[1].childNodes[0].className.startsWith('grammar-selector-parser')).toBe(true) } } From cb501f88978ff743c78bc099a2081fb016280bf2 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 4 Mar 2019 21:09:26 +1100 Subject: [PATCH 023/184] Better tests and enable returning Tree-sitter by default --- .../spec/grammar-selector-spec.js | 32 ++++++++++++++----- src/grammar-registry.js | 12 ++++--- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index e1b27ff2a..bc6f45cc0 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -35,7 +35,9 @@ describe('GrammarSelector', () => { expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.filter(g => g.name).length) expect(grammarView.querySelectorAll('li')[0].textContent).toBe('Auto Detect') expect(grammarView.textContent.includes('source.a')).toBe(false) - grammarView.querySelectorAll('li').forEach(li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name)) + grammarView.querySelectorAll('li').forEach( + li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name) + ) expect(grammarView.textContent.includes('Tree-sitter')).toBe(true) // check we are showing and labelling Tree-sitter grammars }) ) @@ -192,14 +194,28 @@ describe('GrammarSelector', () => { }) it('shows both if false', async () => { + await atom.packages.activatePackage('language-c') // punctuation making it sort wrong atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false) - const grammarView = await getGrammarView(editor) - let jsCount = 0 - grammarView.element.querySelectorAll('li').forEach(li => { - const name = li.getAttribute('data-grammar') - if (name === 'JavaScript') jsCount++ - }) - expect(jsCount).toBe(2) + await getGrammarView(editor) + let cppCount = 0 + + const listItems = atom.workspace.getModalPanels()[0].item.items + for (let i = 0; i < listItems.length; i++) { + const grammar = listItems[i] + const name = grammar.name + if (cppCount === 0 && name === 'C++') { + expect(grammar.constructor.name).toBe('TreeSitterGrammar') // first C++ entry should be Tree-sitter + cppCount++ + } else if (cppCount === 1) { + expect(name).toBe('C++') + expect(grammar.constructor.name).toBe('Grammar') // immediate next grammar should be the TextMate version + cppCount++ + } else { + expect(name).not.toBe('C++') // there should not be any other C++ grammars + } + } + + expect(cppCount).toBe(2) // ensure we actually saw both grammars }) }) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 0bb60336d..7c7f0c6aa 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -458,7 +458,7 @@ class GrammarRegistry { } get grammars () { - return this.getGrammars({includeTreeSitter: true}) + return this.getGrammars() } decodeTokens () { @@ -562,12 +562,16 @@ class GrammarRegistry { } } - // Extended: Get all the grammars in this registry. + // Extended: Get all the grammars in this registry. PLOL + // + // * `options` (optional) {Object} + // * `textMateOnly` (optional) {Boolean} Set to ignore + // [Tree-sitter](https://github.blog/2018-10-31-atoms-new-parsing-system/) grammars // // Returns a non-empty {Array} of {Grammar} instances. - getGrammars (params = {includeTreeSitter: false}) { + getGrammars (params) { let tmGrammars = this.textmateRegistry.getGrammars() - if (!params.includeTreeSitter) return tmGrammars + if (params && params.textMateOnly) return tmGrammars let tsGrammars = Object.values(this.treeSitterGrammarsById) return tsGrammars.concat(tmGrammars) From d277c94cd8a3fed3a8806bb302bc06997c3bd5a3 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 4 Mar 2019 21:38:41 +1100 Subject: [PATCH 024/184] docs and minor tweaks --- src/grammar-registry.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 7c7f0c6aa..fbe34f0f7 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -146,15 +146,17 @@ class GrammarRegistry { // one that would otherwise be selected for it. // // * `buffer` The {TextBuffer} whose grammar will be set. - // * `grammar` The {Grammar} of the desired languageMode. + // * `grammar` The desired {Grammar}. // // Returns a {Boolean} that indicates whether the assignment was sucessful assignGrammar (buffer, grammar) { - if (buffer.getBuffer) buffer = buffer.getBuffer() if (!grammar) return false + if (buffer.getBuffer) buffer = buffer.getBuffer() this.languageOverridesByBufferId.set(buffer.id, grammar.scopeName || null) this.grammarScoresByBuffer.set(buffer, null) - buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(grammar, buffer)) + if (grammar !== buffer.getLanguageMode().grammar) { + buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(grammar, buffer)) + } return true } @@ -319,11 +321,7 @@ class GrammarRegistry { } forEachGrammar (callback) { - this.textmateRegistry.grammars.forEach(callback) - for (const grammarId in this.treeSitterGrammarsById) { - const grammar = this.treeSitterGrammarsById[grammarId] - if (grammar.scopeName) callback(grammar) - } + this.grammars.forEach(callback) } grammarForId (languageId) { @@ -562,7 +560,7 @@ class GrammarRegistry { } } - // Extended: Get all the grammars in this registry. PLOL + // Extended: Get all the grammars in this registry. // // * `options` (optional) {Object} // * `textMateOnly` (optional) {Boolean} Set to ignore From 0312f5347c77a9b8a555e55f6192d814eb8f93f6 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 4 Mar 2019 22:52:32 +1100 Subject: [PATCH 025/184] fix specs --- spec/grammar-registry-spec.js | 34 ++++++++++++++++++++++++++++++++++ src/grammar-registry.js | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/spec/grammar-registry-spec.js b/spec/grammar-registry-spec.js index 34cea04b5..296b1da44 100644 --- a/spec/grammar-registry-spec.js +++ b/spec/grammar-registry-spec.js @@ -64,6 +64,21 @@ describe('GrammarRegistry', () => { }) }) + describe('.assignGrammar(buffer, grammar)', () => { + it('allows a TextMate grammar to be assigned directly, even when Tree-sitter is permitted', () => { + grammarRegistry.loadGrammarSync( + require.resolve('language-javascript/grammars/tree-sitter-javascript.cson') + ) + const tmGrammar = grammarRegistry.loadGrammarSync( + require.resolve('language-javascript/grammars/javascript.cson') + ) + + const buffer = new TextBuffer() + expect(grammarRegistry.assignGrammar(buffer, tmGrammar)).toBe(true) + expect(buffer.getLanguageMode().getGrammar()).toBe(tmGrammar) + }) + }) + describe('.grammarForId(languageId)', () => { it('returns a text-mate grammar when `core.useTreeSitterParsers` is false', () => { atom.config.set('core.useTreeSitterParsers', false, { @@ -823,6 +838,25 @@ describe('GrammarRegistry', () => { expect(buffer2Copy.getLanguageMode().getLanguageId()).toBe('source.js') }) }) + + describe('when working with grammars', () => { + beforeEach(async () => { + await atom.packages.activatePackage('language-javascript') + }) + + it('returns both Tree-sitter and TextMate grammars by default', async () => { + const allGrammars = atom.grammars.getGrammars() + const tmGrammars = atom.grammars.getGrammars({textMateOnly: true}) + expect(allGrammars.length).toBeGreaterThan(tmGrammars.length) + }) + + it('executes the foreach callback on both Tree-sitter and TextMate grammars', async () => { + const numAllGrammars = atom.grammars.getGrammars().length + let i = 0; + atom.grammars.forEachGrammar(() => i++) + expect(i).toBe(numAllGrammars) + }) + }) }) function retainedBufferCount (grammarRegistry) { diff --git a/src/grammar-registry.js b/src/grammar-registry.js index fbe34f0f7..8ea9438e8 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -571,8 +571,8 @@ class GrammarRegistry { let tmGrammars = this.textmateRegistry.getGrammars() if (params && params.textMateOnly) return tmGrammars - let tsGrammars = Object.values(this.treeSitterGrammarsById) - return tsGrammars.concat(tmGrammars) + const tsGrammars = Object.values(this.treeSitterGrammarsById).filter(g => g.scopeName) + return tmGrammars.concat(tsGrammars) // NullGrammar is expected to be first } scopeForId (id) { From 8a488b2bd174441645be342ef5164e016c8d8050 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Mon, 4 Mar 2019 23:44:57 +1100 Subject: [PATCH 026/184] fix lint --- spec/grammar-registry-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/grammar-registry-spec.js b/spec/grammar-registry-spec.js index 296b1da44..50b9a7261 100644 --- a/spec/grammar-registry-spec.js +++ b/spec/grammar-registry-spec.js @@ -852,7 +852,7 @@ describe('GrammarRegistry', () => { it('executes the foreach callback on both Tree-sitter and TextMate grammars', async () => { const numAllGrammars = atom.grammars.getGrammars().length - let i = 0; + let i = 0 atom.grammars.forEachGrammar(() => i++) expect(i).toBe(numAllGrammars) }) From 391bf710aa340b837d6e71b67ccd8027e0b7b5c4 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Tue, 5 Mar 2019 13:17:35 +1100 Subject: [PATCH 027/184] fix serialisation spec --- spec/workspace-spec.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 50dd57682..1ad8acac3 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -1978,14 +1978,10 @@ describe('Workspace', () => { .map(grammar => grammar.scopeName) .sort() ).toEqual([ - 'source.coffee', - 'source.js', - 'source.js.regexp', - 'source.js.regexp.replacement', - 'source.jsdoc', - 'source.litcoffee', - 'text.plain.null-grammar', - 'text.todo' + atom.grammars + .getGrammars() + .map(grammar => grammar.scopeName) + .sort() ]) atom2.destroy() From f4887f7de660e601502004ac7e5a37c93884fa55 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Tue, 5 Mar 2019 13:23:26 +1100 Subject: [PATCH 028/184] actually fix it --- spec/workspace-spec.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 1ad8acac3..e5c2fa9f7 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -1978,10 +1978,17 @@ describe('Workspace', () => { .map(grammar => grammar.scopeName) .sort() ).toEqual([ - atom.grammars - .getGrammars() - .map(grammar => grammar.scopeName) - .sort() + 'source.coffee', + 'source.js', + 'source.js', + 'source.js.regexp', + 'source.js.regexp', + 'source.js.regexp.replacement', + 'source.jsdoc', + 'source.jsdoc', + 'source.litcoffee', + 'text.plain.null-grammar', + 'text.todo' ]) atom2.destroy() From 814c23b95035d73c8497e3b4e64c92953de1020a Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Tue, 5 Mar 2019 14:30:29 +1100 Subject: [PATCH 029/184] this? --- spec/workspace-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index e5c2fa9f7..fb1e91948 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -1979,7 +1979,7 @@ describe('Workspace', () => { .sort() ).toEqual([ 'source.coffee', - 'source.js', + 'source.js', // Tree-sitter grammars also load 'source.js', 'source.js.regexp', 'source.js.regexp', From d6dca879c48407d3289f5a448c9175a30248da07 Mon Sep 17 00:00:00 2001 From: dan1wang Date: Thu, 23 May 2019 13:30:43 +0800 Subject: [PATCH 030/184] Highlight keyword.operator by default (#19386) --- packages/one-dark-syntax/styles/syntax/_base.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/one-dark-syntax/styles/syntax/_base.less b/packages/one-dark-syntax/styles/syntax/_base.less index df706b084..64481655f 100644 --- a/packages/one-dark-syntax/styles/syntax/_base.less +++ b/packages/one-dark-syntax/styles/syntax/_base.less @@ -28,7 +28,7 @@ } &.syntax--operator { - color: @mono-1; + color: @hue-3; } &.syntax--other.syntax--special-method { From 54f757bbe70a697c0751ebf0ab70b2c7f49b1872 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 23 May 2019 18:26:26 -0400 Subject: [PATCH 031/184] autoflow: Do not reflow selections that contain only LaTeX tags --- packages/autoflow/lib/autoflow.coffee | 20 +++- packages/autoflow/spec/autoflow-spec.coffee | 125 +++++++++++--------- 2 files changed, 82 insertions(+), 63 deletions(-) diff --git a/packages/autoflow/lib/autoflow.coffee b/packages/autoflow/lib/autoflow.coffee index 656d800e4..e9e85df01 100644 --- a/packages/autoflow/lib/autoflow.coffee +++ b/packages/autoflow/lib/autoflow.coffee @@ -60,15 +60,25 @@ module.exports = latexTagRegex = /^\s*\\\w+(\[.*\])?\{\w+\}(\[.*\])?\s*$/g # e.g. \begin{verbatim} latexTagStartRegex = /^\s*\\\w+\s*\{\s*$/g # e.g. \item{ latexTagEndRegex = /^\s*\}\s*$/g # e.g. } - while blockLines[0].match(latexTagRegex) or - blockLines[0].match(latexTagStartRegex) + while blockLines.length > 0 and ( + blockLines[0].match(latexTagRegex) or + blockLines[0].match(latexTagStartRegex)) beginningLinesToIgnore.push(blockLines[0]) blockLines.shift() - while blockLines[blockLines.length - 1].match(latexTagRegex) or - blockLines[blockLines.length - 1].match(latexTagEndRegex) + while blockLines.length > 0 and ( + blockLines[blockLines.length - 1].match(latexTagRegex) or + blockLines[blockLines.length - 1].match(latexTagEndRegex)) endingLinesToIgnore.unshift(blockLines[blockLines.length - 1]) blockLines.pop() + # The paragraph might be a LaTeX section with no text, only tags: + # \documentclass{article} + # In that case, we have nothing to reflow. + # Push the tags verbatim and continue to the next paragraph. + unless blockLines.length > 0 + paragraphs.push(block) + continue + # TODO: this could be more language specific. Use the actual comment char. # Remember that `-` has to be the last character in the character class. linePrefix = blockLines[0].match(/^\s*(\/\/|\/\*|;;|#'|\|\|\||--|[#%*>-])?\s*/g)[0] @@ -112,7 +122,7 @@ module.exports = wrappedLines = beginningLinesToIgnore.concat(lines.concat(endingLinesToIgnore)) paragraphs.push(wrappedLines.join('\n').replace(/\s+\n/g, '\n')) - leadingVerticalSpace + paragraphs.join('\n\n') + trailingVerticalSpace + return leadingVerticalSpace + paragraphs.join('\n\n') + trailingVerticalSpace getTabLength: (editor) -> atom.config.get('editor.tabLength', scope: editor.getRootScopeDescriptor()) ? 2 diff --git a/packages/autoflow/spec/autoflow-spec.coffee b/packages/autoflow/spec/autoflow-spec.coffee index 3e132305d..c302042c1 100644 --- a/packages/autoflow/spec/autoflow-spec.coffee +++ b/packages/autoflow/spec/autoflow-spec.coffee @@ -561,70 +561,79 @@ describe "Autoflow package", -> expect(autoflow.reflow(test, wrapColumn: 80)).toEqual res - it 'properly reflows text around LaTeX tags', -> - text = - ''' - \\begin{verbatim} - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. - \\end{verbatim} - ''' + describe 'LaTeX', -> + it 'properly reflows text around LaTeX tags', -> + text = + ''' + \\begin{verbatim} + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. + \\end{verbatim} + ''' - res = - ''' - \\begin{verbatim} - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at - blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget - condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec - semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit - quam, elementum neque pellentesque pulvinar et vestibulum. - \\end{verbatim} - ''' + res = + ''' + \\begin{verbatim} + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at + blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget + condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec + semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit + quam, elementum neque pellentesque pulvinar et vestibulum. + \\end{verbatim} + ''' - expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res + expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res - it 'properly reflows text inside LaTeX tags', -> - text = - ''' - \\item{ - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. - } - ''' + it 'properly reflows text inside LaTeX tags', -> + text = + ''' + \\item{ + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. + } + ''' - res = - ''' - \\item{ - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at - blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget - condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec - semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit - quam, elementum neque pellentesque pulvinar et vestibulum. - } - ''' + res = + ''' + \\item{ + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at + blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget + condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec + semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit + quam, elementum neque pellentesque pulvinar et vestibulum. + } + ''' - expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res + expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res - it 'properly reflows text inside nested LaTeX tags', -> - text = - ''' - \\begin{enumerate}[label=(\\alph*)] - \\item{ - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. - } - \\end{enumerate} - ''' + it 'properly reflows text inside nested LaTeX tags', -> + text = + ''' + \\begin{enumerate}[label=(\\alph*)] + \\item{ + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore velit quam, elementum neque pellentesque pulvinar et vestibulum. + } + \\end{enumerate} + ''' - res = - ''' - \\begin{enumerate}[label=(\\alph*)] - \\item{ - Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at - blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. - Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. - Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore - velit quam, elementum neque pellentesque pulvinar et vestibulum. - } - \\end{enumerate} - ''' + res = + ''' + \\begin{enumerate}[label=(\\alph*)] + \\item{ + Lorem ipsum dolor sit amet, nisl odio amet, et tempor netus neque at at + blandit, vel vestibulum libero dolor, semper lobortis ligula praesent. + Eget condimentum integer, porta sagittis nam, fusce vitae a vitae augue. + Nec semper quis sed ut, est porttitor praesent. Nisl velit quam dolore + velit quam, elementum neque pellentesque pulvinar et vestibulum. + } + \\end{enumerate} + ''' - expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res + expect(autoflow.reflow(text, wrapColumn: 80)).toEqual res + it 'does not attempt to reflow a selection that contains only LaTeX tags and nothing else', -> + text = + ''' + \\begin{enumerate} + \\end{enumerate} + ''' + + expect(autoflow.reflow(text, wrapColumn: 5)).toEqual text From 21ed70687c55462df3777f97d1db7fc2d93515b2 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 23 May 2019 18:36:12 -0400 Subject: [PATCH 032/184] WIP: Upgrade webdriverio --- script/package-lock.json | 670 ++++++--------------- script/package.json | 2 +- spec/integration/helpers/start-atom.coffee | 165 ----- spec/integration/helpers/start-atom.js | 155 +++++ spec/integration/smoke-spec.coffee | 42 -- spec/integration/smoke-spec.js | 55 ++ 6 files changed, 396 insertions(+), 693 deletions(-) delete mode 100644 spec/integration/helpers/start-atom.coffee create mode 100644 spec/integration/helpers/start-atom.js delete mode 100644 spec/integration/smoke-spec.coffee create mode 100644 spec/integration/smoke-spec.js diff --git a/script/package-lock.json b/script/package-lock.json index 4c8ad5fe2..041660fa2 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -211,6 +211,104 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.4.tgz", "integrity": "sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA==" }, + "@wdio/config": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-5.9.1.tgz", + "integrity": "sha512-u5dqcTpUk4eXILEy5ytKX+0s7vXVHAwU/GghhbWrbL3mDTvZ65Wn6IyDGtBLckY6lfa2KF5Tswk0cg9mCw0mnA==", + "requires": { + "@wdio/logger": "^5.9.0", + "deepmerge": "^2.0.1", + "glob": "^7.1.2" + }, + "dependencies": { + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@wdio/logger": { + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-5.9.0.tgz", + "integrity": "sha512-L08MyO844LoTOnOZFxbupbTeqMAH7ZmrrNtN5AXpk3hJP7t4i5A+7eCiNWMpUpmOGHzM+04W27mYdaSei7imKg==", + "requires": { + "chalk": "^2.3.0", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.5.3", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@wdio/repl": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-5.9.1.tgz", + "integrity": "sha512-GUZ35ZLfNAIwKH/3TNrrusisMVX5Ukm9aLjbCRRKUCqGudD9yMFnkw1iJgfWFk38OnEcGS7plgdAJJooQx5Kqw==", + "requires": { + "@wdio/config": "^5.9.1" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -295,41 +393,6 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, - "archiver": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-0.6.1.tgz", - "integrity": "sha1-1AKZJXH9F5rtZy2Xl/iI5Wjh3Vw=", - "requires": { - "file-utils": "~0.1.5", - "lazystream": "~0.1.0", - "lodash": "~2.4.1", - "readable-stream": "~1.0.24", - "zip-stream": "~0.2.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } - }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -897,15 +960,6 @@ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" }, - "boom": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz", - "integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=", - "optional": true, - "requires": { - "hoek": "0.9.x" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1061,14 +1115,6 @@ "lazy-cache": "^1.0.3" } }, - "chainit": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/chainit/-/chainit-2.1.1.tgz", - "integrity": "sha1-5TRdnAcdRz5zJ0yIrqZskVE2KME=", - "requires": { - "queue": "~1.0.2" - } - }, "chainsaw": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", @@ -1471,15 +1517,6 @@ "which": "^1.2.8" } }, - "cryptiles": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz", - "integrity": "sha1-7ZH/HxetE9N0gohZT4pIoNJvMlw=", - "optional": true, - "requires": { - "boom": "0.4.x" - } - }, "cson-parser": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/cson-parser/-/cson-parser-1.0.9.tgz", @@ -1495,11 +1532,6 @@ } } }, - "css-parse": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", - "integrity": "sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs=" - }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -1532,12 +1564,6 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" }, - "ctype": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", - "integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=", - "optional": true - }, "cuint": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", @@ -1624,9 +1650,9 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "deepmerge": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-0.2.10.tgz", - "integrity": "sha1-iQa/nlJaT78bIDsq/LRkAkmCEhk=" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", + "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==" }, "deferred-leveldown": { "version": "4.0.2", @@ -3322,71 +3348,6 @@ "object-assign": "^4.0.1" } }, - "file-utils": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/file-utils/-/file-utils-0.1.5.tgz", - "integrity": "sha1-3IFTyFU4fLTaywoXJVMfpESmtIw=", - "requires": { - "findup-sync": "~0.1.2", - "glob": "~3.2.6", - "iconv-lite": "~0.2.11", - "isbinaryfile": "~0.1.9", - "lodash": "~2.1.0", - "minimatch": "~0.2.12", - "rimraf": "~2.2.2" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2", - "minimatch": "0.3" - }, - "dependencies": { - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, - "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=" - }, - "lodash": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.1.0.tgz", - "integrity": "sha1-Bjfqqjaooc/IZcOt+5Qhib+wmY0=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=" - } - } - }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -3423,45 +3384,6 @@ } } }, - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", - "requires": { - "glob": "~3.2.9", - "lodash": "~2.4.1" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2", - "minimatch": "0.3" - } - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, "flat-cache": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", @@ -3867,6 +3789,11 @@ "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" + }, "growl": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", @@ -3971,29 +3898,11 @@ } } }, - "hawk": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz", - "integrity": "sha1-uQuxaYByhUEdp//LjdJZhQLTtS0=", - "optional": true, - "requires": { - "boom": "0.4.x", - "cryptiles": "0.2.x", - "hoek": "0.9.x", - "sntp": "0.2.x" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" }, - "hoek": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", - "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=", - "optional": true - }, "home-or-tmp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", @@ -4543,11 +4452,6 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, - "isbinaryfile": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz", - "integrity": "sha1-Fe7ONcSrcI2JJNqZ+4dPK1zAtsQ=" - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4722,32 +4626,6 @@ "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" }, - "lazystream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz", - "integrity": "sha1-GyXWPHcqTCDwpe0KnXf0hLbhaSA=", - "requires": { - "readable-stream": "~1.0.2" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -4937,29 +4815,11 @@ "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=" }, - "lodash._isnative": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz", - "integrity": "sha1-PqZAS3hKe+g2x7V1gOHN95sUgyw=" - }, - "lodash._objecttypes": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz", - "integrity": "sha1-fAt/admKH3ZSn4kLDNsbTf7BHBE=" - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, - "lodash._shimkeys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz", - "integrity": "sha1-bpzJZm/wgfC1psl4uD4kLmlJ0gM=", - "requires": { - "lodash._objecttypes": "~2.4.1" - } - }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -4975,27 +4835,6 @@ "lodash._isiterateecall": "^3.0.0" } }, - "lodash.defaults": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz", - "integrity": "sha1-p+iIXwXmiFEUS24SqPNngCa8TFQ=", - "requires": { - "lodash._objecttypes": "~2.4.1", - "lodash.keys": "~2.4.1" - }, - "dependencies": { - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - } - } - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -5012,12 +4851,14 @@ "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" }, "lodash.isobject": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz", - "integrity": "sha1-Wi5H/mmVPx7mMafrof5k0tBlWPU=", - "requires": { - "lodash._objecttypes": "~2.4.1" - } + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" }, "lodash.keys": { "version": "3.1.2", @@ -5029,6 +4870,11 @@ "lodash.isarray": "^3.0.0" } }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + }, "lodash.startcase": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", @@ -5051,6 +4897,11 @@ "lodash._reinterpolate": "~3.0.0" } }, + "lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=" + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -5092,6 +4943,16 @@ } } }, + "loglevel": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", + "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" + }, + "loglevel-plugin-prefix": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.5.3.tgz", + "integrity": "sha512-zRAJw3WYCQAJ6xfEIi04/oqlmR6jkwg3hmBcMW82Zic3iPWyju1gwntcgic0m5NgqYNJ62alCmb0g/div26WjQ==" + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -8951,11 +8812,6 @@ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=" }, - "pragma-singleton": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pragma-singleton/-/pragma-singleton-1.0.3.tgz", - "integrity": "sha1-aJQxe7jUcVflneKkoAnbfm9j4w4=" - }, "prebuild-install": { "version": "5.2.5", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.2.5.tgz", @@ -9062,11 +8918,6 @@ "once": "^1.3.1" } }, - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -9077,16 +8928,6 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, - "queue": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/queue/-/queue-1.0.2.tgz", - "integrity": "sha1-LZr55hyaGuRVem842FtTTq/yBYE=" - }, "quick-lru": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", @@ -9521,6 +9362,21 @@ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, + "resq": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.5.0.tgz", + "integrity": "sha512-6US6oo2fQ/vgs7wBwqq1w9901Z5VEDgxQH0LrNaN8HcHUZInhtrIt1a0Icysu0vuoK26Bt+SR1dIYeR9+ftMxA==", + "requires": { + "fast-deep-equal": "^2.0.1" + }, + "dependencies": { + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + } + } + }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -9536,9 +9392,9 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, "rgb2hex": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.8.tgz", - "integrity": "sha512-kPH3Zm3UrBIfJv17AtJJGLRxak+Hvvz6SnsTBIajqB2Zbh+A4EEjkMWKkmGhms0cJlzOOjZcu1LX5K3vnON7ug==" + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.9.tgz", + "integrity": "sha512-32iuQzhOjyT+cv9aAFRBJ19JgHwzQwbjUhH3Fj2sWW2EEGAW8fpFrDFP5ndoKDxJaLO06x1hE3kyuIFrUQtybQ==" }, "right-align": { "version": "0.1.3", @@ -9646,6 +9502,11 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" }, + "serialize-error": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-3.0.0.tgz", + "integrity": "sha512-+y3nkkG/go1Vdw+2f/+XUXM1DXX1XcxTl99FfiD/OEPUNw4uo0i6FKABfTAN5ZcgGtjTRZcEbxcE/jtXbEY19A==" + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -9685,11 +9546,6 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" - }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -9860,15 +9716,6 @@ "kind-of": "^3.2.0" } }, - "sntp": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz", - "integrity": "sha1-+4hfGLDzqtGJ+CSGJTa87ux1CQA=", - "optional": true, - "requires": { - "hoek": "0.9.x" - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -11076,15 +10923,6 @@ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" }, - "url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -11163,142 +11001,37 @@ "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.12.tgz", "integrity": "sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==" }, - "webdriverio": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-2.4.5.tgz", - "integrity": "sha1-wD7ajhp+tCMDhYjm5z8nCyx03gs=", + "webdriver": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-5.9.1.tgz", + "integrity": "sha512-emUetEEJKN6ZsyZzj28D4HKC5p7Qo3ZSuuRlH9TpWyCp8ahxu3UicgL19ES//Sy1xPomWOi2Xk54/FLv/BIxgQ==", "requires": { - "archiver": "~0.6.1", - "async": "^0.9.0", - "chainit": "^2.1.1", - "css-parse": "^1.7.0", - "css-value": "0.0.1", - "deepmerge": "~0.2.7", - "pragma-singleton": "~1.0.3", - "q": "^1.1.2", - "request": "~2.34.0", - "rgb2hex": "^0.1.0", - "url": "^0.10.1", - "wgxpath": "^0.23.0" - }, - "dependencies": { - "asn1": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", - "integrity": "sha1-VZvhg3bQik7E2+gId9J4GGObLfc=", - "optional": true - }, - "assert-plus": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz", - "integrity": "sha1-7nQAlBMALYTOxyGcasgRgS5yMWA=", - "optional": true - }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, - "aws-sign2": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", - "integrity": "sha1-xXED96F/wDfwLXwuZLYC6iI/fWM=", - "optional": true - }, - "combined-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", - "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", - "optional": true, - "requires": { - "delayed-stream": "0.0.5" - } - }, - "delayed-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", - "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=", - "optional": true - }, - "forever-agent": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", - "integrity": "sha1-bQ4JxJIflKJ/Y9O0nF/v8epMUTA=" - }, - "form-data": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz", - "integrity": "sha1-kavXiKupcCsaq/qLwBAxoqyeOxI=", - "optional": true, - "requires": { - "async": "~0.9.0", - "combined-stream": "~0.0.4", - "mime": "~1.2.11" - } - }, - "http-signature": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz", - "integrity": "sha1-T72sEyVZqoMjEh5UB3nAoBKyfmY=", - "optional": true, - "requires": { - "asn1": "0.1.11", - "assert-plus": "^0.1.5", - "ctype": "0.5.3" - } - }, - "mime": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" - }, - "oauth-sign": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz", - "integrity": "sha1-y1QPk7srIqfVlBaRoojWDo6pOG4=", - "optional": true - }, - "qs": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz", - "integrity": "sha1-bgFQmP9RlouKPIGQAdXyyJvEsQc=" - }, - "request": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.34.0.tgz", - "integrity": "sha1-tdi5UmrdSi1GKfTUFxJFc5lkRa4=", - "requires": { - "aws-sign2": "~0.5.0", - "forever-agent": "~0.5.0", - "form-data": "~0.1.0", - "hawk": "~1.0.0", - "http-signature": "~0.10.0", - "json-stringify-safe": "~5.0.0", - "mime": "~1.2.9", - "node-uuid": "~1.4.0", - "oauth-sign": "~0.3.0", - "qs": "~0.6.0", - "tough-cookie": ">=0.12.0", - "tunnel-agent": "~0.3.0" - } - }, - "tunnel-agent": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz", - "integrity": "sha1-rWgbaPUyGtKCfEz7G31d8s/pQu4=", - "optional": true - } + "@wdio/config": "^5.9.1", + "@wdio/logger": "^5.9.0", + "deepmerge": "^2.0.1", + "lodash.merge": "^4.6.1", + "request": "^2.83.0" } }, - "wgxpath": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/wgxpath/-/wgxpath-0.23.0.tgz", - "integrity": "sha1-2z/IOJ2BhOluunA3SJc1wTYiep8=" + "webdriverio": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.1.tgz", + "integrity": "sha512-QYlIIrfqr7I0OSkg9HsZyOGpo7d8MlrH7ueo5MHsgNR2QgZG1OxHk/1edV3Te9Q2AUcpCmIKO1IOAJDxlYA+Rw==", + "requires": { + "@wdio/config": "^5.9.1", + "@wdio/logger": "^5.9.0", + "@wdio/repl": "^5.9.1", + "css-value": "^0.0.1", + "grapheme-splitter": "^1.0.2", + "lodash.isobject": "^3.0.2", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.1", + "lodash.zip": "^4.2.0", + "resq": "^1.5.0", + "rgb2hex": "^0.1.0", + "serialize-error": "^3.0.0", + "webdriver": "^5.9.1" + } }, "which": { "version": "1.3.1", @@ -11465,39 +11198,6 @@ "requires": { "fd-slicer": "~1.0.1" } - }, - "zip-stream": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-0.2.3.tgz", - "integrity": "sha1-rvCVN2z+E4lZqBNBmB0mM4tG2NM=", - "requires": { - "debug": "~0.7.4", - "lodash.defaults": "~2.4.1", - "readable-stream": "~1.0.24" - }, - "dependencies": { - "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } } } } diff --git a/script/package.json b/script/package.json index 1076c63a9..d72c8d5a5 100644 --- a/script/package.json +++ b/script/package.json @@ -46,7 +46,7 @@ "sync-request": "3.0.1", "tello": "1.0.7", "terser": "^3.8.1", - "webdriverio": "2.4.5", + "webdriverio": "^5.9.1", "yargs": "4.8.1" } } diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee deleted file mode 100644 index 4820a7120..000000000 --- a/spec/integration/helpers/start-atom.coffee +++ /dev/null @@ -1,165 +0,0 @@ -path = require 'path' -http = require 'http' -temp = require('temp').track() -os = require('os') -remote = require 'remote' -async = require 'async' -{map, extend, once, difference} = require 'underscore-plus' -{spawn, spawnSync} = require 'child_process' -webdriverio = require '../../../script/node_modules/webdriverio' - -AtomPath = remote.process.argv[0] -AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") -ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') -ChromedriverPort = 9515 -ChromedriverURLBase = "/wd/hub" -ChromedriverStatusURL = "http://localhost:#{ChromedriverPort}#{ChromedriverURLBase}/status" - -userDataDir = null - -chromeDriverUp = (done) -> - checkStatus = -> - http - .get ChromedriverStatusURL, (response) -> - if response.statusCode is 200 - done() - else - chromeDriverUp(done) - .on("error", -> chromeDriverUp(done)) - setTimeout(checkStatus, 100) - -chromeDriverDown = (done) -> - checkStatus = -> - http - .get ChromedriverStatusURL, (response) -> - chromeDriverDown(done) - .on("error", done) - setTimeout(checkStatus, 100) - -buildAtomClient = (args, env) -> - userDataDir = temp.mkdirSync('atom-user-data-dir') - client = webdriverio.remote( - host: 'localhost' - port: ChromedriverPort - desiredCapabilities: - browserName: "atom" - chromeOptions: - binary: AtomLauncherPath - args: [ - "atom-path=#{AtomPath}" - "atom-args=#{args.join(" ")}" - "atom-env=#{map(env, (value, key) -> "#{key}=#{value}").join(" ")}" - "dev" - "safe" - "user-data-dir=#{userDataDir}" - ]) - - isRunning = false - client.on "init", -> isRunning = true - client.on "end", -> isRunning = false - - client - .addCommand "waitUntil", (conditionFn, timeout, cb) -> - timedOut = succeeded = false - pollingInterval = Math.min(timeout, 100) - setTimeout((-> timedOut = true), timeout) - async.until( - (-> succeeded or timedOut), - ((next) => - setTimeout(=> - conditionFn.call(this).then( - ((result) -> - succeeded = result - next()), - ((err) -> next(err)) - ) - , pollingInterval)), - ((err) -> cb(err, succeeded))) - - .addCommand "waitForWindowCount", (count, timeout, cb) -> - @waitUntil(-> - @windowHandles().then ({value}) -> value.length is count - , timeout) - .then (result) -> expect(result).toBe(true) - .windowHandles(cb) - - .addCommand "waitForPaneItemCount", (count, timeout, cb) -> - @waitUntil(-> - @execute(-> atom.workspace?.getActivePane()?.getItems().length) - .then(({value}) -> value is count) - , timeout) - .then (result) -> - expect(result).toBe(true) - cb(null) - - .addCommand "treeViewRootDirectories", (cb) -> - @waitForExist('.tree-view', 10000) - .execute(-> - for element in document.querySelectorAll(".tree-view .project-root > .header .name") - element.dataset.path - , cb) - - .addCommand "waitForNewWindow", (fn, timeout, done) -> - @windowHandles (err, {value: oldWindowHandles}) -> - return done() unless isRunning - @call(fn) - .waitForWindowCount(oldWindowHandles.length + 1, 5000) - .then ({value: newWindowHandles}) -> - [newWindowHandle] = difference(newWindowHandles, oldWindowHandles) - return done() unless newWindowHandle - @window(newWindowHandle) - .waitForExist('atom-workspace', 10000, done) - - .addCommand "dispatchCommand", (command, done) -> - @execute "atom.commands.dispatch(document.activeElement, '#{command}')" - .call(done) - -module.exports = (args, env, fn) -> - [chromedriver, chromedriverLogs, chromedriverExit] = [] - - runs -> - chromedriver = spawn(ChromedriverPath, [ - "--verbose", - "--port=#{ChromedriverPort}", - "--url-base=#{ChromedriverURLBase}" - ]) - - chromedriverLogs = [] - chromedriverExit = new Promise (resolve) -> - errorCode = null - chromedriver.on "exit", (code, signal) -> - errorCode = code unless signal? - chromedriver.stderr.on "data", (log) -> - chromedriverLogs.push(log.toString()) - chromedriver.stderr.on "close", -> - resolve(errorCode) - - waitsFor("webdriver to start", chromeDriverUp, 15000) - - waitsFor("tests to run", (done) -> - finish = once -> - client.end() - .then(-> chromedriver.kill()) - .then(chromedriverExit.then( - (errorCode) -> - if errorCode? - jasmine.getEnv().currentSpec.fail """ - Chromedriver exited with code #{errorCode}. - Logs:\n#{chromedriverLogs.join("\n")} - """ - done())) - - client = buildAtomClient(args, env) - - client.on "error", (err) -> - jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message)) - finish() - - fn( - client.init() - .waitUntil((-> @windowHandles().then ({value}) -> value.length > 0), 10000) - .waitForExist("atom-workspace", 10000) - ).then(finish) - , 30000) - - waitsFor("webdriver to stop", chromeDriverDown, 15000) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js new file mode 100644 index 000000000..a8967ed25 --- /dev/null +++ b/spec/integration/helpers/start-atom.js @@ -0,0 +1,155 @@ +const path = require('path') +const http = require('http') +const temp = require('temp').track() +const os = require('os') +const remote = require('remote') +const async = require('async') +const {map, extend, once, difference} = require('underscore-plus') +const {spawn, spawnSync} = require('child_process') +const webdriverio = require('../../../script/node_modules/webdriverio') + +const AtomPath = remote.process.argv[0] +const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.cmd') +const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') +const ChromedriverPort = 9515 +const ChromedriverURLBase = '/wd/hub' +const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` + +let userDataDir = null + +const chromeDriverUp = done => { + const checkStatus = () => + http.get(ChromedriverStatusURL, function(response) { + if (response.statusCode === 200) { + done() + } else { + chromeDriverUp(done) + } + }).on('error', () => chromeDriverUp(done)) + + setTimeout(checkStatus, 100) +} + +const chromeDriverDown = done => { + const checkStatus = () => + http.get(ChromedriverStatusURL, response => chromeDriverDown(done)).on('error', done) + + setTimeout(checkStatus, 100) +} + +const buildAtomClient = async (args, env) => { + userDataDir = temp.mkdirSync('atom-user-data-dir') + console.log('awaiting webdriverio') + let client + try { + client = await webdriverio.remote({ + host: 'localhost', + port: ChromedriverPort, + capabilities: { + browserName: 'atom', + chromeOptions: { + binary: AtomLauncherPath, + args: [ + `atom-path=${AtomPath}`, + `atom-args=${args.join(' ')}`, + `atom-env=${map(env, (value, key) => `${key}=${value}`).join(' ')}`, + 'dev', + 'safe', + `user-data-dir=${userDataDir}` + ] + } + } + }) + } catch (error) { + console.log(error) + } + + console.log('about to build client') + + return client.addCommand('waitForWindowCount', async function (count, timeout) { + await this.waitUntil(() => this.getWindowHandles().length === count, timeout) + return this.getWindowHandles() + }).addCommand('waitForPaneItemCount', async function (count, timeout) { + await this.waitUntil(() => this.execute(() => { + if (atom.workspace) { + return atom.workspace.getActivePane().getItems().length + } + return 0 + }), timeout) + }).addCommand('treeViewRootDirectories', async function () { + await $('.tree-view').waitForExist(10000) + return this.execute(() => + Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) + .map(element => element.dataset.path) + ) + }).addCommand('dispatchCommand', async function (command) { + return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) + }) +} + +module.exports = function(args, env, fn) { + let [chromedriver, chromedriverLogs, chromedriverExit] = [] + + // runs(() => { + // chromedriver = spawn(ChromedriverPath, [ + // '--verbose', + // `--port=${ChromedriverPort}`, + // `--url-base=${ChromedriverURLBase}` + // ]) + // + // chromedriverLogs = [] + // chromedriverExit = new Promise(resolve => { + // let errorCode = null + // chromedriver.on('exit', (code, signal) => { + // if (signal == null) { + // errorCode = code + // } + // }) + // chromedriver.stdout.on('data', log => console.log(log.toString())) + // chromedriver.stderr.on('data', log => console.log(log.toString())) + // // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + // chromedriver.stderr.on('close', () => resolve(errorCode)) + // }) + // }) + // + // waitsFor('webdriver to start', chromeDriverUp, 15000) + + waitsFor('tests to run', async done => { + const client = await buildAtomClient(args, env) + + console.log('finished waiting for client') + + const finish = once(async () => { + chromedriver.kill() + const errorCode = await chromedriverExit + if (errorCode != null) { + jasmine.getEnv().currentSpec.fail(`\ +Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}\ +` + ) + } + done() + }) + + // client.on('error', err => { + // jasmine.getEnv().currentSpec.fail(new Error(__guard__(__guard__(err.response != null ? err.response.body : undefined, x1 => x1.value), x => x.message))) + // finish() + // }) + + await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + await $('atom-workspace').waitForExist(10000) + + console.log('about to wait on fn') + + await fn(client) + finish() + } + , 30000) + + waitsFor('webdriver to stop', chromeDriverDown, 15000) +} + +function __guard__(value, transform) { + return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined +} diff --git a/spec/integration/smoke-spec.coffee b/spec/integration/smoke-spec.coffee deleted file mode 100644 index dd6c9776f..000000000 --- a/spec/integration/smoke-spec.coffee +++ /dev/null @@ -1,42 +0,0 @@ -fs = require 'fs-plus' -path = require 'path' -season = require 'season' -temp = require('temp').track() -runAtom = require './helpers/start-atom' - -describe "Smoke Test", -> - return unless process.platform is 'darwin' # Fails on win32 - - atomHome = temp.mkdirSync('atom-home') - - beforeEach -> - jasmine.useRealClock() - season.writeFileSync(path.join(atomHome, 'config.cson'), { - '*': { - welcome: {showOnStartup: false}, - core: { - telemetryConsent: 'no', - disabledPackages: ['github'] - } - } - }) - - it "can open a file in Atom and perform basic operations on it", -> - tempDirPath = temp.mkdirSync("empty-dir") - filePath = path.join(tempDirPath, "new-file") - - fs.writeFileSync filePath, "", {encoding: "utf8"} - - runAtom [filePath], {ATOM_HOME: atomHome}, (client) -> - client - .treeViewRootDirectories() - .then ({value}) -> expect(value).toEqual([]) - .waitForExist("atom-text-editor", 5000) - .then (exists) -> expect(exists).toBe true - .waitForPaneItemCount(1, 1000) - .click("atom-text-editor") - .waitUntil((-> @execute(-> document.activeElement.closest('atom-text-editor'))), 5000) - .keys("Hello!") - .execute -> atom.workspace.getActiveTextEditor().getText() - .then ({value}) -> expect(value).toBe "Hello!" - .dispatchCommand("editor:delete-line") diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js new file mode 100644 index 000000000..0b8526499 --- /dev/null +++ b/spec/integration/smoke-spec.js @@ -0,0 +1,55 @@ +const fs = require('fs-plus') +const path = require('path') +const season = require('season') +const temp = require('temp').track() +const runAtom = require('./helpers/start-atom') + +describe('Smoke Test', () => { + // Fails on win32 + if (process.platform !== 'darwin') { + return + } + + const atomHome = temp.mkdirSync('atom-home') + + beforeEach(() => { + jasmine.useRealClock() + season.writeFileSync(path.join(atomHome, 'config.cson'), { + '*': { + welcome: {showOnStartup: false}, + core: { + telemetryConsent: 'no', + disabledPackages: ['github'] + } + } + }) + }) + + it('can open a file in Atom and perform basic operations on it', async () => { + const tempDirPath = temp.mkdirSync('empty-dir') + const filePath = path.join(tempDirPath, 'new-file') + + fs.writeFileSync(filePath, '', {encoding: 'utf8'}) + + runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + console.log('here!') + const roots = await client.treeViewRootDirectories() + expect(roots).toEqual([]) + + await $('atom-text-editor').waitForExist(5000) + + await client.waitForPaneItemCount(1, 1000) + + $('atom-text-editor').click() + + await client.waitUntil(function () { + return this.execute(() => document.activeElement.closest('atom-text-editor')) + }, 5000) + + const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) + expect(text).toBe('Hello!') + + await client.dispatchCommand('editor:delete-line') + }) + }) +}) From bc0e0a0ffe208aeef89be70b13747286abf39ae3 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 23 May 2019 23:15:42 -0400 Subject: [PATCH 033/184] Lint --- spec/integration/helpers/start-atom.js | 68 ++++++++++++-------------- spec/integration/smoke-spec.js | 5 +- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index a8967ed25..d14d96026 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,11 +1,11 @@ const path = require('path') const http = require('http') const temp = require('temp').track() -const os = require('os') +// const os = require('os') const remote = require('remote') -const async = require('async') -const {map, extend, once, difference} = require('underscore-plus') -const {spawn, spawnSync} = require('child_process') +// const async = require('async') +const {map, once} = require('underscore-plus') +const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') const AtomPath = remote.process.argv[0] @@ -64,8 +64,6 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('about to build client') - return client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() @@ -77,7 +75,7 @@ const buildAtomClient = async (args, env) => { return 0 }), timeout) }).addCommand('treeViewRootDirectories', async function () { - await $('.tree-view').waitForExist(10000) + await this.$('.tree-view').waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) @@ -90,35 +88,31 @@ const buildAtomClient = async (args, env) => { module.exports = function(args, env, fn) { let [chromedriver, chromedriverLogs, chromedriverExit] = [] - // runs(() => { - // chromedriver = spawn(ChromedriverPath, [ - // '--verbose', - // `--port=${ChromedriverPort}`, - // `--url-base=${ChromedriverURLBase}` - // ]) - // - // chromedriverLogs = [] - // chromedriverExit = new Promise(resolve => { - // let errorCode = null - // chromedriver.on('exit', (code, signal) => { - // if (signal == null) { - // errorCode = code - // } - // }) - // chromedriver.stdout.on('data', log => console.log(log.toString())) - // chromedriver.stderr.on('data', log => console.log(log.toString())) - // // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) - // chromedriver.stderr.on('close', () => resolve(errorCode)) - // }) - // }) - // - // waitsFor('webdriver to start', chromeDriverUp, 15000) + runs(() => { + chromedriver = spawn(ChromedriverPath, [ + '--verbose', + `--port=${ChromedriverPort}`, + `--url-base=${ChromedriverURLBase}` + ]) + + chromedriverLogs = [] + chromedriverExit = new Promise(resolve => { + let errorCode = null + chromedriver.on('exit', (code, signal) => { + if (signal == null) { + errorCode = code + } + }) + chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stderr.on('close', () => resolve(errorCode)) + }) + }) + + waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { const client = await buildAtomClient(args, env) - console.log('finished waiting for client') - const finish = once(async () => { chromedriver.kill() const errorCode = await chromedriverExit @@ -138,9 +132,7 @@ Logs:\n${chromedriverLogs.join('\n')}\ // }) await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) - await $('atom-workspace').waitForExist(10000) - - console.log('about to wait on fn') + await client.$('atom-workspace').waitForExist(10000) await fn(client) finish() @@ -150,6 +142,6 @@ Logs:\n${chromedriverLogs.join('\n')}\ waitsFor('webdriver to stop', chromeDriverDown, 15000) } -function __guard__(value, transform) { - return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined -} +// function __guard__(value, transform) { +// return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined +// } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 0b8526499..63a8528a0 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,15 +32,14 @@ describe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([filePath], {ATOM_HOME: atomHome}, async client => { - console.log('here!') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([]) - await $('atom-text-editor').waitForExist(5000) + await client.$('atom-text-editor').waitForExist(5000) await client.waitForPaneItemCount(1, 1000) - $('atom-text-editor').click() + client.$('atom-text-editor').click() await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) From 76e122274d3101657b99f01d38f330ddeedb1d07 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 09:50:53 -0400 Subject: [PATCH 034/184] =?UTF-8?q?=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index d14d96026..b94fcc05b 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -9,7 +9,7 @@ const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') const AtomPath = remote.process.argv[0] -const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.cmd') +const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.sh') const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') const ChromedriverPort = 9515 const ChromedriverURLBase = '/wd/hub' From 2d4eb542e93a4b5f8a61a4ed8af7c302f820602e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 09:51:25 -0400 Subject: [PATCH 035/184] Focus it --- spec/integration/smoke-spec.js | 2 +- spec/jasmine-test-runner.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 63a8528a0..4b24dbe2b 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -4,7 +4,7 @@ const season = require('season') const temp = require('temp').track() const runAtom = require('./helpers/start-atom') -describe('Smoke Test', () => { +fdescribe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { return diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 5b8662c14..1cb21763f 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -51,7 +51,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 027b433953a6e5234b7236758a3bc75575dc8092 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 10:16:01 -0400 Subject: [PATCH 036/184] Log it all --- spec/integration/helpers/start-atom.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index b94fcc05b..d9c3d72ae 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -103,7 +103,9 @@ module.exports = function(args, env, fn) { errorCode = code } }) - chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stdout.on('data', log => console.log(log.toString())) + chromedriver.stderr.on('data', log => console.log(log.toString())) + // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) chromedriver.stderr.on('close', () => resolve(errorCode)) }) }) From 05233b98578908ae776e31563f37f3ecefd33784 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 11:37:45 -0400 Subject: [PATCH 037/184] Whole lot of debug code --- spec/integration/helpers/start-atom.js | 6 ++++++ spec/integration/smoke-spec.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index d9c3d72ae..55d519345 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -117,6 +117,8 @@ module.exports = function(args, env, fn) { const finish = once(async () => { chromedriver.kill() + + console.log('>>> Waiting for exit code') const errorCode = await chromedriverExit if (errorCode != null) { jasmine.getEnv().currentSpec.fail(`\ @@ -133,9 +135,13 @@ Logs:\n${chromedriverLogs.join('\n')}\ // finish() // }) + console.log('>>> Waiting for window to exist') await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + + console.log('>>> Waiting for workspace to exist') await client.$('atom-workspace').waitForExist(10000) + console.log('>>> Waiting for test to run') await fn(client) finish() } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 4b24dbe2b..430896451 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,15 +32,19 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([]) + console.log('>>> Waiting for editor to exist') await client.$('atom-text-editor').waitForExist(5000) + console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) client.$('atom-text-editor').click() + console.log('Waiting for active element to be atom-text-editor') await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) }, 5000) @@ -48,7 +52,10 @@ fdescribe('Smoke Test', () => { const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') + console.log('Waiting to delete line') await client.dispatchCommand('editor:delete-line') + + console.log('Done!') }) }) }) From cdfd37d4c50c11736739ec4bdd4ea526c36be2e3 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 13:45:17 -0400 Subject: [PATCH 038/184] ??? --- spec/integration/helpers/start-atom.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 55d519345..e9f04bb81 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -39,7 +39,7 @@ const chromeDriverDown = done => { const buildAtomClient = async (args, env) => { userDataDir = temp.mkdirSync('atom-user-data-dir') - console.log('awaiting webdriverio') + console.log('>>> Waiting for webdriverio') let client try { client = await webdriverio.remote({ @@ -64,6 +64,8 @@ const buildAtomClient = async (args, env) => { console.log(error) } + console.log('>>> Building client') + return client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() @@ -113,6 +115,7 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { + console.log('>>> Waiting for Atom client') const client = await buildAtomClient(args, env) const finish = once(async () => { From 1db4324d66cb724ade1e3e9552b3417a1150a474 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 15:02:54 -0400 Subject: [PATCH 039/184] Not sure if addCommand returns anything... --- spec/integration/helpers/start-atom.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index e9f04bb81..8c3baf063 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -64,27 +64,40 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('>>> Building client') + console.log('>>> Adding waitForWindowCount') - return client.addCommand('waitForWindowCount', async function (count, timeout) { + client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() - }).addCommand('waitForPaneItemCount', async function (count, timeout) { + }) + console.log('>>> Adding waitForPaneItemCount') + client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { return atom.workspace.getActivePane().getItems().length } return 0 }), timeout) - }).addCommand('treeViewRootDirectories', async function () { + }) + console.log('>>> Adding treeViewRootDirectories') + client.addCommand('treeViewRootDirectories', async function () { await this.$('.tree-view').waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) ) - }).addCommand('dispatchCommand', async function (command) { + }) + console.log('>>> Adding dispatchCommand') + const test = client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) + + console.log('>>> addCommand returns: ') + console.log(test) + + console.log('>>> Returning client') + + return client } module.exports = function(args, env, fn) { From b9817ace02d894dcd30198a12948d6224c02206a Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 16:42:21 -0400 Subject: [PATCH 040/184] Progress! --- spec/integration/helpers/start-atom.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 8c3baf063..10554979f 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -39,7 +39,6 @@ const chromeDriverDown = done => { const buildAtomClient = async (args, env) => { userDataDir = temp.mkdirSync('atom-user-data-dir') - console.log('>>> Waiting for webdriverio') let client try { client = await webdriverio.remote({ @@ -64,13 +63,10 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('>>> Adding waitForWindowCount') - client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() }) - console.log('>>> Adding waitForPaneItemCount') client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { @@ -79,7 +75,6 @@ const buildAtomClient = async (args, env) => { return 0 }), timeout) }) - console.log('>>> Adding treeViewRootDirectories') client.addCommand('treeViewRootDirectories', async function () { await this.$('.tree-view').waitForExist(10000) return this.execute(() => @@ -87,16 +82,10 @@ const buildAtomClient = async (args, env) => { .map(element => element.dataset.path) ) }) - console.log('>>> Adding dispatchCommand') const test = client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) - console.log('>>> addCommand returns: ') - console.log(test) - - console.log('>>> Returning client') - return client } @@ -128,7 +117,6 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { - console.log('>>> Waiting for Atom client') const client = await buildAtomClient(args, env) const finish = once(async () => { @@ -152,7 +140,11 @@ Logs:\n${chromedriverLogs.join('\n')}\ // }) console.log('>>> Waiting for window to exist') - await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + try { + await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + } catch (error) { + console.log(error) + } console.log('>>> Waiting for workspace to exist') await client.$('atom-workspace').waitForExist(10000) From a2af8ec9ca63d452bdeead4d04d9c8da083d61b5 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 17:00:37 -0400 Subject: [PATCH 041/184] Lint --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 10554979f..f4f669af3 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -82,7 +82,7 @@ const buildAtomClient = async (args, env) => { .map(element => element.dataset.path) ) }) - const test = client.addCommand('dispatchCommand', async function (command) { + client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) From bb74186003418898eff46e52358f39d1d6f6dc99 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 18:08:48 -0400 Subject: [PATCH 042/184] Scoping --- spec/integration/helpers/start-atom.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index f4f669af3..9f9003101 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -141,13 +141,20 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { - await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + await client.waitUntil(function () { + return this.getWindowHandles().length > 0 + }, 10000) } catch (error) { console.log(error) } console.log('>>> Waiting for workspace to exist') - await client.$('atom-workspace').waitForExist(10000) + try { + await client.$('atom-workspace').waitForExist(10000) + } catch (error) { + console.log(error) + jasmine.getEnv().currentSpec.fail(':(') + } console.log('>>> Waiting for test to run') await fn(client) From 8870380a2949b1ec4819fa4290218989bc445256 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 20:26:33 -0400 Subject: [PATCH 043/184] Looks like there are windows being returned... --- spec/integration/helpers/start-atom.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 9f9003101..18eed9dc4 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -142,6 +142,7 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { await client.waitUntil(function () { + console.log('>>> Window handles: ' + this.getWindowHandles().length) return this.getWindowHandles().length > 0 }, 10000) } catch (error) { @@ -150,6 +151,8 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { + console.log('>>> Return value of selector:') + console.log(await client.$('atom-workspace')) await client.$('atom-workspace').waitForExist(10000) } catch (error) { console.log(error) From b58243c93b0eff169609dffc5e455de2b505c660 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 20:26:38 -0400 Subject: [PATCH 044/184] Speed up CI --- script/test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/test b/script/test index adb8a5123..5b38c4b3a 100755 --- a/script/test +++ b/script/test @@ -201,7 +201,8 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': - suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + // suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + suites = [runCoreRenderProcessTests] break case 'win32': suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests] From 8728e9f1e1e10f8cb27f8a1f68316c1c9631fd43 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 21:00:55 -0400 Subject: [PATCH 045/184] Thanks documentation for not giving any hint whatsoever that it's async --- spec/integration/helpers/start-atom.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 18eed9dc4..00a525f2f 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -63,10 +63,6 @@ const buildAtomClient = async (args, env) => { console.log(error) } - client.addCommand('waitForWindowCount', async function (count, timeout) { - await this.waitUntil(() => this.getWindowHandles().length === count, timeout) - return this.getWindowHandles() - }) client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { @@ -141,9 +137,9 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { - await client.waitUntil(function () { - console.log('>>> Window handles: ' + this.getWindowHandles().length) - return this.getWindowHandles().length > 0 + await client.waitUntil(async function () { + const handles = await this.getWindowHandles() + return handles.length > 0 }, 10000) } catch (error) { console.log(error) From 4961b31cf7ce96aebc0c1da67a536c717c74140e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 00:17:40 -0400 Subject: [PATCH 046/184] Perhaps it's something with await? --- spec/integration/helpers/start-atom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 00a525f2f..0caf7f55a 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -147,8 +147,13 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { - console.log('>>> Return value of selector:') - console.log(await client.$('atom-workspace')) + console.log('>>> Return value of selector without await:') + console.log(client.$('atom-workspace')) + console.log(client.$('atom-workspace').waitForExist) + const test = await client.$('atom-workspace') + console.log('>>> Return value of selector with await:') + console.log(test) + console.log(test.waitForExist) await client.$('atom-workspace').waitForExist(10000) } catch (error) { console.log(error) From 81fe767077724f24ed1d17b0443cb0c6ee71d8bf Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 12:49:36 -0400 Subject: [PATCH 047/184] Everything's a Promise, apparently --- spec/integration/helpers/start-atom.js | 14 ++++---------- spec/integration/smoke-spec.js | 5 +++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 0caf7f55a..2700fd4ef 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -72,7 +72,8 @@ const buildAtomClient = async (args, env) => { }), timeout) }) client.addCommand('treeViewRootDirectories', async function () { - await this.$('.tree-view').waitForExist(10000) + const treeViewElement = await this.$('.tree-view') + await treeViewElement.waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) @@ -147,17 +148,10 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { - console.log('>>> Return value of selector without await:') - console.log(client.$('atom-workspace')) - console.log(client.$('atom-workspace').waitForExist) - const test = await client.$('atom-workspace') - console.log('>>> Return value of selector with await:') - console.log(test) - console.log(test.waitForExist) - await client.$('atom-workspace').waitForExist(10000) + const workspaceElement = await client.$('atom-workspace') + await workspaceElement.waitForExist(10000) } catch (error) { console.log(error) - jasmine.getEnv().currentSpec.fail(':(') } console.log('>>> Waiting for test to run') diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 430896451..67ef7faf5 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -37,12 +37,13 @@ fdescribe('Smoke Test', () => { expect(roots).toEqual([]) console.log('>>> Waiting for editor to exist') - await client.$('atom-text-editor').waitForExist(5000) + const textEditorElement = await client.$('atom-text-editor') + await textEditorElement.waitForExist(5000) console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - client.$('atom-text-editor').click() + textEditorElement.click() console.log('Waiting for active element to be atom-text-editor') await client.waitUntil(function () { From e47253febf06b83f9b797264032d45c6ce7b31f8 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 13:31:11 -0400 Subject: [PATCH 048/184] I think we need to pass in a folder --- spec/integration/smoke-spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 67ef7faf5..38515b811 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -31,10 +31,13 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) - runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() - expect(roots).toEqual([]) + expect(roots).toEqual([tempDirPath]) + + console.log('>>> Waiting for editor to open') + await client.execute(async () => await atom.workspace.open(filePath)) console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') From 397c8d74e8d29eda802f45939e06f4739e73708e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 14:24:10 -0400 Subject: [PATCH 049/184] Pass in filePath as an argument --- spec/integration/smoke-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 38515b811..3b5f6f886 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -37,7 +37,7 @@ fdescribe('Smoke Test', () => { expect(roots).toEqual([tempDirPath]) console.log('>>> Waiting for editor to open') - await client.execute(async () => await atom.workspace.open(filePath)) + await client.execute(async filePath => await atom.workspace.open(filePath), filePath) console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') From 8fcd97ae152f27ee20d1206f0d2b0feb8fda45e7 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:30:36 -0400 Subject: [PATCH 050/184] ...as I was saying, async. --- spec/integration/helpers/start-atom.js | 2 +- spec/integration/smoke-spec.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2700fd4ef..2fecc6c63 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -80,7 +80,7 @@ const buildAtomClient = async (args, env) => { ) }) client.addCommand('dispatchCommand', async function (command) { - return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) + return this.execute(async () => await atom.commands.dispatch(document.activeElement, command)) }) return client diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 3b5f6f886..aa6cc79c1 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -48,18 +48,22 @@ fdescribe('Smoke Test', () => { textEditorElement.click() - console.log('Waiting for active element to be atom-text-editor') + console.log('>>> Waiting for active element to be atom-text-editor') await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) }, 5000) - const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) + console.log('>>> Waiting for text to be inserted') + await client.keys('Hello!') + + console.log('>>> Waiting for text') + const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') - console.log('Waiting to delete line') + console.log('>>> Waiting to delete line') await client.dispatchCommand('editor:delete-line') - console.log('Done!') + console.log('>>> Done!') }) }) }) From 7e2a23b7973ed0a6f6973ef0c7fa7727f473ca09 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:42:27 -0400 Subject: [PATCH 051/184] Ah heck, more async --- spec/integration/helpers/start-atom.js | 7 ++++++- spec/integration/smoke-spec.js | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2fecc6c63..2478d1913 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -155,7 +155,12 @@ Logs:\n${chromedriverLogs.join('\n')}\ } console.log('>>> Waiting for test to run') - await fn(client) + try { + await fn(client) + } catch (error) { + console.log('!!!!!!!!!') + console.log(error) + } finish() } , 30000) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index aa6cc79c1..5af7b9cd1 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -46,12 +46,12 @@ fdescribe('Smoke Test', () => { console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - textEditorElement.click() + console.log('>>> Waiting to click text editor') + await textEditorElement.click() - console.log('>>> Waiting for active element to be atom-text-editor') - await client.waitUntil(function () { - return this.execute(() => document.activeElement.closest('atom-text-editor')) - }, 5000) + console.log('>>> Waiting for closest element') + const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) + expect(closestElement).not.toBeNull() console.log('>>> Waiting for text to be inserted') await client.keys('Hello!') From 7bbbca95bc3dce7bda2cab2e59a65be322e4576a Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:44:49 -0400 Subject: [PATCH 052/184] atom.workspace should always exist --- spec/integration/helpers/start-atom.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2478d1913..b0fbd842a 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -64,12 +64,7 @@ const buildAtomClient = async (args, env) => { } client.addCommand('waitForPaneItemCount', async function (count, timeout) { - await this.waitUntil(() => this.execute(() => { - if (atom.workspace) { - return atom.workspace.getActivePane().getItems().length - } - return 0 - }), timeout) + await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) }) client.addCommand('treeViewRootDirectories', async function () { const treeViewElement = await this.$('.tree-view') From 45b772b1114d388e6a00a60214b755e80d4c14d9 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 16:50:37 -0400 Subject: [PATCH 053/184] Whoopsies --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index b0fbd842a..18f825067 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -75,7 +75,7 @@ const buildAtomClient = async (args, env) => { ) }) client.addCommand('dispatchCommand', async function (command) { - return this.execute(async () => await atom.commands.dispatch(document.activeElement, command)) + return this.execute(async (command) => await atom.commands.dispatch(document.activeElement, command), command) }) return client From 50e8c97db4407bcd506cde77bec93bea9c3fa24f Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 16:50:45 -0400 Subject: [PATCH 054/184] Delete the session when we're done, just to be safe --- spec/integration/helpers/start-atom.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 18f825067..3fdf7d5dd 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -112,6 +112,7 @@ module.exports = function(args, env, fn) { const client = await buildAtomClient(args, env) const finish = once(async () => { + await client.deleteSession() chromedriver.kill() console.log('>>> Waiting for exit code') From e9ba8fdc0520ddee39a287d548342d6f54c22292 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:50:27 -0400 Subject: [PATCH 055/184] Yay, it's green! Clean things up a bit. --- spec/integration/helpers/start-atom.js | 100 +++++++++++-------------- spec/integration/smoke-spec.js | 11 --- 2 files changed, 42 insertions(+), 69 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 3fdf7d5dd..6fa6204ce 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,10 +1,8 @@ const path = require('path') const http = require('http') const temp = require('temp').track() -// const os = require('os') const remote = require('remote') -// const async = require('async') -const {map, once} = require('underscore-plus') +const {once} = require('underscore-plus') const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') @@ -15,11 +13,9 @@ const ChromedriverPort = 9515 const ChromedriverURLBase = '/wd/hub' const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` -let userDataDir = null - const chromeDriverUp = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, function(response) { + http.get(ChromedriverStatusURL, response => { if (response.statusCode === 200) { done() } else { @@ -38,30 +34,25 @@ const chromeDriverDown = done => { } const buildAtomClient = async (args, env) => { - userDataDir = temp.mkdirSync('atom-user-data-dir') - let client - try { - client = await webdriverio.remote({ - host: 'localhost', - port: ChromedriverPort, - capabilities: { - browserName: 'atom', - chromeOptions: { - binary: AtomLauncherPath, - args: [ - `atom-path=${AtomPath}`, - `atom-args=${args.join(' ')}`, - `atom-env=${map(env, (value, key) => `${key}=${value}`).join(' ')}`, - 'dev', - 'safe', - `user-data-dir=${userDataDir}` - ] - } + const userDataDir = temp.mkdirSync('atom-user-data-dir') + const client = await webdriverio.remote({ + host: 'localhost', + port: ChromedriverPort, + capabilities: { + browserName: 'atom', + chromeOptions: { + binary: AtomLauncherPath, + args: [ + `atom-path=${AtomPath}`, + `atom-args=${args.join(' ')}`, + `atom-env=${Object.entries(env).map(([key, value]) => `${key}=${value}`).join(' ')}`, + 'dev', + 'safe', + `user-data-dir=${userDataDir}` + ] } - }) - } catch (error) { - console.log(error) - } + } + }) client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) @@ -82,7 +73,7 @@ const buildAtomClient = async (args, env) => { } module.exports = function(args, env, fn) { - let [chromedriver, chromedriverLogs, chromedriverExit] = [] + let chromedriver, chromedriverLogs, chromedriverExit runs(() => { chromedriver = spawn(ChromedriverPath, [ @@ -99,9 +90,7 @@ module.exports = function(args, env, fn) { errorCode = code } }) - chromedriver.stdout.on('data', log => console.log(log.toString())) - chromedriver.stderr.on('data', log => console.log(log.toString())) - // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) chromedriver.stderr.on('close', () => resolve(errorCode)) }) }) @@ -109,61 +98,56 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { - const client = await buildAtomClient(args, env) + let client + try { + await buildAtomClient(args, env) + } catch (error) { + jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) + finish() + return + } const finish = once(async () => { await client.deleteSession() chromedriver.kill() - console.log('>>> Waiting for exit code') const errorCode = await chromedriverExit if (errorCode != null) { - jasmine.getEnv().currentSpec.fail(`\ -Chromedriver exited with code ${errorCode}. -Logs:\n${chromedriverLogs.join('\n')}\ -` - ) + jasmine.getEnv().currentSpec.fail(`Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}`) } done() }) - // client.on('error', err => { - // jasmine.getEnv().currentSpec.fail(new Error(__guard__(__guard__(err.response != null ? err.response.body : undefined, x1 => x1.value), x => x.message))) - // finish() - // }) - - console.log('>>> Waiting for window to exist') try { await client.waitUntil(async function () { const handles = await this.getWindowHandles() return handles.length > 0 }, 10000) } catch (error) { - console.log(error) + jasmine.getEnv().currentSpec.fail(`Unable to locate windows.\n\n${error}`) + finish() + return } - console.log('>>> Waiting for workspace to exist') try { const workspaceElement = await client.$('atom-workspace') await workspaceElement.waitForExist(10000) } catch (error) { - console.log(error) + jasmine.getEnv().currentSpec.fail(`Unable to find workspace element.\n\n${error}`) + finish() + return } - console.log('>>> Waiting for test to run') try { await fn(client) } catch (error) { - console.log('!!!!!!!!!') - console.log(error) + jasmine.getEnv().currentSpec.fail(error) + finish() + return } finish() - } - , 30000) + }, 30000) waitsFor('webdriver to stop', chromeDriverDown, 15000) } - -// function __guard__(value, transform) { -// return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined -// } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 5af7b9cd1..673bd0aa0 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,38 +32,27 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { - console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([tempDirPath]) - console.log('>>> Waiting for editor to open') await client.execute(async filePath => await atom.workspace.open(filePath), filePath) - console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') await textEditorElement.waitForExist(5000) - console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - console.log('>>> Waiting to click text editor') await textEditorElement.click() - console.log('>>> Waiting for closest element') const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) expect(closestElement).not.toBeNull() - console.log('>>> Waiting for text to be inserted') await client.keys('Hello!') - console.log('>>> Waiting for text') const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') - console.log('>>> Waiting to delete line') await client.dispatchCommand('editor:delete-line') - - console.log('>>> Done!') }) }) }) From 7870675ef4a2b24adf65f4fa6b76ab12eb45ef31 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:50:53 -0400 Subject: [PATCH 056/184] Re-enable tests --- script/test | 3 +-- spec/integration/smoke-spec.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/script/test b/script/test index 5b38c4b3a..adb8a5123 100755 --- a/script/test +++ b/script/test @@ -201,8 +201,7 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': - // suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) - suites = [runCoreRenderProcessTests] + suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) break case 'win32': suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests] diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 673bd0aa0..819bc4724 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -4,7 +4,7 @@ const season = require('season') const temp = require('temp').track() const runAtom = require('./helpers/start-atom') -fdescribe('Smoke Test', () => { +describe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { return From fe5082df51e75fff12d87fd0934942e4bf3013f9 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:53:47 -0400 Subject: [PATCH 057/184] Check for focus methods again --- spec/jasmine-test-runner.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 1cb21763f..5b8662c14 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -51,7 +51,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 791d6b4896ac8c6ff675b9a51d680224e057670b Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 21:42:32 -0400 Subject: [PATCH 058/184] :arrow_up: webdriverio@5.9.2 --- script/package-lock.json | 6 +++--- script/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/package-lock.json b/script/package-lock.json index 041660fa2..2d4dabd12 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -11014,9 +11014,9 @@ } }, "webdriverio": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.1.tgz", - "integrity": "sha512-QYlIIrfqr7I0OSkg9HsZyOGpo7d8MlrH7ueo5MHsgNR2QgZG1OxHk/1edV3Te9Q2AUcpCmIKO1IOAJDxlYA+Rw==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.2.tgz", + "integrity": "sha512-ub87P5+h4935jEXXxJ5b22sq5sx25LJC0W5oXmNQfHyYWvca+oS75iJS80jGQ6haDUfyvek1PBMBh7M2+ikeIw==", "requires": { "@wdio/config": "^5.9.1", "@wdio/logger": "^5.9.0", diff --git a/script/package.json b/script/package.json index d72c8d5a5..b6afb73bc 100644 --- a/script/package.json +++ b/script/package.json @@ -46,7 +46,7 @@ "sync-request": "3.0.1", "tello": "1.0.7", "terser": "^3.8.1", - "webdriverio": "^5.9.1", + "webdriverio": "^5.9.2", "yargs": "4.8.1" } } From 5265528675ffb09b1a874b99ee30ba5c28c7b5c2 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 21:55:15 -0400 Subject: [PATCH 059/184] =?UTF-8?q?=F0=9F=A4=A6=E2=80=8D=E2=99=80=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 6fa6204ce..5877fa96c 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -100,7 +100,7 @@ module.exports = function(args, env, fn) { waitsFor('tests to run', async done => { let client try { - await buildAtomClient(args, env) + client = await buildAtomClient(args, env) } catch (error) { jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) finish() From ad39f99a54035a153a799a62a0cc927236481412 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 31 May 2019 15:15:09 +0200 Subject: [PATCH 060/184] Display multi-keystroke key bindings in application menu item's label --- src/main-process/application-menu.js | 26 ++++++++++++-------------- src/menu-manager.coffee | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main-process/application-menu.js b/src/main-process/application-menu.js index 2a46f06f4..220e0f93f 100644 --- a/src/main-process/application-menu.js +++ b/src/main-process/application-menu.js @@ -199,7 +199,18 @@ class ApplicationMenu { template.forEach(item => { if (item.metadata == null) item.metadata = {} if (item.command) { - item.accelerator = this.acceleratorForCommand(item.command, keystrokesByCommand) + const keystrokes = keystrokesByCommand[item.command] + if (keystrokes && keystrokes.length > 0) { + const keystroke = keystrokes[0] + // Electron does not support multi-keystroke accelerators. Therefore, + // when the command maps to a multi-stroke key binding, show the + // keystrokes next to the item's label. + if (keystroke.includes(' ')) { + item.label += ` [${_.humanizeKeystroke(keystroke)}]` + } else { + item.accelerator = MenuHelpers.acceleratorForKeystroke(keystroke) + } + } item.click = () => global.atomApplication.sendCommand(item.command, item.commandDetail) if (!/^application:/.test(item.command)) { item.metadata.windowSpecific = true @@ -209,17 +220,4 @@ class ApplicationMenu { }) return template } - - // Determine the accelerator for a given command. - // - // command - The name of the command. - // keystrokesByCommand - An Object where the keys are commands and the values - // are Arrays containing the keystroke. - // - // Returns a String containing the keystroke in a format that can be interpreted - // by Electron to provide nice icons where available. - acceleratorForCommand (command, keystrokesByCommand) { - const firstKeystroke = keystrokesByCommand[command] && keystrokesByCommand[command][0] - return MenuHelpers.acceleratorForKeystroke(firstKeystroke) - } } diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index a3d35a1de..e87d4827e 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -161,7 +161,6 @@ class MenuManager for binding in @keymapManager.getKeyBindings() continue unless @includeSelector(binding.selector) continue if unsetKeystrokes.has(binding.keystrokes) - continue if binding.keystrokes.includes(' ') continue if process.platform is 'darwin' and /^alt-(shift-)?.$/.test(binding.keystrokes) continue if process.platform is 'win32' and /^ctrl-alt-(shift-)?.$/.test(binding.keystrokes) keystrokesByCommand[binding.command] ?= [] From f4a7c758984ed02a8cd21a15f0c19939f6d815c3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 31 May 2019 15:15:23 +0200 Subject: [PATCH 061/184] Display multi-keystroke key bindings in context menu item's label --- src/context-menu-manager.coffee | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 9cff5497b..4f3af45d6 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -6,6 +6,7 @@ fs = require 'fs-plus' {remote} = require 'electron' MenuHelpers = require './menu-helpers' {sortMenuItems} = require './menu-sort-helpers' +_ = require 'underscore-plus' platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] @@ -158,8 +159,16 @@ class ContextMenuManager for id, item of template if item.command keymaps = @keymapManager.findKeyBindings({command: item.command, target: document.activeElement}) - accelerator = MenuHelpers.acceleratorForKeystroke(keymaps?[0]?.keystrokes) - item.accelerator = accelerator if accelerator + keystrokes = keymaps?[0]?.keystrokes + if keystrokes + # Electron does not support multi-keystroke accelerators. Therefore, + # when the command maps to a multi-stroke key binding, show the + # keystrokes next to the item's label. + if keystrokes.includes(' ') + item.label += " [#{_.humanizeKeystroke(keystrokes)}]" + else + accelerator = MenuHelpers.acceleratorForKeystroke(keystrokes) + item.accelerator = accelerator if Array.isArray(item.submenu) @addAccelerators(item.submenu) From b04695ee69ddb8648ef59f5ccef12217fd2defc5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 31 May 2019 15:50:43 +0200 Subject: [PATCH 062/184] Verify context menu item label's text for multi-keystroke key bindings --- spec/context-menu-manager-spec.coffee | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/context-menu-manager-spec.coffee b/spec/context-menu-manager-spec.coffee index 70ab4b3e7..7c977e352 100644 --- a/spec/context-menu-manager-spec.coffee +++ b/spec/context-menu-manager-spec.coffee @@ -334,6 +334,30 @@ describe "ContextMenuManager", -> ] ]) + it "does not add accelerators for multi-keystroke key bindings", -> + atom.keymaps.add('source', { + '.child': { + 'ctrl-a ctrl-b': 'test:multi-keystroke-command' + } + }) + contextMenu.clear() + contextMenu.add('.parent': [{ + label: 'Multi-keystroke command', + command: 'test:multi-keystroke-command', + }]) + + child.focus() + + label = + if process.platform is 'darwin' + '⌃A ⌃B' + else + 'Ctrl+A Ctrl+B' + expect(contextMenu.templateForEvent({target: child})).toEqual([{ + label: "Multi-keystroke command [#{label}]", + command: 'test:multi-keystroke-command', + }]) + describe "::templateForEvent(target) (sorting)", -> it "applies simple sorting rules", -> contextMenu.add('.parent': [{ From 6a42fdeaff68bba42c196e6520d293fc26b12583 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 31 May 2019 18:47:43 +0200 Subject: [PATCH 063/184] Re-apply prettier JS formatter --- src/main-process/application-menu.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main-process/application-menu.js b/src/main-process/application-menu.js index 51438c9e3..e2faa5e76 100644 --- a/src/main-process/application-menu.js +++ b/src/main-process/application-menu.js @@ -222,19 +222,20 @@ module.exports = class ApplicationMenu { template.forEach(item => { if (item.metadata == null) item.metadata = {}; if (item.command) { - const keystrokes = keystrokesByCommand[item.command] + const keystrokes = keystrokesByCommand[item.command]; if (keystrokes && keystrokes.length > 0) { - const keystroke = keystrokes[0] + const keystroke = keystrokes[0]; // Electron does not support multi-keystroke accelerators. Therefore, // when the command maps to a multi-stroke key binding, show the // keystrokes next to the item's label. if (keystroke.includes(' ')) { - item.label += ` [${_.humanizeKeystroke(keystroke)}]` + item.label += ` [${_.humanizeKeystroke(keystroke)}]`; } else { - item.accelerator = MenuHelpers.acceleratorForKeystroke(keystroke) + item.accelerator = MenuHelpers.acceleratorForKeystroke(keystroke); } } - item.click = () => global.atomApplication.sendCommand(item.command, item.commandDetail) + item.click = () => + global.atomApplication.sendCommand(item.command, item.commandDetail); if (!/^application:/.test(item.command)) { item.metadata.windowSpecific = true; } @@ -244,4 +245,4 @@ module.exports = class ApplicationMenu { }); return template; } -} +}; From 6263d852501d67ee8a5785b21448e89ff5e08fbd Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 31 May 2019 18:55:45 +0200 Subject: [PATCH 064/184] Re-apply prettier JS formatter --- spec/integration/helpers/start-atom.js | 244 +++++++++++++++---------- spec/integration/smoke-spec.js | 66 +++---- 2 files changed, 178 insertions(+), 132 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 5877fa96c..09dce64b2 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,40 +1,59 @@ -const path = require('path') -const http = require('http') -const temp = require('temp').track() -const remote = require('remote') -const {once} = require('underscore-plus') -const {spawn} = require('child_process') -const webdriverio = require('../../../script/node_modules/webdriverio') +const path = require('path'); +const http = require('http'); +const temp = require('temp').track(); +const remote = require('remote'); +const { once } = require('underscore-plus'); +const { spawn } = require('child_process'); +const webdriverio = require('../../../script/node_modules/webdriverio'); -const AtomPath = remote.process.argv[0] -const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.sh') -const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') -const ChromedriverPort = 9515 -const ChromedriverURLBase = '/wd/hub' -const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` +const AtomPath = remote.process.argv[0]; +const AtomLauncherPath = path.join( + __dirname, + '..', + 'helpers', + 'atom-launcher.sh' +); +const ChromedriverPath = path.resolve( + __dirname, + '..', + '..', + '..', + 'script', + 'node_modules', + 'electron-chromedriver', + 'bin', + 'chromedriver' +); +const ChromedriverPort = 9515; +const ChromedriverURLBase = '/wd/hub'; +const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status`; const chromeDriverUp = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, response => { - if (response.statusCode === 200) { - done() - } else { - chromeDriverUp(done) - } - }).on('error', () => chromeDriverUp(done)) + http + .get(ChromedriverStatusURL, response => { + if (response.statusCode === 200) { + done(); + } else { + chromeDriverUp(done); + } + }) + .on('error', () => chromeDriverUp(done)); - setTimeout(checkStatus, 100) -} + setTimeout(checkStatus, 100); +}; const chromeDriverDown = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, response => chromeDriverDown(done)).on('error', done) + http + .get(ChromedriverStatusURL, response => chromeDriverDown(done)) + .on('error', done); - setTimeout(checkStatus, 100) -} + setTimeout(checkStatus, 100); +}; const buildAtomClient = async (args, env) => { - const userDataDir = temp.mkdirSync('atom-user-data-dir') + const userDataDir = temp.mkdirSync('atom-user-data-dir'); const client = await webdriverio.remote({ host: 'localhost', port: ChromedriverPort, @@ -45,109 +64,132 @@ const buildAtomClient = async (args, env) => { args: [ `atom-path=${AtomPath}`, `atom-args=${args.join(' ')}`, - `atom-env=${Object.entries(env).map(([key, value]) => `${key}=${value}`).join(' ')}`, + `atom-env=${Object.entries(env) + .map(([key, value]) => `${key}=${value}`) + .join(' ')}`, 'dev', 'safe', `user-data-dir=${userDataDir}` ] } } - }) + }); - client.addCommand('waitForPaneItemCount', async function (count, timeout) { - await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) - }) - client.addCommand('treeViewRootDirectories', async function () { - const treeViewElement = await this.$('.tree-view') - await treeViewElement.waitForExist(10000) + client.addCommand('waitForPaneItemCount', async function(count, timeout) { + await this.waitUntil( + () => + this.execute(() => atom.workspace.getActivePane().getItems().length), + timeout + ); + }); + client.addCommand('treeViewRootDirectories', async function() { + const treeViewElement = await this.$('.tree-view'); + await treeViewElement.waitForExist(10000); return this.execute(() => - Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) - .map(element => element.dataset.path) - ) - }) - client.addCommand('dispatchCommand', async function (command) { - return this.execute(async (command) => await atom.commands.dispatch(document.activeElement, command), command) - }) + Array.from( + document.querySelectorAll('.tree-view .project-root > .header .name') + ).map(element => element.dataset.path) + ); + }); + client.addCommand('dispatchCommand', async function(command) { + return this.execute( + command => atom.commands.dispatch(document.activeElement, command), + command + ); + }); - return client -} + return client; +}; module.exports = function(args, env, fn) { - let chromedriver, chromedriverLogs, chromedriverExit + let chromedriver, chromedriverLogs, chromedriverExit; runs(() => { chromedriver = spawn(ChromedriverPath, [ '--verbose', `--port=${ChromedriverPort}`, `--url-base=${ChromedriverURLBase}` - ]) + ]); - chromedriverLogs = [] + chromedriverLogs = []; chromedriverExit = new Promise(resolve => { - let errorCode = null + let errorCode = null; chromedriver.on('exit', (code, signal) => { if (signal == null) { - errorCode = code + errorCode = code; } - }) - chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) - chromedriver.stderr.on('close', () => resolve(errorCode)) - }) - }) + }); + chromedriver.stderr.on('data', log => + chromedriverLogs.push(log.toString()) + ); + chromedriver.stderr.on('close', () => resolve(errorCode)); + }); + }); - waitsFor('webdriver to start', chromeDriverUp, 15000) + waitsFor('webdriver to start', chromeDriverUp, 15000); - waitsFor('tests to run', async done => { - let client - try { - client = await buildAtomClient(args, env) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) - finish() - return - } + waitsFor( + 'tests to run', + async done => { + const finish = once(async () => { + await client.deleteSession(); + chromedriver.kill(); - const finish = once(async () => { - await client.deleteSession() - chromedriver.kill() + const errorCode = await chromedriverExit; + if (errorCode != null) { + jasmine.getEnv().currentSpec + .fail(`Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}`); + } + done(); + }); - const errorCode = await chromedriverExit - if (errorCode != null) { - jasmine.getEnv().currentSpec.fail(`Chromedriver exited with code ${errorCode}. -Logs:\n${chromedriverLogs.join('\n')}`) + let client; + try { + client = await buildAtomClient(args, env); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to build Atom client.\n${error}`); + finish(); + return; } - done() - }) - try { - await client.waitUntil(async function () { - const handles = await this.getWindowHandles() - return handles.length > 0 - }, 10000) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to locate windows.\n\n${error}`) - finish() - return - } + try { + await client.waitUntil(async function() { + const handles = await this.getWindowHandles(); + return handles.length > 0; + }, 10000); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to locate windows.\n\n${error}`); + finish(); + return; + } - try { - const workspaceElement = await client.$('atom-workspace') - await workspaceElement.waitForExist(10000) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to find workspace element.\n\n${error}`) - finish() - return - } + try { + const workspaceElement = await client.$('atom-workspace'); + await workspaceElement.waitForExist(10000); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to find workspace element.\n\n${error}`); + finish(); + return; + } - try { - await fn(client) - } catch (error) { - jasmine.getEnv().currentSpec.fail(error) - finish() - return - } - finish() - }, 30000) + try { + await fn(client); + } catch (error) { + jasmine.getEnv().currentSpec.fail(error); + finish(); + return; + } + finish(); + }, + 30000 + ); - waitsFor('webdriver to stop', chromeDriverDown, 15000) -} + waitsFor('webdriver to stop', chromeDriverDown, 15000); +}; diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 819bc4724..6e2de3edb 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -1,58 +1,62 @@ -const fs = require('fs-plus') -const path = require('path') -const season = require('season') -const temp = require('temp').track() -const runAtom = require('./helpers/start-atom') +const fs = require('fs-plus'); +const path = require('path'); +const season = require('season'); +const temp = require('temp').track(); +const runAtom = require('./helpers/start-atom'); describe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { - return + return; } - const atomHome = temp.mkdirSync('atom-home') + const atomHome = temp.mkdirSync('atom-home'); beforeEach(() => { - jasmine.useRealClock() + jasmine.useRealClock(); season.writeFileSync(path.join(atomHome, 'config.cson'), { '*': { - welcome: {showOnStartup: false}, + welcome: { showOnStartup: false }, core: { telemetryConsent: 'no', disabledPackages: ['github'] } } - }) - }) + }); + }); it('can open a file in Atom and perform basic operations on it', async () => { - const tempDirPath = temp.mkdirSync('empty-dir') - const filePath = path.join(tempDirPath, 'new-file') + const tempDirPath = temp.mkdirSync('empty-dir'); + const filePath = path.join(tempDirPath, 'new-file'); - fs.writeFileSync(filePath, '', {encoding: 'utf8'}) + fs.writeFileSync(filePath, '', { encoding: 'utf8' }); - runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { - const roots = await client.treeViewRootDirectories() - expect(roots).toEqual([tempDirPath]) + runAtom([tempDirPath], { ATOM_HOME: atomHome }, async client => { + const roots = await client.treeViewRootDirectories(); + expect(roots).toEqual([tempDirPath]); - await client.execute(async filePath => await atom.workspace.open(filePath), filePath) + await client.execute(filePath => atom.workspace.open(filePath), filePath); - const textEditorElement = await client.$('atom-text-editor') - await textEditorElement.waitForExist(5000) + const textEditorElement = await client.$('atom-text-editor'); + await textEditorElement.waitForExist(5000); - await client.waitForPaneItemCount(1, 1000) + await client.waitForPaneItemCount(1, 1000); - await textEditorElement.click() + await textEditorElement.click(); - const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) - expect(closestElement).not.toBeNull() + const closestElement = await client.execute(() => + document.activeElement.closest('atom-text-editor') + ); + expect(closestElement).not.toBeNull(); - await client.keys('Hello!') + await client.keys('Hello!'); - const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) - expect(text).toBe('Hello!') + const text = await client.execute(() => + atom.workspace.getActiveTextEditor().getText() + ); + expect(text).toBe('Hello!'); - await client.dispatchCommand('editor:delete-line') - }) - }) -}) + await client.dispatchCommand('editor:delete-line'); + }); + }); +}); From 66f7f1746a641ca876d9b27a55d54e87b61dc82b Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 31 May 2019 20:26:19 +0200 Subject: [PATCH 065/184] Reformat all JS files using prettier --- .../grammar-selector/lib/grammar-list-view.js | 107 +++++++------ .../spec/grammar-selector-spec.js | 151 ++++++++++-------- spec/grammar-registry-spec.js | 58 +++---- src/grammar-registry.js | 36 +++-- 4 files changed, 193 insertions(+), 159 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 17f3c46d0..47018d7bd 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -16,23 +16,30 @@ module.exports = class GrammarListView { element.textContent = grammarName; element.dataset.grammar = grammarName; - const div = document.createElement('div') - div.classList.add('pull-right') + const div = document.createElement('div'); + div.classList.add('pull-right'); if (isTreeSitter(grammar)) { - const parser = document.createElement('span') - parser.classList.add('grammar-selector-parser', 'badge', 'badge-success') - parser.textContent = 'Tree-sitter' - parser.setAttribute('title', '(Recommended) A faster parser with improved syntax highlighting & code navigation support.') - div.appendChild(parser) + const parser = document.createElement('span'); + parser.classList.add( + 'grammar-selector-parser', + 'badge', + 'badge-success' + ); + parser.textContent = 'Tree-sitter'; + parser.setAttribute( + 'title', + '(Recommended) A faster parser with improved syntax highlighting & code navigation support.' + ); + div.appendChild(parser); } if (grammar.scopeName) { - const scopeName = document.createElement('scopeName') - scopeName.classList.add('badge', 'badge-info') - scopeName.textContent = grammar.scopeName - div.appendChild(scopeName) - element.appendChild(div) + const scopeName = document.createElement('scopeName'); + scopeName.classList.add('badge', 'badge-info'); + scopeName.textContent = grammar.scopeName; + div.appendChild(scopeName); + element.appendChild(div); } return element; @@ -42,7 +49,7 @@ module.exports = class GrammarListView { if (grammar === this.autoDetect) { atom.textEditors.clearGrammarOverride(this.editor); } else { - atom.grammars.assignGrammar(this.editor, grammar) + atom.grammars.assignGrammar(this.editor, grammar); } }, didCancelSelection: () => { @@ -80,65 +87,73 @@ module.exports = class GrammarListView { async toggle() { if (this.panel != null) { - this.cancel() - return + this.cancel(); + return; } - const editor = atom.workspace.getActiveTextEditor() + const editor = atom.workspace.getActiveTextEditor(); if (editor) { - this.editor = editor - this.currentGrammar = this.editor.getGrammar() + this.editor = editor; + this.currentGrammar = this.editor.getGrammar(); if (this.currentGrammar === atom.grammars.nullGrammar) { this.currentGrammar = this.autoDetect; } - let grammars = atom.grammars.getGrammars({includeTreeSitter: true}).filter(grammar => { - return grammar !== atom.grammars.nullGrammar && grammar.name - }) + let grammars = atom.grammars + .getGrammars({ includeTreeSitter: true }) + .filter(grammar => { + return grammar !== atom.grammars.nullGrammar && grammar.name; + }); if (atom.config.get('grammar-selector.hideDuplicateTextMateGrammars')) { - const oldGrammars = grammars - grammars = [] - const blacklist = new Set() + const oldGrammars = grammars; + grammars = []; + const blacklist = new Set(); for (const grammar of oldGrammars) { if (isTreeSitter(grammar)) { - blacklist.add(grammar.name) - grammars.push(grammar) + blacklist.add(grammar.name); + grammars.push(grammar); } } - atom.grammars.getGrammars({includeTreeSitter: false}).forEach(grammar => { - if (grammar !== atom.grammars.nullGrammar && grammar.name && !blacklist.has(grammar.name)) { - grammars.push(grammar) - } - }) + atom.grammars + .getGrammars({ includeTreeSitter: false }) + .forEach(grammar => { + if ( + grammar !== atom.grammars.nullGrammar && + grammar.name && + !blacklist.has(grammar.name) + ) { + grammars.push(grammar); + } + }); } grammars.sort((a, b) => { if (a.scopeName === 'text.plain') { return -1; } else if (b.scopeName === 'text.plain') { - return 1 + return 1; } else if (a.name === b.name) { - return compareGrammarType(a, b) + return compareGrammarType(a, b); } - return a.name.localeCompare(b.name) - }) - grammars.unshift(this.autoDetect) - await this.selectListView.update({ items: grammars }) - this.attach() + return a.name.localeCompare(b.name); + }); + grammars.unshift(this.autoDetect); + await this.selectListView.update({ items: grammars }); + this.attach(); } } +}; + +function isTreeSitter(grammar) { + return grammar.constructor.name === 'TreeSitterGrammar'; } -function isTreeSitter (grammar) { - return grammar.constructor.name === 'TreeSitterGrammar' -} - -function compareGrammarType (a, b) { +function compareGrammarType(a, b) { if (isTreeSitter(a)) { - return -1 + return -1; } else if (isTreeSitter(b)) { - return 1 + return 1; } - return 0 + return 0; } diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index dcbe21ade..730fd620f 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -5,9 +5,9 @@ describe('GrammarSelector', () => { let [editor, textGrammar, jsGrammar] = []; beforeEach(async () => { - jasmine.attachToDOM(atom.views.getView(atom.workspace)) - atom.config.set('grammar-selector.showOnRightSideOfStatusBar', false) - atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false) + jasmine.attachToDOM(atom.views.getView(atom.workspace)); + atom.config.set('grammar-selector.showOnRightSideOfStatusBar', false); + atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false); await atom.packages.activatePackage('status-bar'); await atom.packages.activatePackage('grammar-selector'); @@ -28,55 +28,61 @@ describe('GrammarSelector', () => { describe('when grammar-selector:show is triggered', () => it('displays a list of all the available grammars', async () => { - const grammarView = (await getGrammarView(editor)).element + const grammarView = (await getGrammarView(editor)).element; // -1 for removing nullGrammar, +1 for adding "Auto Detect" // Tree-sitter names the regex and JSDoc grammars - expect(grammarView.querySelectorAll('li').length).toBe(atom.grammars.grammars.filter(g => g.name).length) - expect(grammarView.querySelectorAll('li')[0].textContent).toBe('Auto Detect') - expect(grammarView.textContent.includes('source.a')).toBe(false) - grammarView.querySelectorAll('li').forEach( - li => expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name) - ) - expect(grammarView.textContent.includes('Tree-sitter')).toBe(true) // check we are showing and labelling Tree-sitter grammars - }) - ) + expect(grammarView.querySelectorAll('li').length).toBe( + atom.grammars.grammars.filter(g => g.name).length + ); + expect(grammarView.querySelectorAll('li')[0].textContent).toBe( + 'Auto Detect' + ); + expect(grammarView.textContent.includes('source.a')).toBe(false); + grammarView + .querySelectorAll('li') + .forEach(li => + expect(li.textContent).not.toBe(atom.grammars.nullGrammar.name) + ); + expect(grammarView.textContent.includes('Tree-sitter')).toBe(true); // check we are showing and labelling Tree-sitter grammars + })); describe('when a grammar is selected', () => it('sets the new grammar on the editor', async () => { - const grammarView = await getGrammarView(editor) - grammarView.props.didConfirmSelection(textGrammar) - expect(editor.getGrammar()).toBe(textGrammar) - })) + const grammarView = await getGrammarView(editor); + grammarView.props.didConfirmSelection(textGrammar); + expect(editor.getGrammar()).toBe(textGrammar); + })); describe('when auto-detect is selected', () => it('restores the auto-detected grammar on the editor', async () => { - let grammarView = await getGrammarView(editor) - grammarView.props.didConfirmSelection(textGrammar) - expect(editor.getGrammar()).toBe(textGrammar) + let grammarView = await getGrammarView(editor); + grammarView.props.didConfirmSelection(textGrammar); + expect(editor.getGrammar()).toBe(textGrammar); - grammarView = await getGrammarView(editor) - grammarView.props.didConfirmSelection(grammarView.items[0]) - expect(editor.getGrammar()).toBe(jsGrammar) - })) + grammarView = await getGrammarView(editor); + grammarView.props.didConfirmSelection(grammarView.items[0]); + expect(editor.getGrammar()).toBe(jsGrammar); + })); describe("when the editor's current grammar is the null grammar", () => it('displays Auto Detect as the selected grammar', async () => { - editor.setGrammar(atom.grammars.nullGrammar) - const grammarView = (await getGrammarView(editor)).element - expect(grammarView.querySelector('li.active').textContent).toBe('Auto Detect') - }) - ) + editor.setGrammar(atom.grammars.nullGrammar); + const grammarView = (await getGrammarView(editor)).element; + expect(grammarView.querySelector('li.active').textContent).toBe( + 'Auto Detect' + ); + })); describe('when editor is untitled', () => it('sets the new grammar on the editor', async () => { editor = await atom.workspace.open(); expect(editor.getGrammar()).not.toBe(jsGrammar); - const grammarView = await getGrammarView(editor) - grammarView.props.didConfirmSelection(jsGrammar) - expect(editor.getGrammar()).toBe(jsGrammar) - })) + const grammarView = await getGrammarView(editor); + grammarView.props.didConfirmSelection(jsGrammar); + expect(editor.getGrammar()).toBe(jsGrammar); + })); describe('Status bar grammar label', () => { let [grammarStatus, grammarTile, statusBar] = []; @@ -175,62 +181,69 @@ describe('GrammarSelector', () => { describe('when toggling hideDuplicateTextMateGrammars', () => { it('shows only the Tree-sitter if true and both exist', async () => { // the main JS grammar has both a TextMate and Tree-sitter implementation - atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', true) - const grammarView = await getGrammarView(editor) - const observedNames = new Set() + atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', true); + const grammarView = await getGrammarView(editor); + const observedNames = new Set(); grammarView.element.querySelectorAll('li').forEach(li => { - const name = li.getAttribute('data-grammar') - expect(observedNames.has(name)).toBe(false) - observedNames.add(name) - }) + const name = li.getAttribute('data-grammar'); + expect(observedNames.has(name)).toBe(false); + observedNames.add(name); + }); // check the seen JS is actually the Tree-sitter one - const list = atom.workspace.getModalPanels()[0].item + const list = atom.workspace.getModalPanels()[0].item; for (const item of list.items) { if (item.name === 'JavaScript') { - expect(item.constructor.name === 'TreeSitterGrammar') + expect(item.constructor.name === 'TreeSitterGrammar'); } } - }) + }); it('shows both if false', async () => { - await atom.packages.activatePackage('language-c') // punctuation making it sort wrong - atom.config.set('grammar-selector.hideDuplicateTextMateGrammars', false) - await getGrammarView(editor) - let cppCount = 0 + await atom.packages.activatePackage('language-c'); // punctuation making it sort wrong + atom.config.set( + 'grammar-selector.hideDuplicateTextMateGrammars', + false + ); + await getGrammarView(editor); + let cppCount = 0; - const listItems = atom.workspace.getModalPanels()[0].item.items + const listItems = atom.workspace.getModalPanels()[0].item.items; for (let i = 0; i < listItems.length; i++) { - const grammar = listItems[i] - const name = grammar.name + const grammar = listItems[i]; + const name = grammar.name; if (cppCount === 0 && name === 'C++') { - expect(grammar.constructor.name).toBe('TreeSitterGrammar') // first C++ entry should be Tree-sitter - cppCount++ + expect(grammar.constructor.name).toBe('TreeSitterGrammar'); // first C++ entry should be Tree-sitter + cppCount++; } else if (cppCount === 1) { - expect(name).toBe('C++') - expect(grammar.constructor.name).toBe('Grammar') // immediate next grammar should be the TextMate version - cppCount++ + expect(name).toBe('C++'); + expect(grammar.constructor.name).toBe('Grammar'); // immediate next grammar should be the TextMate version + cppCount++; } else { - expect(name).not.toBe('C++') // there should not be any other C++ grammars + expect(name).not.toBe('C++'); // there should not be any other C++ grammars } } - expect(cppCount).toBe(2) // ensure we actually saw both grammars - }) - }) + expect(cppCount).toBe(2); // ensure we actually saw both grammars + }); + }); describe('for every Tree-sitter grammar', () => { it('adds a label to identify it as Tree-sitter', async () => { - const grammarView = await getGrammarView(editor) - const elements = grammarView.element.querySelectorAll('li') - const listItems = atom.workspace.getModalPanels()[0].item.items + const grammarView = await getGrammarView(editor); + const elements = grammarView.element.querySelectorAll('li'); + const listItems = atom.workspace.getModalPanels()[0].item.items; for (let i = 0; i < listItems.length; i++) { if (listItems[i].constructor.name === 'TreeSitterGrammar') { - expect(elements[i].childNodes[1].childNodes[0].className.startsWith('grammar-selector-parser')).toBe(true) + expect( + elements[i].childNodes[1].childNodes[0].className.startsWith( + 'grammar-selector-parser' + ) + ).toBe(true); } } - }) - }) + }); + }); describe('when clicked', () => it('shows the grammar selector modal', () => { @@ -258,8 +271,8 @@ function getTooltipText(element) { return tooltip.getTitle(); } -async function getGrammarView (editor) { - atom.commands.dispatch(editor.getElement(), 'grammar-selector:show') - await SelectListView.getScheduler().getNextUpdatePromise() - return atom.workspace.getModalPanels()[0].getItem() +async function getGrammarView(editor) { + atom.commands.dispatch(editor.getElement(), 'grammar-selector:show'); + await SelectListView.getScheduler().getNextUpdatePromise(); + return atom.workspace.getModalPanels()[0].getItem(); } diff --git a/spec/grammar-registry-spec.js b/spec/grammar-registry-spec.js index a2bd47794..8eddd06ac 100644 --- a/spec/grammar-registry-spec.js +++ b/spec/grammar-registry-spec.js @@ -72,17 +72,19 @@ describe('GrammarRegistry', () => { describe('.assignGrammar(buffer, grammar)', () => { it('allows a TextMate grammar to be assigned directly, even when Tree-sitter is permitted', () => { grammarRegistry.loadGrammarSync( - require.resolve('language-javascript/grammars/tree-sitter-javascript.cson') - ) + require.resolve( + 'language-javascript/grammars/tree-sitter-javascript.cson' + ) + ); const tmGrammar = grammarRegistry.loadGrammarSync( require.resolve('language-javascript/grammars/javascript.cson') - ) + ); - const buffer = new TextBuffer() - expect(grammarRegistry.assignGrammar(buffer, tmGrammar)).toBe(true) - expect(buffer.getLanguageMode().getGrammar()).toBe(tmGrammar) - }) - }) + const buffer = new TextBuffer(); + expect(grammarRegistry.assignGrammar(buffer, tmGrammar)).toBe(true); + expect(buffer.getLanguageMode().getGrammar()).toBe(tmGrammar); + }); + }); describe('.grammarForId(languageId)', () => { it('returns a text-mate grammar when `core.useTreeSitterParsers` is false', () => { @@ -869,34 +871,34 @@ describe('GrammarRegistry', () => { grammarRegistryCopy.loadGrammarSync( require.resolve('language-javascript/grammars/javascript.cson') - ) - expect(buffer1Copy.getLanguageMode().getLanguageId()).toBe('source.c') - expect(buffer2Copy.getLanguageMode().getLanguageId()).toBe('source.js') - }) - }) + ); + expect(buffer1Copy.getLanguageMode().getLanguageId()).toBe('source.c'); + expect(buffer2Copy.getLanguageMode().getLanguageId()).toBe('source.js'); + }); + }); describe('when working with grammars', () => { beforeEach(async () => { - await atom.packages.activatePackage('language-javascript') - }) + await atom.packages.activatePackage('language-javascript'); + }); it('returns both Tree-sitter and TextMate grammars by default', async () => { - const allGrammars = atom.grammars.getGrammars() - const tmGrammars = atom.grammars.getGrammars({textMateOnly: true}) - expect(allGrammars.length).toBeGreaterThan(tmGrammars.length) - }) + const allGrammars = atom.grammars.getGrammars(); + const tmGrammars = atom.grammars.getGrammars({ textMateOnly: true }); + expect(allGrammars.length).toBeGreaterThan(tmGrammars.length); + }); it('executes the foreach callback on both Tree-sitter and TextMate grammars', async () => { - const numAllGrammars = atom.grammars.getGrammars().length - let i = 0 - atom.grammars.forEachGrammar(() => i++) - expect(i).toBe(numAllGrammars) - }) - }) -}) + const numAllGrammars = atom.grammars.getGrammars().length; + let i = 0; + atom.grammars.forEachGrammar(() => i++); + expect(i).toBe(numAllGrammars); + }); + }); +}); -function retainedBufferCount (grammarRegistry) { - return grammarRegistry.grammarScoresByBuffer.size +function retainedBufferCount(grammarRegistry) { + return grammarRegistry.grammarScoresByBuffer.size; } function subscriptionCount(grammarRegistry) { diff --git a/src/grammar-registry.js b/src/grammar-registry.js index d1ca3df47..3542cc89c 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -155,15 +155,17 @@ module.exports = class GrammarRegistry { // * `grammar` The desired {Grammar}. // // Returns a {Boolean} that indicates whether the assignment was sucessful - assignGrammar (buffer, grammar) { - if (!grammar) return false - if (buffer.getBuffer) buffer = buffer.getBuffer() - this.languageOverridesByBufferId.set(buffer.id, grammar.scopeName || null) - this.grammarScoresByBuffer.set(buffer, null) + assignGrammar(buffer, grammar) { + if (!grammar) return false; + if (buffer.getBuffer) buffer = buffer.getBuffer(); + this.languageOverridesByBufferId.set(buffer.id, grammar.scopeName || null); + this.grammarScoresByBuffer.set(buffer, null); if (grammar !== buffer.getLanguageMode().grammar) { - buffer.setLanguageMode(this.languageModeForGrammarAndBuffer(grammar, buffer)) + buffer.setLanguageMode( + this.languageModeForGrammarAndBuffer(grammar, buffer) + ); } - return true + return true; } // Extended: Get the `languageId` that has been explicitly assigned to @@ -347,8 +349,8 @@ module.exports = class GrammarRegistry { } } - forEachGrammar (callback) { - this.grammars.forEach(callback) + forEachGrammar(callback) { + this.grammars.forEach(callback); } grammarForId(languageId) { @@ -495,8 +497,8 @@ module.exports = class GrammarRegistry { return this.textmateRegistry.nullGrammar; } - get grammars () { - return this.getGrammars() + get grammars() { + return this.getGrammars(); } decodeTokens() { @@ -620,12 +622,14 @@ module.exports = class GrammarRegistry { // [Tree-sitter](https://github.blog/2018-10-31-atoms-new-parsing-system/) grammars // // Returns a non-empty {Array} of {Grammar} instances. - getGrammars (params) { - let tmGrammars = this.textmateRegistry.getGrammars() - if (params && params.textMateOnly) return tmGrammars + getGrammars(params) { + let tmGrammars = this.textmateRegistry.getGrammars(); + if (params && params.textMateOnly) return tmGrammars; - const tsGrammars = Object.values(this.treeSitterGrammarsById).filter(g => g.scopeName) - return tmGrammars.concat(tsGrammars) // NullGrammar is expected to be first + const tsGrammars = Object.values(this.treeSitterGrammarsById).filter( + g => g.scopeName + ); + return tmGrammars.concat(tsGrammars); // NullGrammar is expected to be first } scopeForId(id) { From ed6d06b16e2ea35fc66ed2415e81e8a9572aaf62 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Sat, 1 Jun 2019 00:19:59 +0200 Subject: [PATCH 066/184] Re-apply prettier JS formatter --- spec/package-manager-spec.js | 224 ++++++++++++++++++++--------------- src/package.js | 112 ++++++++++-------- 2 files changed, 187 insertions(+), 149 deletions(-) diff --git a/spec/package-manager-spec.js b/spec/package-manager-spec.js index 28364080b..df8735ddb 100644 --- a/spec/package-manager-spec.js +++ b/spec/package-manager-spec.js @@ -626,8 +626,8 @@ describe('PackageManager', () => { describe('when the package has a main module', () => { beforeEach(() => { - spyOn(Package.prototype, 'requireMainModule').andCallThrough() - }) + spyOn(Package.prototype, 'requireMainModule').andCallThrough(); + }); describe('when the metadata specifies a main module path˜', () => { it('requires the module at the specified path', async () => { @@ -680,10 +680,10 @@ describe('PackageManager', () => { let mainModule, promise, workspaceCommandListener, registration; beforeEach(() => { - jasmine.attachToDOM(atom.workspace.getElement()) - mainModule = require('./fixtures/packages/package-with-activation-commands/index') - mainModule.activationCommandCallCount = 0 - spyOn(mainModule, 'activate').andCallThrough() + jasmine.attachToDOM(atom.workspace.getElement()); + mainModule = require('./fixtures/packages/package-with-activation-commands/index'); + mainModule.activationCommandCallCount = 0; + spyOn(mainModule, 'activate').andCallThrough(); workspaceCommandListener = jasmine.createSpy( 'workspaceCommandListener' @@ -835,146 +835,176 @@ describe('PackageManager', () => { ); expect(notificationEvent.options.packageName).toEqual( 'package-with-invalid-settings' - ) - }) - }) + ); + }); + }); describe('when the package metadata includes both activation commands and deserializers', () => { - let mainModule, promise, workspaceCommandListener, registration + let mainModule, promise, workspaceCommandListener, registration; beforeEach(() => { - jasmine.attachToDOM(atom.workspace.getElement()) - spyOn(atom.packages, 'hasActivatedInitialPackages').andReturn(true) - mainModule = require('./fixtures/packages/package-with-activation-commands-and-deserializers/index') - mainModule.activationCommandCallCount = 0 - spyOn(mainModule, 'activate').andCallThrough() - workspaceCommandListener = jasmine.createSpy('workspaceCommandListener') - registration = atom.commands.add('.workspace', 'activation-command-2', workspaceCommandListener) + jasmine.attachToDOM(atom.workspace.getElement()); + spyOn(atom.packages, 'hasActivatedInitialPackages').andReturn(true); + mainModule = require('./fixtures/packages/package-with-activation-commands-and-deserializers/index'); + mainModule.activationCommandCallCount = 0; + spyOn(mainModule, 'activate').andCallThrough(); + workspaceCommandListener = jasmine.createSpy( + 'workspaceCommandListener' + ); + registration = atom.commands.add( + '.workspace', + 'activation-command-2', + workspaceCommandListener + ); - promise = atom.packages.activatePackage('package-with-activation-commands-and-deserializers') - }) + promise = atom.packages.activatePackage( + 'package-with-activation-commands-and-deserializers' + ); + }); afterEach(() => { if (registration) { - registration.dispose() + registration.dispose(); } - mainModule = null - }) + mainModule = null; + }); it('activates the package when a deserializer is called', async () => { - expect(Package.prototype.requireMainModule.callCount).toBe(0) + expect(Package.prototype.requireMainModule.callCount).toBe(0); - const state1 = {deserializer: 'Deserializer1', a: 'b'} + const state1 = { deserializer: 'Deserializer1', a: 'b' }; expect(atom.deserializers.deserialize(state1, atom)).toEqual({ wasDeserializedBy: 'deserializeMethod1', state: state1 - }) + }); - await promise - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) + await promise; + expect(Package.prototype.requireMainModule.callCount).toBe(1); + }); it('defers requiring/activating the main module until an activation event bubbles to the root view', async () => { - expect(Package.prototype.requireMainModule.callCount).toBe(0) + expect(Package.prototype.requireMainModule.callCount).toBe(0); - atom.workspace.getElement().dispatchEvent(new CustomEvent('activation-command-2', {bubbles: true})) + atom.workspace + .getElement() + .dispatchEvent( + new CustomEvent('activation-command-2', { bubbles: true }) + ); - await promise - expect(mainModule.activate.callCount).toBe(1) - expect(mainModule.activationCommandCallCount).toBe(1) - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) - }) + await promise; + expect(mainModule.activate.callCount).toBe(1); + expect(mainModule.activationCommandCallCount).toBe(1); + expect(Package.prototype.requireMainModule.callCount).toBe(1); + }); + }); describe('when the package metadata includes `activationHooks`', () => { - let mainModule, promise + let mainModule, promise; beforeEach(() => { - mainModule = require('./fixtures/packages/package-with-activation-hooks/index') - spyOn(mainModule, 'activate').andCallThrough() - }) + mainModule = require('./fixtures/packages/package-with-activation-hooks/index'); + spyOn(mainModule, 'activate').andCallThrough(); + }); it('defers requiring/activating the main module until an triggering of an activation hook occurs', async () => { - promise = atom.packages.activatePackage('package-with-activation-hooks') - expect(Package.prototype.requireMainModule.callCount).toBe(0) - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + promise = atom.packages.activatePackage( + 'package-with-activation-hooks' + ); + expect(Package.prototype.requireMainModule.callCount).toBe(0); + atom.packages.triggerActivationHook( + 'language-fictitious:grammar-used' + ); + atom.packages.triggerDeferredActivationHooks(); - await promise - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) + await promise; + expect(Package.prototype.requireMainModule.callCount).toBe(1); + }); it('does not double register activation hooks when deactivating and reactivating', async () => { - promise = atom.packages.activatePackage('package-with-activation-hooks') - expect(mainModule.activate.callCount).toBe(0) - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + promise = atom.packages.activatePackage( + 'package-with-activation-hooks' + ); + expect(mainModule.activate.callCount).toBe(0); + atom.packages.triggerActivationHook( + 'language-fictitious:grammar-used' + ); + atom.packages.triggerDeferredActivationHooks(); - await promise - expect(mainModule.activate.callCount).toBe(1) + await promise; + expect(mainModule.activate.callCount).toBe(1); - await atom.packages.deactivatePackage('package-with-activation-hooks') + await atom.packages.deactivatePackage( + 'package-with-activation-hooks' + ); - promise = atom.packages.activatePackage('package-with-activation-hooks') - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() + promise = atom.packages.activatePackage( + 'package-with-activation-hooks' + ); + atom.packages.triggerActivationHook( + 'language-fictitious:grammar-used' + ); + atom.packages.triggerDeferredActivationHooks(); - await promise - expect(mainModule.activate.callCount).toBe(2) - }) + await promise; + expect(mainModule.activate.callCount).toBe(2); + }); it('activates the package immediately when activationHooks is empty', async () => { - mainModule = require('./fixtures/packages/package-with-empty-activation-hooks/index') - spyOn(mainModule, 'activate').andCallThrough() + mainModule = require('./fixtures/packages/package-with-empty-activation-hooks/index'); + spyOn(mainModule, 'activate').andCallThrough(); - expect(Package.prototype.requireMainModule.callCount).toBe(0) - - await atom.packages.activatePackage('package-with-empty-activation-hooks') - expect(mainModule.activate.callCount).toBe(1) - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) - - it('activates the package immediately if the activation hook had already been triggered', async () => { - atom.packages.triggerActivationHook('language-fictitious:grammar-used') - atom.packages.triggerDeferredActivationHooks() - expect(Package.prototype.requireMainModule.callCount).toBe(0) + expect(Package.prototype.requireMainModule.callCount).toBe(0); await atom.packages.activatePackage( - 'package-with-activation-hooks' - ) - expect(mainModule.activate.callCount).toBe(1) - expect(Package.prototype.requireMainModule.callCount).toBe(1) - }) - }) + 'package-with-empty-activation-hooks' + ); + expect(mainModule.activate.callCount).toBe(1); + expect(Package.prototype.requireMainModule.callCount).toBe(1); + }); + + it('activates the package immediately if the activation hook had already been triggered', async () => { + atom.packages.triggerActivationHook( + 'language-fictitious:grammar-used' + ); + atom.packages.triggerDeferredActivationHooks(); + expect(Package.prototype.requireMainModule.callCount).toBe(0); + + await atom.packages.activatePackage('package-with-activation-hooks'); + expect(mainModule.activate.callCount).toBe(1); + expect(Package.prototype.requireMainModule.callCount).toBe(1); + }); + }); describe('when the package metadata includes `workspaceOpeners`', () => { - let mainModule, promise + let mainModule, promise; beforeEach(() => { - mainModule = require('./fixtures/packages/package-with-workspace-openers/index') - spyOn(mainModule, 'activate').andCallThrough() - }) + mainModule = require('./fixtures/packages/package-with-workspace-openers/index'); + spyOn(mainModule, 'activate').andCallThrough(); + }); it('defers requiring/activating the main module until a registered opener is called', async () => { - promise = atom.packages.activatePackage('package-with-workspace-openers') - expect(Package.prototype.requireMainModule.callCount).toBe(0) - atom.workspace.open('atom://fictitious') + promise = atom.packages.activatePackage( + 'package-with-workspace-openers' + ); + expect(Package.prototype.requireMainModule.callCount).toBe(0); + atom.workspace.open('atom://fictitious'); - await promise - expect(Package.prototype.requireMainModule.callCount).toBe(1) - expect(mainModule.openerCount).toBe(1) - }) + await promise; + expect(Package.prototype.requireMainModule.callCount).toBe(1); + expect(mainModule.openerCount).toBe(1); + }); it('activates the package immediately when the events are empty', async () => { - mainModule = require('./fixtures/packages/package-with-empty-workspace-openers/index') - spyOn(mainModule, 'activate').andCallThrough() + mainModule = require('./fixtures/packages/package-with-empty-workspace-openers/index'); + spyOn(mainModule, 'activate').andCallThrough(); - atom.packages.activatePackage('package-with-empty-workspace-openers') + atom.packages.activatePackage('package-with-empty-workspace-openers'); - expect(mainModule.activate.callCount).toBe(1) - }) - }) - }) + expect(mainModule.activate.callCount).toBe(1); + }); + }); + }); describe('when the package has no main module', () => { it('does not throw an exception', () => { diff --git a/src/package.js b/src/package.js index c3593eacf..dd5105708 100644 --- a/src/package.js +++ b/src/package.js @@ -161,15 +161,15 @@ module.exports = class Package { ); } - reset () { - this.stylesheets = [] - this.keymaps = [] - this.menus = [] - this.grammars = [] - this.settings = [] - this.mainInitialized = false - this.mainActivated = false - this.deserialized = false + reset() { + this.stylesheets = []; + this.keymaps = []; + this.menus = []; + this.grammars = []; + this.settings = []; + this.mainInitialized = false; + this.mainActivated = false; + this.deserialized = false; } initializeIfNeeded() { @@ -245,9 +245,12 @@ module.exports = class Package { this.mainActivated = true; this.activateServices(); } - if (this.activationCommandSubscriptions) this.activationCommandSubscriptions.dispose() - if (this.activationHookSubscriptions) this.activationHookSubscriptions.dispose() - if (this.workspaceOpenerSubscriptions) this.workspaceOpenerSubscriptions.dispose() + if (this.activationCommandSubscriptions) + this.activationCommandSubscriptions.dispose(); + if (this.activationHookSubscriptions) + this.activationHookSubscriptions.dispose(); + if (this.workspaceOpenerSubscriptions) + this.workspaceOpenerSubscriptions.dispose(); } catch (error) { this.handleError(`Failed to activate the ${this.name} package`, error); } @@ -556,9 +559,9 @@ module.exports = class Package { this.deserializerManager.add({ name: deserializerName, deserialize: (state, atomEnvironment) => { - this.registerViewProviders() - this.requireMainModule() - this.initializeIfNeeded() + this.registerViewProviders(); + this.requireMainModule(); + this.initializeIfNeeded(); if (atomEnvironment.packages.hasActivatedInitialPackages()) { // Only explicitly activate the package if initial packages // have finished activating. This is because deserialization @@ -569,10 +572,10 @@ module.exports = class Package { // always have access to the workspace element. // Otherwise, we just set the deserialized flag and package-manager // will activate this package as normal during initial package activation. - this.activateNow() + this.activateNow(); } - this.deserialized = true - return this.mainModule[methodName](state, atomEnvironment) + this.deserialized = true; + return this.mainModule[methodName](state, atomEnvironment); } }); }); @@ -944,13 +947,14 @@ module.exports = class Package { return this.mainModulePath; } - activationShouldBeDeferred () { - return !this.deserialized && ( - this.hasActivationCommands() || - this.hasActivationHooks() || - this.hasWorkspaceOpeners() || - this.hasDeferredURIHandler() - ) + activationShouldBeDeferred() { + return ( + !this.deserialized && + (this.hasActivationCommands() || + this.hasActivationHooks() || + this.hasWorkspaceOpeners() || + this.hasDeferredURIHandler()) + ); } hasActivationHooks() { @@ -958,13 +962,13 @@ module.exports = class Package { return hooks && hooks.length > 0; } - hasWorkspaceOpeners () { - const openers = this.getWorkspaceOpeners() - return openers && openers.length > 0 + hasWorkspaceOpeners() { + const openers = this.getWorkspaceOpeners(); + return openers && openers.length > 0; } - hasActivationCommands () { - const object = this.getActivationCommands() + hasActivationCommands() { + const object = this.getActivationCommands(); for (let selector in object) { const commands = object[selector]; if (commands.length > 0) return true; @@ -977,10 +981,10 @@ module.exports = class Package { return handler && handler.deferActivation !== false; } - subscribeToDeferredActivation () { - this.subscribeToActivationCommands() - this.subscribeToActivationHooks() - this.subscribeToWorkspaceOpeners() + subscribeToDeferredActivation() { + this.subscribeToActivationCommands(); + this.subscribeToActivationHooks(); + this.subscribeToWorkspaceOpeners(); } subscribeToActivationCommands() { @@ -1078,39 +1082,43 @@ module.exports = class Package { return this.activationHooks; } - subscribeToWorkspaceOpeners () { - this.workspaceOpenerSubscriptions = new CompositeDisposable() + subscribeToWorkspaceOpeners() { + this.workspaceOpenerSubscriptions = new CompositeDisposable(); for (let opener of this.getWorkspaceOpeners()) { - this.workspaceOpenerSubscriptions.add(atom.workspace.addOpener(filePath => { - if (filePath === opener) { - this.activateNow() - this.workspaceOpenerSubscriptions.dispose() - return atom.workspace.createItemForURI(opener) - } - })) + this.workspaceOpenerSubscriptions.add( + atom.workspace.addOpener(filePath => { + if (filePath === opener) { + this.activateNow(); + this.workspaceOpenerSubscriptions.dispose(); + return atom.workspace.createItemForURI(opener); + } + }) + ); } } - getWorkspaceOpeners () { - if (this.workspaceOpeners) return this.workspaceOpeners + getWorkspaceOpeners() { + if (this.workspaceOpeners) return this.workspaceOpeners; if (this.metadata.workspaceOpeners) { if (Array.isArray(this.metadata.workspaceOpeners)) { - this.workspaceOpeners = Array.from(new Set(this.metadata.workspaceOpeners)) + this.workspaceOpeners = Array.from( + new Set(this.metadata.workspaceOpeners) + ); } else if (typeof this.metadata.workspaceOpeners === 'string') { - this.workspaceOpeners = [this.metadata.workspaceOpeners] + this.workspaceOpeners = [this.metadata.workspaceOpeners]; } else { - this.workspaceOpeners = [] + this.workspaceOpeners = []; } } else { - this.workspaceOpeners = [] + this.workspaceOpeners = []; } - return this.workspaceOpeners + return this.workspaceOpeners; } - getURIHandler () { - return this.metadata && this.metadata.uriHandler + getURIHandler() { + return this.metadata && this.metadata.uriHandler; } // Does the given module path contain native code? From d8c9d0cd0b7d05af1f20a4fce5a95a4c2af1a839 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 10:49:05 +0200 Subject: [PATCH 067/184] Remove unnecessary temporary variable --- src/context-menu-manager.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 4f3af45d6..99fc4e94c 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -167,8 +167,7 @@ class ContextMenuManager if keystrokes.includes(' ') item.label += " [#{_.humanizeKeystroke(keystrokes)}]" else - accelerator = MenuHelpers.acceleratorForKeystroke(keystrokes) - item.accelerator = accelerator + item.accelerator = MenuHelpers.acceleratorForKeystroke(keystrokes) if Array.isArray(item.submenu) @addAccelerators(item.submenu) From bbc9aab3ce0a6368b41c14146092a371b673c2f7 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 3 Jun 2019 13:58:20 +0200 Subject: [PATCH 068/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20fuzzy-finder@1.13.?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 046cf99f6..44e7fb08c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3132,8 +3132,8 @@ "integrity": "sha1-gy9kifvodnaUWVmckUpnDsIpR+4=" }, "fuzzy-finder": { - "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.5/tarball", - "integrity": "sha512-YGWs7O5f2H0An7wTKet9yst+EngKCMBMzI6E68UyM5qGs+1cEyOo4j5JEB3RtHpzsBDv+aYhT0C/WoXuOh+B/g==", + "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.6/tarball", + "integrity": "sha512-6H8kss3IonwyZoD/LtQRq6RZXYmD4pKVo8XbR79KVCbipB349pKHaareJ45MqGAFalxRtiJKqVyI9WsR6XzODg==", "requires": { "@atom/fuzzy-native": "^1.0.3", "async": "0.2.6", diff --git a/package.json b/package.json index b26e1c0fd..fa7d25717 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "fs-plus": "^3.1.1", "fstream": "0.1.24", "fuzzaldrin": "^2.1", - "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.5/tarball", + "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.6/tarball", "git-diff": "file:packages/git-diff", "git-utils": "5.5.0", "github": "https://www.atom.io/api/packages/github/versions/0.29.0/tarball", @@ -201,7 +201,7 @@ "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", "find-and-replace": "0.218.11", - "fuzzy-finder": "1.13.5", + "fuzzy-finder": "1.13.6", "github": "0.29.0", "git-diff": "file:./packages/git-diff", "go-to-line": "file:./packages/go-to-line", From fdbf62db694dd8734404c80d5bfe39623c2073cb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 3 Jun 2019 14:56:56 -0600 Subject: [PATCH 069/184] Document workspaceOpeners /cc: @50wliu --- src/workspace.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/workspace.js b/src/workspace.js index 7a4bb6f32..9262e45f7 100644 --- a/src/workspace.js +++ b/src/workspace.js @@ -1518,6 +1518,10 @@ module.exports = class Workspace extends Model { // that is already open in a text editor view. You could signal this by calling // {Workspace::open} on the URI `quux-preview://foo/bar/baz.quux`. Then your opener // can check the protocol for quux-preview and only handle those URIs that match. + // + // To defer your package's activation until a specific URL is opened, add a + // `workspaceOpeners` field to your `package.json` containing an array of URL + // strings. addOpener(opener) { this.openers.push(opener); return new Disposable(() => { From 3be4889b77818b480fae34768e033f546baeb52f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 11:12:50 +0200 Subject: [PATCH 070/184] Cache node_modules on Azure Pipelines based on package-lock.json Co-Authored-By: Nathan Sobo Co-Authored-By: Rafael Oleza --- script/vsts/platforms/linux.yml | 15 ++++++++++++++ script/vsts/platforms/macos.yml | 15 ++++++++++++++ script/vsts/platforms/windows.yml | 33 +++++++++++++++++++++++++++++++ script/vsts/x64-cache-key | 1 + script/vsts/x86-cache-key | 1 + 5 files changed, 65 insertions(+) create mode 100644 script/vsts/x64-cache-key create mode 100644 script/vsts/x86-cache-key diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index 1142c428e..f81d889c4 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -12,11 +12,26 @@ jobs: container: atom-linux-ci steps: + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - script: script/bootstrap displayName: Bootstrap build environment env: CI: true CI_PROVIDER: VSTS + condition: ne(variables['CacheRestored'], 'true') + + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - script: script/lint displayName: Run linter diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 0ea324633..44a753037 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -19,12 +19,27 @@ jobs: - script: npm install --global npm@6.2.0 displayName: Update npm + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - script: script/bootstrap displayName: Bootstrap build environment env: CI: true CI_PROVIDER: VSTS NPM_BIN_PATH: /usr/local/bin/npm + condition: ne(variables['CacheRestored'], 'true') + + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - script: script/lint displayName: Run linter diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index de8247335..c8d800264 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -39,6 +39,22 @@ jobs: npm install displayName: Install Windows build dependencies + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache (x64) + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x64') + + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache (x86) + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x86') + - script: | node script\vsts\windows-run.js script\bootstrap.cmd env: @@ -47,6 +63,23 @@ jobs: CI_PROVIDER: VSTS NPM_BIN_PATH: "D:\\a\\_tool\\node\\8.9.3\\x64\\npm.cmd" displayName: Bootstrap build environment + condition: ne(variables['CacheRestored'], 'true') + + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache (x64) + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x64') + + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache (x86) + inputs: + keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x86') - script: node script\vsts\windows-run.js script\lint.cmd env: diff --git a/script/vsts/x64-cache-key b/script/vsts/x64-cache-key new file mode 100644 index 000000000..e9b6ac458 --- /dev/null +++ b/script/vsts/x64-cache-key @@ -0,0 +1 @@ +x64 diff --git a/script/vsts/x86-cache-key b/script/vsts/x86-cache-key new file mode 100644 index 000000000..7306afab8 --- /dev/null +++ b/script/vsts/x86-cache-key @@ -0,0 +1 @@ +x86 From 3a6750b3f99fdb2f0d35b62d117ad21e2cdee5d8 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 11:12:50 +0200 Subject: [PATCH 071/184] Run bootstrap only once on Azure Pipelines for Windows --- script/vsts/platforms/windows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index c8d800264..c613c49af 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -91,14 +91,14 @@ jobs: SET SQUIRREL_TEMP=C:\tmp IF [%IS_RELEASE_BRANCH%]==[true] ( ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% - node script\vsts\windows-run.js script\build.cmd --code-sign --compress-artifacts --create-windows-installer + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts --create-windows-installer ) ELSE ( IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% - node script\vsts\windows-run.js script\build.cmd --code-sign --compress-artifacts + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts ) ELSE ( ECHO Pull request build, no code signing will be performed - node script\vsts\windows-run.js script\build.cmd --compress-artifacts + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts ) ) env: From 7652d659e500f5b730250b8dbea88bc5536ff717 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 4 Jun 2019 11:42:09 +0200 Subject: [PATCH 072/184] Take into account the excludeVcsIgnores option in ripgrep scanner --- spec/workspace-spec.js | 18 +++++++++++++++--- src/ripgrep-directory-searcher.js | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index d080f5fc8..5de40ae81 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2697,7 +2697,7 @@ describe('Workspace', () => { }); }); - describe('when the core.excludeVcsIgnoredPaths config is truthy', () => { + describe('when the core.excludeVcsIgnoredPaths config is used', () => { let projectPath; let ignoredPath; @@ -2737,15 +2737,27 @@ describe('Workspace', () => { } }); - it('excludes ignored files', async () => { + it('excludes ignored files when core.excludeVcsIgnoredPaths is true', async () => { atom.project.setPaths([projectPath]); atom.config.set('core.excludeVcsIgnoredPaths', true); const resultHandler = jasmine.createSpy('result found'); - await scan(/match/, {}, () => resultHandler()); + await scan(/match/, {}, ({ filePath }) => resultHandler(filePath)); expect(resultHandler).not.toHaveBeenCalled(); }); + + it('does not excludes ignored files when core.excludeVcsIgnoredPaths is false', async () => { + atom.project.setPaths([projectPath]); + atom.config.set('core.excludeVcsIgnoredPaths', false); + const resultHandler = jasmine.createSpy('result found'); + + await scan(/match/, {}, ({ filePath }) => resultHandler(filePath)); + + expect(resultHandler).toHaveBeenCalledWith( + path.join(projectPath, 'ignored.txt') + ); + }); }); it('includes only files when a directory filter is specified', async () => { diff --git a/src/ripgrep-directory-searcher.js b/src/ripgrep-directory-searcher.js index cdef3fc88..15033d205 100644 --- a/src/ripgrep-directory-searcher.js +++ b/src/ripgrep-directory-searcher.js @@ -257,6 +257,10 @@ module.exports = class RipgrepDirectorySearcher { args.push('--multiline'); } + if (!options.excludeVcsIgnores) { + args.push('--no-ignore-vcs'); + } + args.push(directoryPath); const child = spawn(this.rgPath, args, { From 3845862f5dead17527947f58cc6013904498e031 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 4 Jun 2019 11:45:05 +0200 Subject: [PATCH 073/184] Convert beforeEach() function to async --- spec/workspace-spec.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 5de40ae81..6bf2878de 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2701,7 +2701,7 @@ describe('Workspace', () => { let projectPath; let ignoredPath; - beforeEach(() => { + beforeEach(async () => { const sourceProjectPath = path.join( __dirname, 'fixtures', @@ -2713,22 +2713,17 @@ describe('Workspace', () => { const writerStream = fstream.Writer(projectPath); fstream.Reader(sourceProjectPath).pipe(writerStream); - waitsFor(done => { - writerStream.on('close', done); - writerStream.on('error', done); + await new Promise(resolve => { + writerStream.on('close', resolve); + writerStream.on('error', resolve); }); - runs(() => { - fs.renameSync( - path.join(projectPath, 'git.git'), - path.join(projectPath, '.git') - ); - ignoredPath = path.join(projectPath, 'ignored.txt'); - fs.writeFileSync( - ignoredPath, - 'this match should not be included' - ); - }); + fs.renameSync( + path.join(projectPath, 'git.git'), + path.join(projectPath, '.git') + ); + ignoredPath = path.join(projectPath, 'ignored.txt'); + fs.writeFileSync(ignoredPath, 'this match should not be included'); }); afterEach(() => { From 8758c399db30dda56fef2cb9e3ae8f0f5ad58fde Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 4 Jun 2019 11:56:27 +0200 Subject: [PATCH 074/184] Take into account the follow option in ripgrep scanner --- spec/workspace-spec.js | 55 +++++++++++++++++++++++++++++++ src/ripgrep-directory-searcher.js | 4 +++ 2 files changed, 59 insertions(+) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 6bf2878de..4dadf2cce 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2755,6 +2755,61 @@ describe('Workspace', () => { }); }); + describe('when the core.followSymlinks config is used', () => { + let projectPath; + + beforeEach(async () => { + const sourceProjectPath = path.join( + __dirname, + 'fixtures', + 'dir', + 'a-dir' + ); + projectPath = path.join(temp.mkdirSync('atom')); + + const writerStream = fstream.Writer(projectPath); + fstream.Reader(sourceProjectPath).pipe(writerStream); + + await new Promise(resolve => { + writerStream.on('close', resolve); + writerStream.on('error', resolve); + }); + + fs.symlinkSync( + path.join(__dirname, 'fixtures', 'dir', 'b'), + path.join(projectPath, 'symlink') + ); + }); + + afterEach(() => { + if (fs.existsSync(projectPath)) { + fs.removeSync(projectPath); + } + }); + + it('follows symlinks when core.followSymlinks is true', async () => { + atom.project.setPaths([projectPath]); + atom.config.set('core.followSymlinks', true); + const resultHandler = jasmine.createSpy('result found'); + + await scan(/ccc/, {}, ({ filePath }) => resultHandler(filePath)); + + expect(resultHandler).toHaveBeenCalledWith( + path.join(projectPath, 'symlink') + ); + }); + + it('does not follow symlinks when core.followSymlinks is false', async () => { + atom.project.setPaths([projectPath]); + atom.config.set('core.followSymlinks', false); + const resultHandler = jasmine.createSpy('result found'); + + await scan(/ccc/, {}, ({ filePath }) => resultHandler(filePath)); + + expect(resultHandler).not.toHaveBeenCalled(); + }); + }); + it('includes only files when a directory filter is specified', async () => { const projectPath = path.join( path.join(__dirname, 'fixtures', 'dir') diff --git a/src/ripgrep-directory-searcher.js b/src/ripgrep-directory-searcher.js index 15033d205..7577b8aa2 100644 --- a/src/ripgrep-directory-searcher.js +++ b/src/ripgrep-directory-searcher.js @@ -257,6 +257,10 @@ module.exports = class RipgrepDirectorySearcher { args.push('--multiline'); } + if (options.follow) { + args.push('--follow'); + } + if (!options.excludeVcsIgnores) { args.push('--no-ignore-vcs'); } From 8231a16d77ed613caaebe384b760a0b0d430d730 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 11:12:50 +0200 Subject: [PATCH 075/184] Add package.json as a key to invalidate the cache on Electron upgrades --- script/vsts/platforms/linux.yml | 4 ++-- script/vsts/platforms/macos.yml | 4 ++-- script/vsts/platforms/windows.yml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index f81d889c4..e820ef921 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -15,7 +15,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' @@ -29,7 +29,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 44a753037..223d15d5f 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -22,7 +22,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' @@ -37,7 +37,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index c613c49af..444915c5d 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -42,7 +42,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache (x64) inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x64') @@ -50,7 +50,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache (x86) inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x86') @@ -68,7 +68,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache (x64) inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x64') @@ -76,7 +76,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache (x86) inputs: - keyfile: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x86') From d75ddb9063f17c834158bfef22efb8a02d67be97 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 4 Jun 2019 17:00:07 +0200 Subject: [PATCH 076/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20metrics@1.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 18 ++++++++++++------ package.json | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 046cf99f6..6e20caf83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3531,6 +3531,11 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "idb": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/idb/-/idb-4.0.3.tgz", + "integrity": "sha512-moRlNNe0Gsvp4jAwz5cJ7scjyNTVA/cESKGCobULaljfaKZ970y8NDNCseHdMY+YxNXH58Z1V+7tTyf0GZyKqw==" + }, "image-size": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", @@ -4657,12 +4662,12 @@ } }, "metrics": { - "version": "https://www.atom.io/api/packages/metrics/versions/1.7.5/tarball", - "integrity": "sha512-HcA9QKEJAdQi1p6ppk48BKsBGv5E/bLK2rlNUQZJvCPIvPAM/ufFjnqlzujQbZ1/2VFvfXIh4EgQUyS2Hkm1+w==", + "version": "https://www.atom.io/api/packages/metrics/versions/1.8.0/tarball", + "integrity": "sha512-agWghp4huKZknDrkw2EeRxwIPSwBiofTTd2o/kXXnek8FGqghvZe8QEpHGTSYAqg5FqdwREExQfxNBWG6HmnMA==", "requires": { "fs-plus": "^3.0.0", "grim": "^2.0.1", - "telemetry-github": "0.0.14" + "telemetry-github": "0.1.0" }, "dependencies": { "grim": { @@ -6521,10 +6526,11 @@ } }, "telemetry-github": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/telemetry-github/-/telemetry-github-0.0.14.tgz", - "integrity": "sha512-rJthdI6QLFP6CV97qexkB06OmKygX9JT3qtCPUdvKBKyy6xnViSys+GKaxv3tRPKgpnOkQJgkdJzQYgpx5+/Nw==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/telemetry-github/-/telemetry-github-0.1.0.tgz", + "integrity": "sha512-rD9u8U9r33262FkSKYAunWm008GpRXIjGMgTYi2EsyvG9xrlAYgi0qiZ4Enb9DIvIOruNxUxjerZEok9NSfB1Q==", "requires": { + "idb": "^4.0.3", "lokijs": "^1.5.4", "uuid": "^3.2.1" }, diff --git a/package.json b/package.json index b26e1c0fd..f19a39b84 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "link": "file:packages/link", "markdown-preview": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.0/tarball", "marked": "^0.3.12", - "metrics": "https://www.atom.io/api/packages/metrics/versions/1.7.5/tarball", + "metrics": "https://www.atom.io/api/packages/metrics/versions/1.8.0/tarball", "minimatch": "^3.0.3", "mocha": "2.5.1", "mocha-junit-reporter": "^1.13.0", @@ -212,7 +212,7 @@ "line-ending-selector": "file:./packages/line-ending-selector", "link": "file:./packages/link", "markdown-preview": "0.160.0", - "metrics": "1.7.5", + "metrics": "1.8.0", "notifications": "0.70.6", "open-on-github": "1.3.1", "package-generator": "1.3.0", From 0d00538da3e23d28521c71d1b1b1e1bdbf422f05 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 11:12:50 +0200 Subject: [PATCH 077/184] Run core and package tests in parallel for macOS on Azure Pipelines --- script/test | 8 +- script/vsts/nightly-release.yml | 2 +- script/vsts/platforms/macos.yml | 108 ++++++++++++++++++++------- script/vsts/release-branch-build.yml | 2 +- 4 files changed, 88 insertions(+), 32 deletions(-) diff --git a/script/test b/script/test index adb8a5123..ab9daed6d 100755 --- a/script/test +++ b/script/test @@ -201,7 +201,13 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': - suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + if (process.env.ATOM_RUN_CORE_TESTS === 'true') { + suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests] + } else if (process.env.ATOM_RUN_PACKAGE_TESTS === 'true') { + suites = packageTestSuites + } else { + suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + } break case 'win32': suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests] diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index ac6537bb9..2bacc55a4 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -29,7 +29,7 @@ jobs: - GetReleaseVersion - Windows - Linux - - macOS + - macOS_tests variables: ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 223d15d5f..f2f568e79 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -1,5 +1,6 @@ jobs: -- job: macOS +- job: macOS_build + displayName: macOS build dependsOn: GetReleaseVersion timeoutInMinutes: 180 @@ -61,6 +62,81 @@ jobs: ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN) ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) + - script: | + cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) + displayName: Stage Artifacts + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip + ArtifactName: atom-mac.zip + ArtifactType: Container + displayName: Upload atom-mac.zip + condition: succeeded() + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip + ArtifactName: atom-mac-symbols.zip + ArtifactType: Container + displayName: Upload atom-mac-symbols.zip + condition: succeeded() + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json + ArtifactName: atom-api.json + ArtifactType: Container + displayName: Upload atom-api.json + condition: succeeded() + +- job: macOS_tests + displayName: macOS test + dependsOn: macOS_build + timeoutInMinutes: 180 + pool: + vmImage: macos-10.13 + strategy: + maxParallel: 2 + matrix: + core: + RunCoreTests: true + RunPackageTests: false + packages: + RunCoreTests: false + RunPackageTests: true + + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 + + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + + - task: DownloadBuildArtifacts@0 + displayName: Download atom-mac.zip + inputs: + artifactName: 'atom-mac.zip' + downloadPath: $(Build.SourcesDirectory) + + - script: unzip atom-mac.zip/atom-mac.zip -d out + displayName: Unzip atom-mac.zip + + - task: DownloadBuildArtifacts@0 + displayName: Download atom-mac-symbols.zip + inputs: + artifactName: 'atom-mac-symbols.zip' + downloadPath: $(Build.SourcesDirectory) + + - script: unzip atom-mac-symbols.zip/atom-mac-symbols.zip -d out + displayName: Unzip atom-mac-symbols.zip + - script: | osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver caffeinate -s script/test # Run with caffeinate to prevent screen saver @@ -69,6 +145,8 @@ jobs: CI_PROVIDER: VSTS ATOM_JASMINE_REPORTER: list TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + ATOM_RUN_CORE_TESTS: $(RunCoreTests) + ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests) displayName: Run tests condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) @@ -87,40 +165,12 @@ jobs: testRunTitle: MacOS condition: ne(variables['Atom.SkipTests'], 'true') - - script: | - cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) - displayName: Stage Artifacts - - script: | mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports displayName: Stage Crash Reports condition: failed() - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip - ArtifactName: atom-mac.zip - ArtifactType: Container - displayName: Upload atom-mac.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip - ArtifactName: atom-mac-symbols.zip - ArtifactType: Container - displayName: Upload atom-mac-symbols.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json - ArtifactName: atom-api.json - ArtifactType: Container - displayName: Upload atom-api.json - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - task: PublishBuildArtifacts@1 inputs: PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index ab600d80d..8333c3d7a 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -34,7 +34,7 @@ jobs: - GetReleaseVersion - Windows - Linux - - macOS + - macOS_tests variables: ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] From 9d2494ca167362f1234f4a005bdf4d5b5f183bfc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 3 Jun 2019 11:12:50 +0200 Subject: [PATCH 078/184] Don't run benchmark tests during script/test unless explicitly requested --- script/test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/test b/script/test index ab9daed6d..720c274f6 100755 --- a/script/test +++ b/script/test @@ -202,11 +202,11 @@ function testSuitesForPlatform (platform) { switch (platform) { case 'darwin': if (process.env.ATOM_RUN_CORE_TESTS === 'true') { - suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests] + suites = [runCoreMainProcessTests, runCoreRenderProcessTests] } else if (process.env.ATOM_RUN_PACKAGE_TESTS === 'true') { suites = packageTestSuites } else { - suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + suites = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites) } break case 'win32': From 3866aeefc2790b8d0d7213ccda94d7b94379f0fc Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 4 Jun 2019 17:21:23 -0600 Subject: [PATCH 079/184] :arrow_up: fuzzy-finder@1.13.7 to address flaky tests --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d7270b102..ae551150f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3132,8 +3132,8 @@ "integrity": "sha1-gy9kifvodnaUWVmckUpnDsIpR+4=" }, "fuzzy-finder": { - "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.6/tarball", - "integrity": "sha512-6H8kss3IonwyZoD/LtQRq6RZXYmD4pKVo8XbR79KVCbipB349pKHaareJ45MqGAFalxRtiJKqVyI9WsR6XzODg==", + "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.7/tarball", + "integrity": "sha512-79C7IWrHrPk5UKL48KlcHoFy8T+FGfh/HXRwChkxrLYCrUZSl8a+Bj956j2xIRVanO+lNAnLR5QVyrDhbJ2McA==", "requires": { "@atom/fuzzy-native": "^1.0.3", "async": "0.2.6", diff --git a/package.json b/package.json index 9f4ec3505..500331fd0 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "fs-plus": "^3.1.1", "fstream": "0.1.24", "fuzzaldrin": "^2.1", - "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.6/tarball", + "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.7/tarball", "git-diff": "file:packages/git-diff", "git-utils": "5.5.0", "github": "https://www.atom.io/api/packages/github/versions/0.29.0/tarball", @@ -201,7 +201,7 @@ "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", "find-and-replace": "0.218.11", - "fuzzy-finder": "1.13.6", + "fuzzy-finder": "1.13.7", "github": "0.29.0", "git-diff": "file:./packages/git-diff", "go-to-line": "file:./packages/go-to-line", From 791a5838601ee1003f9838a1c5d9709b7de29407 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 5 Jun 2019 10:05:19 +0200 Subject: [PATCH 080/184] Run package tests in parallel --- script/test | 6 ++++-- script/vsts/platforms/macos.yml | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/script/test b/script/test index 720c274f6..8f29a0c37 100755 --- a/script/test +++ b/script/test @@ -203,8 +203,10 @@ function testSuitesForPlatform (platform) { case 'darwin': if (process.env.ATOM_RUN_CORE_TESTS === 'true') { suites = [runCoreMainProcessTests, runCoreRenderProcessTests] - } else if (process.env.ATOM_RUN_PACKAGE_TESTS === 'true') { - suites = packageTestSuites + } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') { + suites = packageTestSuites.slice(0, Math.floor(packageTestSuites.length / 2)) + } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') { + suites = packageTestSuites.slice(Math.floor(packageTestSuites.length / 2)) } else { suites = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites) } diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index f2f568e79..253b22203 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -97,14 +97,17 @@ jobs: pool: vmImage: macos-10.13 strategy: - maxParallel: 2 + maxParallel: 3 matrix: core: RunCoreTests: true RunPackageTests: false - packages: + packages-1: RunCoreTests: false - RunPackageTests: true + RunPackageTests: 1 + packages-2: + RunCoreTests: false + RunPackageTests: 2 steps: - task: NodeTool@0 From 95adde37c06d0f7420d669b47ed0a574c3a4edaa Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 4 Jun 2019 12:17:38 +0200 Subject: [PATCH 081/184] Take into account the includeHidden option in ripgrep scanner --- spec/workspace-spec.js | 44 +++++++++++++++++++++++++++++++ src/default-directory-searcher.js | 2 +- src/ripgrep-directory-searcher.js | 8 ++++-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 4dadf2cce..034b8d706 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2810,6 +2810,50 @@ describe('Workspace', () => { }); }); + describe('when there are hidden files', () => { + let projectPath; + + beforeEach(async () => { + const sourceProjectPath = path.join( + __dirname, + 'fixtures', + 'dir', + 'a-dir' + ); + projectPath = path.join(temp.mkdirSync('atom')); + + const writerStream = fstream.Writer(projectPath); + fstream.Reader(sourceProjectPath).pipe(writerStream); + + await new Promise(resolve => { + writerStream.on('close', resolve); + writerStream.on('error', resolve); + }); + + // Note: This won't create a hidden file on Windows, in order to more + // accurately test this behaviour there, we should either use a package + // like `fswin` or manually spawn an `ATTRIB` command. + fs.writeFileSync(path.join(projectPath, '.hidden'), 'ccc'); + }); + + afterEach(() => { + if (fs.existsSync(projectPath)) { + fs.removeSync(projectPath); + } + }); + + it('searches on hidden files', async () => { + atom.project.setPaths([projectPath]); + const resultHandler = jasmine.createSpy('result found'); + + await scan(/ccc/, {}, ({ filePath }) => resultHandler(filePath)); + + expect(resultHandler).toHaveBeenCalledWith( + path.join(projectPath, '.hidden') + ); + }); + }); + it('includes only files when a directory filter is specified', async () => { const projectPath = path.join( path.join(__dirname, 'fixtures', 'dir') diff --git a/src/default-directory-searcher.js b/src/default-directory-searcher.js index 982fd5b19..0946ec304 100644 --- a/src/default-directory-searcher.js +++ b/src/default-directory-searcher.js @@ -82,7 +82,7 @@ module.exports = class DefaultDirectorySearcher { // Each item in the array is a file/directory pattern, e.g., `src` to search in the "src" // directory or `*.js` to search all JavaScript files. In practice, this often comes from the // comma-delimited list of patterns in the bottom text input of the ProjectFindView dialog. - // * `ignoreHidden` {boolean} whether to ignore hidden files. + // * `includeHidden` {boolean} whether to ignore hidden files. // * `excludeVcsIgnores` {boolean} whether to exclude VCS ignored paths. // * `exclusions` {Array} similar to inclusions // * `follow` {boolean} whether symlinks should be followed. diff --git a/src/ripgrep-directory-searcher.js b/src/ripgrep-directory-searcher.js index 7577b8aa2..bb1bee159 100644 --- a/src/ripgrep-directory-searcher.js +++ b/src/ripgrep-directory-searcher.js @@ -193,7 +193,7 @@ module.exports = class RipgrepDirectorySearcher { // Each item in the array is a file/directory pattern, e.g., `src` to search in the "src" // directory or `*.js` to search all JavaScript files. In practice, this often comes from the // comma-delimited list of patterns in the bottom text input of the ProjectFindView dialog. - // * `ignoreHidden` {boolean} whether to ignore hidden files. + // * `includeHidden` {boolean} whether to ignore hidden files. // * `excludeVcsIgnores` {boolean} whether to exclude VCS ignored paths. // * `exclusions` {Array} similar to inclusions // * `follow` {boolean} whether symlinks should be followed. @@ -230,7 +230,7 @@ module.exports = class RipgrepDirectorySearcher { const directoryPath = directory.getPath(); const regexpStr = this.prepareRegexp(regexp.source); - const args = ['--hidden', '--json', '--regexp', regexpStr]; + const args = ['--json', '--regexp', regexpStr]; if (options.leadingContextLineCount) { args.push('--before-context', options.leadingContextLineCount); } @@ -257,6 +257,10 @@ module.exports = class RipgrepDirectorySearcher { args.push('--multiline'); } + if (options.includeHidden) { + args.push('--hidden'); + } + if (options.follow) { args.push('--follow'); } From 2b0e5b0c32483914e952c94455bb15b0f9628ee5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 5 Jun 2019 11:46:40 +0200 Subject: [PATCH 082/184] Split package tests more evenly across containers --- script/test | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/script/test b/script/test index 8f29a0c37..4383a67df 100755 --- a/script/test +++ b/script/test @@ -116,10 +116,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) { const testSubdir = ['spec', 'test'].find(subdir => fs.existsSync(path.join(repositoryPackagePath, subdir))) if (!testSubdir) { - packageTestSuites.push(function (callback) { - console.log(`Skipping tests for ${packageName} because no test folder was found`.bold.yellow) - callback(null, {exitCode: 0, step: `package-${packageName}`}) - }) + console.log(`No test folder found for package: ${packageName}`.yellow) continue } @@ -201,12 +198,14 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': + const PACKAGES_TO_TEST_IN_PARALLEL = 23 + if (process.env.ATOM_RUN_CORE_TESTS === 'true') { suites = [runCoreMainProcessTests, runCoreRenderProcessTests] } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') { - suites = packageTestSuites.slice(0, Math.floor(packageTestSuites.length / 2)) + suites = packageTestSuites.slice(0, PACKAGES_TO_TEST_IN_PARALLEL) } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') { - suites = packageTestSuites.slice(Math.floor(packageTestSuites.length / 2)) + suites = packageTestSuites.slice(PACKAGES_TO_TEST_IN_PARALLEL) } else { suites = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites) } From 587a4dd72d2c5a918d522bb5f3b30f413973df16 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 5 Jun 2019 14:10:01 +0200 Subject: [PATCH 083/184] Run main process tests during build step For some reason, one main process test fails when run in a different container than the one in which Atom was built. These tests are pretty quick, so their impact on parallelism should be negligible. --- script/test | 6 +++-- script/vsts/platforms/macos.yml | 48 ++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/script/test b/script/test index 4383a67df..882cc9a33 100755 --- a/script/test +++ b/script/test @@ -200,8 +200,10 @@ function testSuitesForPlatform (platform) { case 'darwin': const PACKAGES_TO_TEST_IN_PARALLEL = 23 - if (process.env.ATOM_RUN_CORE_TESTS === 'true') { - suites = [runCoreMainProcessTests, runCoreRenderProcessTests] + if (process.env.ATOM_RUN_CORE_MAIN_TESTS === 'true') { + suites = [runCoreMainProcessTests] + } else if (process.env.ATOM_RUN_CORE_RENDERER_TESTS === 'true') { + suites = [runCoreRenderProcessTests] } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') { suites = packageTestSuites.slice(0, PACKAGES_TO_TEST_IN_PARALLEL) } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') { diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 253b22203..af93ce1d5 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -62,6 +62,46 @@ jobs: ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN) ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) + - script: | + osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver + caffeinate -s script/test # Run with caffeinate to prevent screen saver + env: + CI: true + CI_PROVIDER: VSTS + ATOM_JASMINE_REPORTER: list + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + ATOM_RUN_CORE_MAIN_TESTS: true + displayName: Run main process tests + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) + + - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" + env: + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + displayName: Post-process test results + condition: ne(variables['Atom.SkipTests'], 'true') + + - task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + searchFolder: $(Common.TestResultsDirectory)/junit + testResultsFiles: "**/*.xml" + mergeTestResults: true + testRunTitle: MacOS + condition: ne(variables['Atom.SkipTests'], 'true') + + - script: | + mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports + cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports + displayName: Stage Crash Reports + condition: failed() + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports + ArtifactName: crash-reports.zip + displayName: Upload Crash Reports + condition: failed() + - script: | cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) displayName: Stage Artifacts @@ -100,13 +140,13 @@ jobs: maxParallel: 3 matrix: core: - RunCoreTests: true + RunCoreRendererTests: true RunPackageTests: false packages-1: - RunCoreTests: false + RunCoreRendererTests: false RunPackageTests: 1 packages-2: - RunCoreTests: false + RunCoreRendererTests: false RunPackageTests: 2 steps: @@ -148,7 +188,7 @@ jobs: CI_PROVIDER: VSTS ATOM_JASMINE_REPORTER: list TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - ATOM_RUN_CORE_TESTS: $(RunCoreTests) + ATOM_RUN_CORE_RENDERER_TESTS: $(RunCoreRendererTests) ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests) displayName: Run tests condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) From 8c80d13dd15574f37b9142a4a12ac0b45baa7124 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 5 Jun 2019 12:29:51 +0200 Subject: [PATCH 084/184] Remove logic to prepend wildcard on globs That logic was only needed to make `ripgrep` match correctly globs like `src` when we pass it the folder to search on. If we don't pass the folder, `ripgrep` assumes it's the cwd and their glob matching logic improves by allowing globs like `src`. --- spec/workspace-spec.js | 47 ++++++++++++++++++++++++++++++- src/ripgrep-directory-searcher.js | 8 ++---- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 034b8d706..7d0c2e310 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2742,7 +2742,7 @@ describe('Workspace', () => { expect(resultHandler).not.toHaveBeenCalled(); }); - it('does not excludes ignored files when core.excludeVcsIgnoredPaths is false', async () => { + it('does not exclude ignored files when core.excludeVcsIgnoredPaths is false', async () => { atom.project.setPaths([projectPath]); atom.config.set('core.excludeVcsIgnoredPaths', false); const resultHandler = jasmine.createSpy('result found'); @@ -2753,6 +2753,51 @@ describe('Workspace', () => { path.join(projectPath, 'ignored.txt') ); }); + + it('does not exclude files when searching on an ignored folder even when core.excludeVcsIgnoredPaths is true', async () => { + fs.mkdirSync(path.join(projectPath, 'poop')); + ignoredPath = path.join( + path.join(projectPath, 'poop', 'whatever.txt') + ); + fs.writeFileSync(ignoredPath, 'this match should be included'); + + atom.project.setPaths([projectPath]); + atom.config.set('core.excludeVcsIgnoredPaths', true); + const resultHandler = jasmine.createSpy('result found'); + + await scan(/match/, { paths: ['poop'] }, ({ filePath }) => + resultHandler(filePath) + ); + + expect(resultHandler).toHaveBeenCalledWith(ignoredPath); + }); + + // This is a current limitation of the ripgrep scanner: whenever it finds a folder + // ignored by the vcs, it stops there and it does not try to traverse their subfolders. + if (!ripgrep) { + it('does not exclude files when searching on an ignored subfolder even when core.excludeVcsIgnoredPaths is true', async () => { + fs.mkdirSync(path.join(projectPath, 'poop')); + fs.mkdirSync(path.join(projectPath, 'poop', 'subfolder')); + ignoredPath = path.join( + path.join(projectPath, 'poop', 'subfolder', 'whatever.txt') + ); + fs.writeFileSync(ignoredPath, 'this match should be included'); + + atom.project.setPaths([projectPath]); + atom.config.set('core.excludeVcsIgnoredPaths', true); + const resultHandler = jasmine.createSpy('result found'); + + await scan( + /match/, + { + paths: ['poop/subfolder'] + }, + ({ filePath }) => resultHandler(filePath) + ); + + expect(resultHandler).toHaveBeenCalledWith(ignoredPath); + }); + } }); describe('when the core.followSymlinks config is used', () => { diff --git a/src/ripgrep-directory-searcher.js b/src/ripgrep-directory-searcher.js index bb1bee159..47586c537 100644 --- a/src/ripgrep-directory-searcher.js +++ b/src/ripgrep-directory-searcher.js @@ -269,10 +269,8 @@ module.exports = class RipgrepDirectorySearcher { args.push('--no-ignore-vcs'); } - args.push(directoryPath); - const child = spawn(this.rgPath, args, { - cwd: directory.getPath(), + cwd: directoryPath, stdio: ['pipe', 'pipe', 'pipe'] }); @@ -313,7 +311,7 @@ module.exports = class RipgrepDirectorySearcher { if (message.type === 'begin') { pendingEvent = { - filePath: getText(message.data.path), + filePath: path.join(directoryPath, getText(message.data.path)), matches: [] }; pendingLeadingContext = []; @@ -391,8 +389,6 @@ module.exports = class RipgrepDirectorySearcher { pattern = pattern.slice(0, -1); } - pattern = pattern.startsWith('**/') ? pattern : `**/${pattern}`; - output.push(pattern); output.push(pattern.endsWith('/**') ? pattern : `${pattern}/**`); } From 2d455ac5ee6b566ff982c514e87cecfa6f4dfeec Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 5 Jun 2019 16:08:30 +0200 Subject: [PATCH 085/184] Use '.' as the directory for ripgrep to scan This misteriously solves issues in Windows. --- src/ripgrep-directory-searcher.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ripgrep-directory-searcher.js b/src/ripgrep-directory-searcher.js index 47586c537..f538f6d17 100644 --- a/src/ripgrep-directory-searcher.js +++ b/src/ripgrep-directory-searcher.js @@ -269,6 +269,8 @@ module.exports = class RipgrepDirectorySearcher { args.push('--no-ignore-vcs'); } + args.push('.'); + const child = spawn(this.rgPath, args, { cwd: directoryPath, stdio: ['pipe', 'pipe', 'pipe'] From c3f57146cc77f523298c4647f3e5e88fe164e1e4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 5 Jun 2019 15:29:33 -0600 Subject: [PATCH 086/184] :arrow_up: find-and-replace@0.218.12 --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae551150f..23af471ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2873,8 +2873,8 @@ } }, "find-and-replace": { - "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.11/tarball", - "integrity": "sha512-STNDeRCSXCV5YjfrWbS5X4TfOFnNX7Z1k96POk3uPoPN8aQvkAIUflT7h6p0MClR9E2/I2O7nYKbYzNqBflZ6Q==", + "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.12/tarball", + "integrity": "sha512-ykte8V/n4L+kLrm1tXK0SODYLtPa9go9O0GOoOC5JOhErYMnTP9MRSygUug1bDkiyWOJ2brYrua4abSz/GPajA==", "requires": { "binary-search": "^1.3.3", "element-resize-detector": "^1.1.10", diff --git a/package.json b/package.json index 500331fd0..bb9e9ec62 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "etch": "^0.12.6", "event-kit": "^2.5.3", "exception-reporting": "file:packages/exception-reporting", - "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.11/tarball", + "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.12/tarball", "find-parent-dir": "^0.3.0", "first-mate": "7.3.0", "focus-trap": "2.4.5", @@ -200,7 +200,7 @@ "dev-live-reload": "file:./packages/dev-live-reload", "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", - "find-and-replace": "0.218.11", + "find-and-replace": "0.218.12", "fuzzy-finder": "1.13.7", "github": "0.29.0", "git-diff": "file:./packages/git-diff", From d66de4f0ff63c28b3dfdef8822b5316423bb6a41 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 5 Jun 2019 16:01:10 -0600 Subject: [PATCH 087/184] :arrow_up: text-buffer@13.16.1-0 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23af471ae..cbc073dea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6551,9 +6551,9 @@ } }, "text-buffer": { - "version": "13.16.0", - "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.0.tgz", - "integrity": "sha512-J00KcJDKvV87I/4o7F6LYu+2/fzmuEb7liBbZsIeCUM+T0kwqW7k0R7ddyk9EJR2Nqq7asng2/hVIBNYldIfEg==", + "version": "13.16.1-0", + "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.1-0.tgz", + "integrity": "sha512-kMuN/Y7d3tkQpjksGBdgK3xsExqzWVBJPCRDfDWhDIY7WD9/ymwyZfisN3dw6l1lsd6fHZmJtXp+rnBHfKOnVA==", "requires": { "delegato": "^1.0.0", "diff": "^2.2.1", diff --git a/package.json b/package.json index bb9e9ec62..7f628a567 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.2/tarball", "tabs": "https://www.atom.io/api/packages/tabs/versions/0.110.0/tarball", "temp": "^0.9.0", - "text-buffer": "13.16.0", + "text-buffer": "13.16.1-0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", "tree-sitter": "0.15.0", "tree-sitter-css": "^0.13.7", From e0e004604df0c54c0f7d6b16ba37618ec77fa7af Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 6 Jun 2019 10:23:28 +0200 Subject: [PATCH 088/184] Don't listen for arguments from new processes in test or benchmarks --- src/main-process/atom-application.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index fde5b2498..ada5e3ac2 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -283,7 +283,12 @@ module.exports = class AtomApplication extends EventEmitter { // We need to do this because `listenForArgumentsFromNewProcess()` calls `crypto.randomBytes`, // which is really slow on Windows machines. // (TodoElectronIssue: This got fixed in electron v3: https://github.com/electron/electron/issues/2073). - const socketServerPromise = this.listenForArgumentsFromNewProcess(options); + let socketServerPromise + if (options.test || options.benchmark || options.benchmarkTest) { + socketServerPromise = Promise.resolve() + } else { + socketServerPromise = this.listenForArgumentsFromNewProcess() + } this.setupDockMenu(); @@ -505,12 +510,10 @@ module.exports = class AtomApplication extends EventEmitter { // You can run the atom command multiple times, but after the first launch // the other launches will just pass their information to this server and then // close immediately. - async listenForArgumentsFromNewProcess(options) { - if (!options.test && !options.benchmark && !options.benchmarkTest) { - this.socketSecretPromise = createSocketSecret(this.version); - this.socketSecret = await this.socketSecretPromise; - this.socketPath = getSocketPath(this.socketSecret); - } + async listenForArgumentsFromNewProcess() { + this.socketSecretPromise = createSocketSecret(this.version); + this.socketSecret = await this.socketSecretPromise; + this.socketPath = getSocketPath(this.socketSecret); await this.deleteSocketFile(); From 67e101d2cdd3b2f52f80e2aa40b548c5fe3f7a44 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 6 Jun 2019 10:38:13 +0200 Subject: [PATCH 089/184] Fix linter errors --- src/main-process/atom-application.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index ada5e3ac2..097f0c0d6 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -283,11 +283,11 @@ module.exports = class AtomApplication extends EventEmitter { // We need to do this because `listenForArgumentsFromNewProcess()` calls `crypto.randomBytes`, // which is really slow on Windows machines. // (TodoElectronIssue: This got fixed in electron v3: https://github.com/electron/electron/issues/2073). - let socketServerPromise + let socketServerPromise; if (options.test || options.benchmark || options.benchmarkTest) { - socketServerPromise = Promise.resolve() + socketServerPromise = Promise.resolve(); } else { - socketServerPromise = this.listenForArgumentsFromNewProcess() + socketServerPromise = this.listenForArgumentsFromNewProcess(); } this.setupDockMenu(); From ac9be2d08285c5cbce5db5c5026964de1381280d Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 6 Jun 2019 14:02:27 +0200 Subject: [PATCH 090/184] Remove test that checks that we can search of a subfolder of an ignored folder This seems to not be working on Windows or with ripgrep, so it's not expected behaviour. --- spec/workspace-spec.js | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 7d0c2e310..0235883f4 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -2771,33 +2771,6 @@ describe('Workspace', () => { expect(resultHandler).toHaveBeenCalledWith(ignoredPath); }); - - // This is a current limitation of the ripgrep scanner: whenever it finds a folder - // ignored by the vcs, it stops there and it does not try to traverse their subfolders. - if (!ripgrep) { - it('does not exclude files when searching on an ignored subfolder even when core.excludeVcsIgnoredPaths is true', async () => { - fs.mkdirSync(path.join(projectPath, 'poop')); - fs.mkdirSync(path.join(projectPath, 'poop', 'subfolder')); - ignoredPath = path.join( - path.join(projectPath, 'poop', 'subfolder', 'whatever.txt') - ); - fs.writeFileSync(ignoredPath, 'this match should be included'); - - atom.project.setPaths([projectPath]); - atom.config.set('core.excludeVcsIgnoredPaths', true); - const resultHandler = jasmine.createSpy('result found'); - - await scan( - /match/, - { - paths: ['poop/subfolder'] - }, - ({ filePath }) => resultHandler(filePath) - ); - - expect(resultHandler).toHaveBeenCalledWith(ignoredPath); - }); - } }); describe('when the core.followSymlinks config is used', () => { From dd40782166f95b5179b67cf8d0aa814e519616fd Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 6 Jun 2019 16:48:11 +0200 Subject: [PATCH 091/184] add delay to watch-path tests to make them less flaky --- spec/path-watcher-spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/path-watcher-spec.js b/spec/path-watcher-spec.js index a2a9a4e6d..5f97338b1 100644 --- a/spec/path-watcher-spec.js +++ b/spec/path-watcher-spec.js @@ -7,6 +7,7 @@ import { promisify } from 'util'; import { CompositeDisposable } from 'event-kit'; import { watchPath, stopAllWatchers } from '../src/path-watcher'; +import { timeoutPromise } from './async-spec-helpers'; temp.track(); @@ -21,6 +22,7 @@ describe('watchPath', function() { let subs; beforeEach(function() { + jasmine.useRealClock(); subs = new CompositeDisposable(); }); @@ -109,6 +111,12 @@ describe('watchPath', function() { waitForChanges(rootWatcher, subFile), waitForChanges(childWatcher, subFile) ]); + + // In Windows64, in some situations nsfw (the currently default watcher) + // does not trigger the change events if they happen just after start watching, + // so we need to wait some time. More info: https://github.com/atom/atom/issues/19442 + await timeoutPromise(300); + await writeFile(subFile, 'subfile\n', { encoding: 'utf8' }); await firstChanges; @@ -156,6 +164,11 @@ describe('watchPath', function() { expect(subWatcher0.native).toBe(parentWatcher.native); expect(subWatcher1.native).toBe(parentWatcher.native); + // In Windows64, in some situations nsfw (the currently default watcher) + // does not trigger the change events if they happen just after start watching, + // so we need to wait some time. More info: https://github.com/atom/atom/issues/19442 + await timeoutPromise(300); + // Ensure events are filtered correctly await Promise.all([ appendFile(rootFile, 'change\n', { encoding: 'utf8' }), From 6a88fa4185303bbee2191d15ce97d4d4c59a75e5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 6 Jun 2019 17:11:01 +0200 Subject: [PATCH 092/184] Don't symlink compile-cache folder in AtomWindow tests In these tests, we create a temporary `ATOM_HOME` to avoid cluttering the user's real `~/.atom` folder. Adding a symlink to the real `compile-cache` was introduced to speed up main process tests, so that the transpilation cache could be reused. Unfortunately, when the real `~/.atom` folder did not exist (such as on a pristine environment on CI), it would confuse Atom, which would think that it didn't need to re-create a `compile-cache` folder again, but wouldn't be able to write to it because the symlink pointed to a non-existant directory. Main process tests were overhauled and made faster recently, so we can safely remove this performance optimization. --- script/test | 6 ++-- script/vsts/platforms/macos.yml | 48 +++------------------------ spec/main-process/atom-window.test.js | 15 --------- 3 files changed, 6 insertions(+), 63 deletions(-) diff --git a/script/test b/script/test index 882cc9a33..4383a67df 100755 --- a/script/test +++ b/script/test @@ -200,10 +200,8 @@ function testSuitesForPlatform (platform) { case 'darwin': const PACKAGES_TO_TEST_IN_PARALLEL = 23 - if (process.env.ATOM_RUN_CORE_MAIN_TESTS === 'true') { - suites = [runCoreMainProcessTests] - } else if (process.env.ATOM_RUN_CORE_RENDERER_TESTS === 'true') { - suites = [runCoreRenderProcessTests] + if (process.env.ATOM_RUN_CORE_TESTS === 'true') { + suites = [runCoreMainProcessTests, runCoreRenderProcessTests] } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') { suites = packageTestSuites.slice(0, PACKAGES_TO_TEST_IN_PARALLEL) } else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') { diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index af93ce1d5..253b22203 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -62,46 +62,6 @@ jobs: ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN) ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) - - script: | - osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver - caffeinate -s script/test # Run with caffeinate to prevent screen saver - env: - CI: true - CI_PROVIDER: VSTS - ATOM_JASMINE_REPORTER: list - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - ATOM_RUN_CORE_MAIN_TESTS: true - displayName: Run main process tests - condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - - - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" - env: - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - displayName: Post-process test results - condition: ne(variables['Atom.SkipTests'], 'true') - - - task: PublishTestResults@2 - inputs: - testResultsFormat: JUnit - searchFolder: $(Common.TestResultsDirectory)/junit - testResultsFiles: "**/*.xml" - mergeTestResults: true - testRunTitle: MacOS - condition: ne(variables['Atom.SkipTests'], 'true') - - - script: | - mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports - cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports - displayName: Stage Crash Reports - condition: failed() - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports - ArtifactName: crash-reports.zip - displayName: Upload Crash Reports - condition: failed() - - script: | cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) displayName: Stage Artifacts @@ -140,13 +100,13 @@ jobs: maxParallel: 3 matrix: core: - RunCoreRendererTests: true + RunCoreTests: true RunPackageTests: false packages-1: - RunCoreRendererTests: false + RunCoreTests: false RunPackageTests: 1 packages-2: - RunCoreRendererTests: false + RunCoreTests: false RunPackageTests: 2 steps: @@ -188,7 +148,7 @@ jobs: CI_PROVIDER: VSTS ATOM_JASMINE_REPORTER: list TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - ATOM_RUN_CORE_RENDERER_TESTS: $(RunCoreRendererTests) + ATOM_RUN_CORE_TESTS: $(RunCoreTests) ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests) displayName: Run tests condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) diff --git a/spec/main-process/atom-window.test.js b/spec/main-process/atom-window.test.js index 2f38624b8..939c23fbf 100644 --- a/spec/main-process/atom-window.test.js +++ b/spec/main-process/atom-window.test.js @@ -77,21 +77,6 @@ describe('AtomWindow', function() { ); }); - await new Promise((resolve, reject) => { - fs.symlink( - path.join(original.ATOM_HOME, 'compile-cache'), - path.join(atomHome, 'compile-cache'), - 'junction', - err => { - if (err) { - reject(err); - } else { - resolve(); - } - } - ); - }); - process.env.ATOM_HOME = atomHome; process.env.ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT = 'true'; }); From 6bb0e085b16dcf3945ceb1d5db851966e34ae192 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 6 Jun 2019 09:53:29 -0600 Subject: [PATCH 093/184] :arrow_up: text-buffer@13.16.1 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index cbc073dea..c685f65c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6551,9 +6551,9 @@ } }, "text-buffer": { - "version": "13.16.1-0", - "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.1-0.tgz", - "integrity": "sha512-kMuN/Y7d3tkQpjksGBdgK3xsExqzWVBJPCRDfDWhDIY7WD9/ymwyZfisN3dw6l1lsd6fHZmJtXp+rnBHfKOnVA==", + "version": "13.16.1", + "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.1.tgz", + "integrity": "sha512-/P3D92KLtyrB+P+cc2W7i8jOEw6/1l72tblKobECCXOxkmJJuEqzyt7Kdw9RySJwQYIh9YRllksQ7IQJOp+XeA==", "requires": { "delegato": "^1.0.0", "diff": "^2.2.1", diff --git a/package.json b/package.json index 7f628a567..a6a42ac3b 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.2/tarball", "tabs": "https://www.atom.io/api/packages/tabs/versions/0.110.0/tarball", "temp": "^0.9.0", - "text-buffer": "13.16.1-0", + "text-buffer": "13.16.1", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", "tree-sitter": "0.15.0", "tree-sitter-css": "^0.13.7", From 1d3d9a167ca352874df7b2f0efb70d9203679149 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 6 Jun 2019 19:07:27 +0200 Subject: [PATCH 094/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20spell-check@0.75.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 49 +++++++++++++++++++++++++++-------------------- package.json | 4 ++-- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index c685f65c5..764277dd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4425,15 +4425,15 @@ "integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=" }, "log4js": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-4.1.0.tgz", - "integrity": "sha512-eDa+zZPeVEeK6QGJAePyXM6pg4P3n3TO5rX9iZMVY48JshsTyLJZLIL5HipI1kQ2qLsSyOpUqNND/C5H4WhhiA==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-4.3.1.tgz", + "integrity": "sha512-nPGS7w7kBnzNm1j8JycFxwLCbIMae8tHCo0cCdx/khB20Tcod8SZThYEB9E0c27ObcTGA1mlPowaf3hantQ/FA==", "requires": { "date-format": "^2.0.0", "debug": "^4.1.1", "flatted": "^2.0.0", "rfdc": "^1.1.2", - "streamroller": "^1.0.4" + "streamroller": "^1.0.5" }, "dependencies": { "debug": { @@ -5740,9 +5740,9 @@ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" }, "rfdc": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.2.tgz", - "integrity": "sha512-92ktAgvZhBzYTIK0Mja9uen5q5J3NRVMoDkJL2VMwq6SXjVCgqvQeVP2XAaUY6HT+XpQYeLSjb3UoitBryKmdA==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" }, "right-align": { "version": "0.1.3", @@ -6156,25 +6156,32 @@ "integrity": "sha1-enzShHDMbToc/m1miG9rxDDTrIc=" }, "spell-check": { - "version": "https://www.atom.io/api/packages/spell-check/versions/0.74.5/tarball", - "integrity": "sha512-U6ne5vz5DHrfgL6noxuExAiM/UaBf0YrOq6PFkqH99g8FOlunJr6gz/YR1xur08UJuW5moVJTXjivzOt2VFboQ==", + "version": "https://www.atom.io/api/packages/spell-check/versions/0.75.0/tarball", + "integrity": "sha512-VhsBZE5Tj/Ffk9cjSSnZ8RJYLewB7WwP7RVcyo6SnXEqbIaYLCDoXQWsSjyLnEEeahMrVSISPIkycxN+sNyeFw==", "requires": { "atom-pathspec": "^0.0.0", "atom-select-list": "^0.7.0", "multi-integer-range": "^2.0.0", "natural": "^0.4.0", - "spellchecker": "^3.5.3", + "spellchecker": "^3.6.0", "spelling-manager": "^1.1.0", "underscore-plus": "^1" } }, "spellchecker": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/spellchecker/-/spellchecker-3.5.3.tgz", - "integrity": "sha512-Wx5LxzRgNCggBkuzj5MvqrUn3souo9pKRTvOqnQUyKcgX2gntk5E9j6tk/OE0danG6G7IgOWIRrgmcQZs19YJw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/spellchecker/-/spellchecker-3.6.0.tgz", + "integrity": "sha512-aGt8FEaFONTlo/IvDXbUvzN39NizCqkYS+MoQP8THy+Ocf1+OCfnG6QwrZwWxfrd8l06nxuc15icNiP8/ol/GA==", "requires": { "any-promise": "^1.3.0", - "nan": "^2.10.0" + "nan": "^2.14.0" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + } } }, "spelling-manager": { @@ -6270,15 +6277,15 @@ } }, "streamroller": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-1.0.4.tgz", - "integrity": "sha512-Wc2Gm5ygjSX8ZpW9J7Y9FwiSzTlKSvcl0FTTMd3rn7RoxDXpBW+xD9TY5sWL2n0UR61COB0LG1BQvN6nTUQbLQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-1.0.5.tgz", + "integrity": "sha512-iGVaMcyF5PcUY0cPbW3xFQUXnr9O4RZXNBBjhuLZgrjLO4XCLLGfx4T2sGqygSeylUjwgWRsnNbT9aV0Zb8AYw==", "requires": { - "async": "^2.6.1", + "async": "^2.6.2", "date-format": "^2.0.0", - "debug": "^3.1.0", - "fs-extra": "^7.0.0", - "lodash": "^4.17.10" + "debug": "^3.2.6", + "fs-extra": "^7.0.1", + "lodash": "^4.17.11" }, "dependencies": { "async": { diff --git a/package.json b/package.json index a6a42ac3b..0b66949b5 100644 --- a/package.json +++ b/package.json @@ -149,7 +149,7 @@ "snippets": "https://www.atom.io/api/packages/snippets/versions/1.5.0/tarball", "solarized-dark-syntax": "file:packages/solarized-dark-syntax", "solarized-light-syntax": "file:packages/solarized-light-syntax", - "spell-check": "https://www.atom.io/api/packages/spell-check/versions/0.74.5/tarball", + "spell-check": "https://www.atom.io/api/packages/spell-check/versions/0.75.0/tarball", "status-bar": "https://www.atom.io/api/packages/status-bar/versions/1.8.17/tarball", "styleguide": "https://www.atom.io/api/packages/styleguide/versions/0.49.12/tarball", "symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.2/tarball", @@ -218,7 +218,7 @@ "package-generator": "1.3.0", "settings-view": "0.261.3", "snippets": "1.5.0", - "spell-check": "0.74.5", + "spell-check": "0.75.0", "status-bar": "1.8.17", "styleguide": "0.49.12", "symbols-view": "0.118.2", From d9842cf64692021bca5cd767b2c5a86f7b401821 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 6 Jun 2019 17:06:27 +0200 Subject: [PATCH 095/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20nslog@3.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 15 +++++++++++---- package.json | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c685f65c5..c654db750 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5011,11 +5011,18 @@ } }, "nslog": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/nslog/-/nslog-3.0.0.tgz", - "integrity": "sha1-nvfjpGveHnVyRFQcyhP/K2dvexk=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nslog/-/nslog-3.2.0.tgz", + "integrity": "sha512-3J5XPvodzhRpy0S7DIuxzQ16e70XZ8gS7MTvA70PiEFG9iZBv8XFABsyZDphO/62b/kEPkgPpoAbQvZprqLhOQ==", "requires": { - "nan": "^2.0.0" + "nan": "^2.14.0" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + } } }, "nth-check": { diff --git a/package.json b/package.json index a6a42ac3b..add3a545e 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "mock-spawn": "^0.2.6", "normalize-package-data": "^2.0.0", "notifications": "https://www.atom.io/api/packages/notifications/versions/0.70.6/tarball", - "nslog": "^3", + "nslog": "^3.0.0", "one-dark-syntax": "file:packages/one-dark-syntax", "one-dark-ui": "file:packages/one-dark-ui", "one-light-syntax": "file:packages/one-light-syntax", From e0ce24b17bd124ff04525780f7c94251a4e2993f Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 6 Jun 2019 23:23:20 +0200 Subject: [PATCH 096/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20first-mate@7.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index c685f65c5..2fdc4ef38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2911,15 +2911,15 @@ "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=" }, "first-mate": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/first-mate/-/first-mate-7.3.0.tgz", - "integrity": "sha512-fFtMzSR3cw90LAWhuzaCbxpfGXNCQsROi+KLL1HXatog/ivfLNTZEWjB+lxmH9mdUUqJn6LGitu6P9w9SvePjQ==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/first-mate/-/first-mate-7.4.0.tgz", + "integrity": "sha512-LCkK0ZkcHpdlKMyIKPib3/e5Uj7Mqw5XU8FSE1Of5x3RQx8YRdXr8ElRqNS0aCgOSjgpgnubek3VoapxAcWh+g==", "requires": { "emissary": "^1", "event-kit": "^2.2.0", "fs-plus": "^3.0.0", "grim": "^2.0.1", - "oniguruma": "7.1.0", + "oniguruma": "7.2.0", "season": "^6.0.2", "underscore-plus": "^1" }, @@ -5068,17 +5068,17 @@ "version": "file:packages/one-light-ui" }, "oniguruma": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-7.1.0.tgz", - "integrity": "sha512-mV+6HcDNQ38vM8HVKM+MJyXO4EtSigwIZhq023A4rA8Am4dMlGhUkPwudDykExYR45oLrssR/Ep7PZCQ1OM3pA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-7.2.0.tgz", + "integrity": "sha512-bh+ZLdykY1sdIx8jBp2zpLbVFDBc3XmKH4Ceo2lijNaN1WhEqtnpqFlmtCbRuDB17nJ58RAUStVwfW8e8uEbnA==", "requires": { - "nan": "^2.12.1" + "nan": "^2.14.0" }, "dependencies": { "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, diff --git a/package.json b/package.json index a6a42ac3b..f0bde669f 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "exception-reporting": "file:packages/exception-reporting", "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.12/tarball", "find-parent-dir": "^0.3.0", - "first-mate": "7.3.0", + "first-mate": "7.4.0", "focus-trap": "2.4.5", "fs-admin": "^0.1.7", "fs-plus": "^3.1.1", From ee0ddaa1d81be0f4b618f2d0bb11a9681c4add26 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 7 Jun 2019 09:33:09 +0200 Subject: [PATCH 097/184] Run each test suite with a pristine ATOM_HOME directory This ensures that every test suite does not clutter subsequent ones. It will also prevent altering the user's `~/.atom` directory when running tests locally. --- script/test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/test b/script/test index 4383a67df..5f27da4f4 100755 --- a/script/test +++ b/script/test @@ -39,6 +39,7 @@ const childProcess = require('child_process') const fs = require('fs-extra') const glob = require('glob') const path = require('path') +const temp = require('temp').track() const CONFIG = require('./config') const backupNodeModules = require('./lib/backup-node-modules') @@ -63,7 +64,8 @@ if (process.platform === 'darwin') { } function prepareEnv (suiteName) { - const env = Object.assign({}, process.env) + const atomHomeDirPath = temp.mkdirSync(suiteName) + const env = Object.assign({}, process.env, {ATOM_HOME: atomHomeDirPath}) if (process.env.TEST_JUNIT_XML_ROOT) { // Tell Jasmine to output this suite's results as a JUnit XML file to a subdirectory of the root, so that a From 2cc01def2a9d9cc8b1475cd7113eba5ae3b48cdb Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 7 Jun 2019 11:26:40 +0100 Subject: [PATCH 098/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20metrics@1.8.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 12 ++++++------ package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c685f65c5..0b69889cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4662,12 +4662,12 @@ } }, "metrics": { - "version": "https://www.atom.io/api/packages/metrics/versions/1.8.0/tarball", - "integrity": "sha512-agWghp4huKZknDrkw2EeRxwIPSwBiofTTd2o/kXXnek8FGqghvZe8QEpHGTSYAqg5FqdwREExQfxNBWG6HmnMA==", + "version": "https://www.atom.io/api/packages/metrics/versions/1.8.1/tarball", + "integrity": "sha512-3yMZVI3eOixkeVORM0psQ1Hr7aooLBBwNGgIrIo59SQytLorj/7VYLCTaaYW1hup5m3fcU8vKlrGBj+UNfGJbA==", "requires": { "fs-plus": "^3.0.0", "grim": "^2.0.1", - "telemetry-github": "0.1.0" + "telemetry-github": "0.1.1" }, "dependencies": { "grim": { @@ -6526,9 +6526,9 @@ } }, "telemetry-github": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/telemetry-github/-/telemetry-github-0.1.0.tgz", - "integrity": "sha512-rD9u8U9r33262FkSKYAunWm008GpRXIjGMgTYi2EsyvG9xrlAYgi0qiZ4Enb9DIvIOruNxUxjerZEok9NSfB1Q==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/telemetry-github/-/telemetry-github-0.1.1.tgz", + "integrity": "sha512-UUtkNKKHpUthL4FsAJDqKg+TiW0DBI636XAOAA3qcu86m20DhLhn3qhxl12joGdPBtk0tbv/Dx47pj28ZhuF+g==", "requires": { "idb": "^4.0.3", "lokijs": "^1.5.4", diff --git a/package.json b/package.json index a6a42ac3b..e993c18fc 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "link": "file:packages/link", "markdown-preview": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.0/tarball", "marked": "^0.3.12", - "metrics": "https://www.atom.io/api/packages/metrics/versions/1.8.0/tarball", + "metrics": "https://www.atom.io/api/packages/metrics/versions/1.8.1/tarball", "minimatch": "^3.0.3", "mocha": "2.5.1", "mocha-junit-reporter": "^1.13.0", @@ -212,7 +212,7 @@ "line-ending-selector": "file:./packages/line-ending-selector", "link": "file:./packages/link", "markdown-preview": "0.160.0", - "metrics": "1.8.0", + "metrics": "1.8.1", "notifications": "0.70.6", "open-on-github": "1.3.1", "package-generator": "1.3.0", From 1c0b7741cf2a4ca3f4490a1f85e0b8ccad6222cb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 7 Jun 2019 11:41:45 -0600 Subject: [PATCH 099/184] :arrow_up: text-buffer@13.16.2 --- package-lock.json | 16 ++++++++++++---- package.json | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0b69889cd..cd79aaa3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6551,9 +6551,9 @@ } }, "text-buffer": { - "version": "13.16.1", - "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.1.tgz", - "integrity": "sha512-/P3D92KLtyrB+P+cc2W7i8jOEw6/1l72tblKobECCXOxkmJJuEqzyt7Kdw9RySJwQYIh9YRllksQ7IQJOp+XeA==", + "version": "13.16.2", + "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.2.tgz", + "integrity": "sha512-4cTQqOe/rH8WVRiBOYyv8zigrdsKaArOZi0Xba3IjAG+cw2Hu8pJJPdfvGSMnsiJCZeRQvN4Yvsi0P9T8/odwQ==", "requires": { "delegato": "^1.0.0", "diff": "^2.2.1", @@ -6565,7 +6565,7 @@ "mkdirp": "^0.5.1", "pathwatcher": "8.0.2", "serializable": "^1.0.3", - "superstring": "2.3.6", + "superstring": "2.4.0", "underscore-plus": "^1.0.0" }, "dependencies": { @@ -6594,6 +6594,14 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "superstring": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/superstring/-/superstring-2.4.0.tgz", + "integrity": "sha512-dg1jpBBvxL2pBpCkTfAABYj0AXcVC05wQ2CHz/AVY786BC9wwzgZmkbjVQ2s/PI9Se9QMRwURJ2UE3MF4EygOg==", + "requires": { + "nan": "^2.10.0" + } } } }, diff --git a/package.json b/package.json index e993c18fc..2e073c7e9 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.2/tarball", "tabs": "https://www.atom.io/api/packages/tabs/versions/0.110.0/tarball", "temp": "^0.9.0", - "text-buffer": "13.16.1", + "text-buffer": "13.16.2", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", "tree-sitter": "0.15.0", "tree-sitter-css": "^0.13.7", From 288c65342bb05b956c4ca1631892616e90c60713 Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 7 Jun 2019 16:46:51 -0500 Subject: [PATCH 100/184] 1.40.0-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e993c18fc..ce45c3be7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.39.0-dev", + "version": "1.40.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/main-process/main.js", "repository": { From 30ef5fb8fc409f739cc5a92f2e4b05f80c3384d4 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 10 Jun 2019 15:32:26 +0200 Subject: [PATCH 101/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20autocomplete-plus@?= =?UTF-8?q?2.42.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 558b6c131..9a4c47c70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "atom", - "version": "1.39.0-dev", + "version": "1.40.0-dev", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1358,8 +1358,8 @@ "integrity": "sha512-AHEZOz7RcIdPWlGQByHGUE9yVhn1O9qJQRHehvkN8riiUyJpNpaImk7dloH8Nw/JX14tKJhjT+EadY2u/+j7IQ==" }, "autocomplete-plus": { - "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.0/tarball", - "integrity": "sha512-6DvqS4z8JR8kLLPKImGX5pZlc67SWr6JUpIJAH++gYmWZDu5kshqvsDnnuWjRtA1tCZpNW4e/mN/hQcHyuuOVA==", + "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.1/tarball", + "integrity": "sha512-ac1BOdUPPJ9di5wTMrCZupv2TRhhhaeO7dPyJdU3v8jIWGGf/R/ros0o5pje/gyNuZ7sEVGWiWSMNiQc3kuXWA==", "requires": { "atom-slick": "^2.0.0", "dompurify": "^1.0.8", @@ -1374,9 +1374,9 @@ }, "dependencies": { "dompurify": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-1.0.8.tgz", - "integrity": "sha512-vetRFbN1SXSPfP3ClIiYnxTrXquSqakBEOoB5JESn0SVcSYzpu6ougjakpKnskGctYdlNpwf+riUHSkG7d4XUw==" + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-1.0.10.tgz", + "integrity": "sha512-huhl3DSWX5LaA7jDtnj3XQdJgWW1wYouNW7N0drGzQa4vEUSVWyeFN+Atx6HP4r5cang6oQytMom6I4yhGJj5g==" }, "grim": { "version": "2.0.2", @@ -1387,9 +1387,9 @@ } }, "marked": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.1.tgz", - "integrity": "sha512-iUkBZegCZou4AdwbKTwSW/lNDcz5OuRSl3qdcl31Ia0B2QPG0Jn+tKblh/9/eP9/6+4h27vpoh8wel/vQOV0vw==" + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.2.tgz", + "integrity": "sha512-fdZvBa7/vSQIZCi4uuwo2N3q+7jJURpMVCcbaX0S1Mg65WZ5ilXvC67MviJAsdjqqgD+CEq4RKo5AYGgINkVAA==" } } }, diff --git a/package.json b/package.json index 492832192..8cb5ff0ca 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "autocomplete-atom-api": "https://www.atom.io/api/packages/autocomplete-atom-api/versions/0.10.7/tarball", "autocomplete-css": "https://www.atom.io/api/packages/autocomplete-css/versions/0.17.5/tarball", "autocomplete-html": "https://www.atom.io/api/packages/autocomplete-html/versions/0.8.8/tarball", - "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.0/tarball", + "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.1/tarball", "autocomplete-snippets": "https://www.atom.io/api/packages/autocomplete-snippets/versions/1.12.1/tarball", "autoflow": "file:packages/autoflow", "autosave": "https://www.atom.io/api/packages/autosave/versions/0.24.6/tarball", @@ -187,7 +187,7 @@ "autocomplete-atom-api": "0.10.7", "autocomplete-css": "0.17.5", "autocomplete-html": "0.8.8", - "autocomplete-plus": "2.42.0", + "autocomplete-plus": "2.42.1", "autocomplete-snippets": "1.12.1", "autoflow": "file:./packages/autoflow", "autosave": "0.24.6", From eeb82119ba32d06ae6d891f134bf7bdd388f1a20 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 10 Jun 2019 15:35:35 -0500 Subject: [PATCH 102/184] :arrow_up: markdown-preview@0.160.2 --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a4c47c70..bafee2fe3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1088,9 +1088,9 @@ } }, "@types/node": { - "version": "11.13.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.7.tgz", - "integrity": "sha512-suFHr6hcA9mp8vFrZTgrmqW2ZU3mbWsryQtQlY/QvwTISCw7nw/j+bCQPPohqmskhmqa5wLNuMHTTsc+xf1MQg==" + "version": "12.0.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.7.tgz", + "integrity": "sha512-1YKeT4JitGgE4SOzyB9eMwO0nGVNkNEsm9qlIt1Lqm/tG2QEiSMTD4kS3aO6L+w5SClLVxALmIBESK6Mk5wX0A==" }, "CSSselect": { "version": "0.4.1", @@ -4543,8 +4543,8 @@ "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=" }, "markdown-preview": { - "version": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.0/tarball", - "integrity": "sha512-cCL5SAfHPRwFzfcQ3OO1I3wJ4VEuYsM4CkZh7WuHoMN7gupELlOokiwbGU0pJu12kWChAOAfDHq78dOKpYxadw==", + "version": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.2/tarball", + "integrity": "sha512-aJ9J7npcGWSPm2JApZ4KeS8EzZwigkDTDSd/ws1GRBCK8w5XcAMM5zjk4NlA+FJj4d4zH9dqYbjywlzCVgN+1A==", "requires": { "cheerio": "^1.0.0-rc.3", "dompurify": "^1.0.2", @@ -4635,9 +4635,9 @@ "integrity": "sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA==" }, "readable-stream": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", - "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", diff --git a/package.json b/package.json index 8cb5ff0ca..fff2c85f7 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "line-ending-selector": "file:packages/line-ending-selector", "line-top-index": "0.3.1", "link": "file:packages/link", - "markdown-preview": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.0/tarball", + "markdown-preview": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.2/tarball", "marked": "^0.3.12", "metrics": "https://www.atom.io/api/packages/metrics/versions/1.8.1/tarball", "minimatch": "^3.0.3", @@ -211,7 +211,7 @@ "keybinding-resolver": "0.39.0", "line-ending-selector": "file:./packages/line-ending-selector", "link": "file:./packages/link", - "markdown-preview": "0.160.0", + "markdown-preview": "0.160.2", "metrics": "1.8.1", "notifications": "0.70.6", "open-on-github": "1.3.1", From a17360bef8f03b7bff5b97da1afe2a5c825e58d4 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Mon, 10 Jun 2019 22:31:27 -0400 Subject: [PATCH 103/184] :arrow_up: language-json@1.0.3 for package-lock fix tree-sitter-json was resolving to a Git hash rather than the NPM registry --- package-lock.json | 11 ++++++----- package.json | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index bafee2fe3..7a9da7179 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4031,10 +4031,10 @@ } }, "language-json": { - "version": "https://www.atom.io/api/packages/language-json/versions/1.0.2/tarball", - "integrity": "sha512-2OvmYoTjO5IXnnRMVMfPb7iOMEnqD36otbpOpQUELG4eJJqgrms6Hs7HnevFs5ZB4yLc1ZU2u9h9TAp/WXUmdA==", + "version": "https://www.atom.io/api/packages/language-json/versions/1.0.3/tarball", + "integrity": "sha512-EQ34IMibK2hcchIWHOyu9pYZS9N+EFlYaw7YRZq0M7AJCIs/FSFLjbNxb+jRmBNqsfioL9bDWFh7lupLrK9Bnw==", "requires": { - "tree-sitter-json": "git://github.com/tree-sitter/tree-sitter-json.git#337f55be9b9b1ccb0baa7763bfe014a94acea7ea" + "tree-sitter-json": "^0.14.0" } }, "language-less": { @@ -6763,8 +6763,9 @@ } }, "tree-sitter-json": { - "version": "git://github.com/tree-sitter/tree-sitter-json.git#337f55be9b9b1ccb0baa7763bfe014a94acea7ea", - "from": "git://github.com/tree-sitter/tree-sitter-json.git#v0.14.0", + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/tree-sitter-json/-/tree-sitter-json-0.14.0.tgz", + "integrity": "sha512-vNNo/9Xq024WTCGjmBClCGkyxlOSHOve4cQ4o5yvc81Syqbna/4x2wZPacNYsVUJCq+jtUFexHLDWtI2RqPQMg==", "requires": { "nan": "^2.0.0" } diff --git a/package.json b/package.json index fff2c85f7..bad25a941 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "language-hyperlink": "https://www.atom.io/api/packages/language-hyperlink/versions/0.17.1/tarball", "language-java": "https://www.atom.io/api/packages/language-java/versions/0.31.3/tarball", "language-javascript": "https://www.atom.io/api/packages/language-javascript/versions/0.130.0/tarball", - "language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.2/tarball", + "language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.3/tarball", "language-less": "https://www.atom.io/api/packages/language-less/versions/0.34.3/tarball", "language-make": "https://www.atom.io/api/packages/language-make/versions/0.23.0/tarball", "language-mustache": "https://www.atom.io/api/packages/language-mustache/versions/0.14.5/tarball", @@ -241,7 +241,7 @@ "language-hyperlink": "0.17.1", "language-java": "0.31.3", "language-javascript": "0.130.0", - "language-json": "1.0.2", + "language-json": "1.0.3", "language-less": "0.34.3", "language-make": "0.23.0", "language-mustache": "0.14.5", From c532540d25e245e15435a24fa48c339251dc72cf Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Tue, 11 Jun 2019 00:19:40 -0400 Subject: [PATCH 104/184] :arrow_up: apm@2.3.0 to remove node-gyp logic --- apm/package-lock.json | 27 ++++++++++----------------- apm/package.json | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/apm/package-lock.json b/apm/package-lock.json index e4a1cd064..77c3b7e06 100644 --- a/apm/package-lock.json +++ b/apm/package-lock.json @@ -4,9 +4,9 @@ "lockfileVersion": 1, "dependencies": { "atom-package-manager": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/atom-package-manager/-/atom-package-manager-2.2.4.tgz", - "integrity": "sha512-Iyfs8FNPH+fDLm2DlzE+71TGGZt0fAO2fchJKUHbMLqxFPBPjOgigViQZxDhb2eBRYi2jLKkbalCa4m21Q8CRA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/atom-package-manager/-/atom-package-manager-2.3.0.tgz", + "integrity": "sha512-WI2HaA19A4rKyaNnaoOE7vIlHBiwXQGq+/Kw1Z38LARvYOuWi7BK2GX0cZYqi4I5Yh5elpxrl01M2QmL09saNg==", "requires": { "@atom/plist": "0.4.4", "asar-require": "0.3.0", @@ -834,19 +834,12 @@ } }, "keytar": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/keytar/-/keytar-4.7.0.tgz", - "integrity": "sha512-0hLlRRkhdR0068fVQo21hnIndGvacsh9PtAHGAPMPzxFjJwP8idAkVAcbdb1P5B+gterCBa3+4hxL0NPMDlZtw==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-4.9.0.tgz", + "integrity": "sha512-5aKEpnxRWUIhSlRXckqTxomqokV1/tOBe3EdbCDyMjDaoa5AkVHVa1yK+fa2CgJR5MadbJndFWmcDMCq812F4A==", "requires": { - "nan": "2.13.2", + "nan": "2.14.0", "prebuild-install": "5.3.0" - }, - "dependencies": { - "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" - } } }, "klaw": { @@ -3876,9 +3869,9 @@ } }, "psl": { - "version": "1.1.31", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", - "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" + "version": "1.1.32", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.32.tgz", + "integrity": "sha512-MHACAkHpihU/REGGPLj4sEfc/XKW2bheigvHO1dUqjaKigMp1C8+WLQYRGgeKFMsw5PMfegZcaN8IDXK/cD0+g==" }, "pump": { "version": "2.0.1", diff --git a/apm/package.json b/apm/package.json index 4e6b47e9c..aa8349589 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "2.2.4" + "atom-package-manager": "2.3.0" } } From ae10429d0848c8036e2d74ffed1926b3e3601ecd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 11 Jun 2019 16:20:56 +0200 Subject: [PATCH 105/184] Ensure TextEditorComponent was resized before asserting on its contents Previously, we would wait for the next update promise after resizing the editor as an indicator of when the resize occurred. Unfortunately, resize events are unreliable and may not be emitted right away. This could cause the test code to wait for an update promise that was unrelated to the resize event (e.g., cursor blinking). This commit uses a condition-based promise that ensures the rendered rows have changed as a result of the resize. This seems to fix the issue locally when introducing artificial timeouts in the resize event. --- spec/text-editor-component-spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 1f2752cd0..611f5b7d0 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -3297,9 +3297,12 @@ describe('TextEditorComponent', () => { // make the editor taller and wider and the same time, ensuring the number // of rendered lines is correct. setEditorHeightInLines(component, 13); - await setEditorWidthInCharacters(component, 50); - expect(component.getRenderedStartRow()).toBe(0); - expect(component.getRenderedEndRow()).toBe(13); + setEditorWidthInCharacters(component, 50); + await conditionPromise( + () => + component.getRenderedStartRow() === 0 && + component.getRenderedEndRow() === 13 + ); expect(component.getScrollHeight()).toBe( editor.getScreenLineCount() * component.getLineHeight() + getElementHeight(item2) + From 3abe596c6d8259ad4dfa8d6667c61c3e0956cca5 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 11 Jun 2019 18:29:24 +0200 Subject: [PATCH 106/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20autocomplete-plus@?= =?UTF-8?q?2.42.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7a9da7179..88609dc09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1358,8 +1358,8 @@ "integrity": "sha512-AHEZOz7RcIdPWlGQByHGUE9yVhn1O9qJQRHehvkN8riiUyJpNpaImk7dloH8Nw/JX14tKJhjT+EadY2u/+j7IQ==" }, "autocomplete-plus": { - "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.1/tarball", - "integrity": "sha512-ac1BOdUPPJ9di5wTMrCZupv2TRhhhaeO7dPyJdU3v8jIWGGf/R/ros0o5pje/gyNuZ7sEVGWiWSMNiQc3kuXWA==", + "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.2/tarball", + "integrity": "sha512-DtjYUHXRZRgAv604C8YAhj2p7+6oPz7molJnurE2mHvhvWA7wxwojKzJejNQMKwc/Up4mA/CcZBeuCVRMckgzw==", "requires": { "atom-slick": "^2.0.0", "dompurify": "^1.0.8", diff --git a/package.json b/package.json index bad25a941..d2f7fe19f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "autocomplete-atom-api": "https://www.atom.io/api/packages/autocomplete-atom-api/versions/0.10.7/tarball", "autocomplete-css": "https://www.atom.io/api/packages/autocomplete-css/versions/0.17.5/tarball", "autocomplete-html": "https://www.atom.io/api/packages/autocomplete-html/versions/0.8.8/tarball", - "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.1/tarball", + "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.2/tarball", "autocomplete-snippets": "https://www.atom.io/api/packages/autocomplete-snippets/versions/1.12.1/tarball", "autoflow": "file:packages/autoflow", "autosave": "https://www.atom.io/api/packages/autosave/versions/0.24.6/tarball", @@ -187,7 +187,7 @@ "autocomplete-atom-api": "0.10.7", "autocomplete-css": "0.17.5", "autocomplete-html": "0.8.8", - "autocomplete-plus": "2.42.1", + "autocomplete-plus": "2.42.2", "autocomplete-snippets": "1.12.1", "autoflow": "file:./packages/autoflow", "autosave": "0.24.6", From aa987c7866868f3523a8512feb531b33d5a485d2 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 11 Jun 2019 19:02:21 +0200 Subject: [PATCH 107/184] Do not store null buffers on the cacheStore --- src/native-compile-cache.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/native-compile-cache.js b/src/native-compile-cache.js index 5b097954c..422fbccd9 100644 --- a/src/native-compile-cache.js +++ b/src/native-compile-cache.js @@ -43,7 +43,7 @@ class NativeCompileCache { const script = new vm.Script(code, { filename, produceCachedData: true }); return { result: script.runInThisContext(), - cacheBuffer: script.cachedData + cacheBuffer: script.cachedDataProduced ? script.cachedData : null }; } @@ -102,7 +102,7 @@ class NativeCompileCache { console.error(`Error running script ${filename}`); throw err; } - if (compilationResult.cacheBuffer !== null) { + if (compilationResult.cacheBuffer) { self.cacheStore.set(cacheKey, compilationResult.cacheBuffer); } compiledWrapper = compilationResult.result; From 7306670ffe2c12fb61669b8c16f5586e4238435c Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 10:39:40 +0200 Subject: [PATCH 108/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20pathwatcher@8.1.0,?= =?UTF-8?q?=20text-buffer@13.17.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 +++ package-lock.json | 20 ++++++++++---------- package.json | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..4718ffd99 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "eslint.enable": true +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0e19091b9..06d48b26d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5187,9 +5187,9 @@ "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, "pathwatcher": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/pathwatcher/-/pathwatcher-8.0.2.tgz", - "integrity": "sha512-zuP+fLmB2IB6z89ikcehA+vG/ITx3Cmhaj3DJrBgnbdss6dwPolSq7cDBjgZ78Vl+SXmG7CHGIOM5mqdT9h7BQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/pathwatcher/-/pathwatcher-8.1.0.tgz", + "integrity": "sha512-CF6M8W3kR4sEF2wzwRLAN/J+MfstclhRhfd0+SP83vQyrIsuKDSxd6r2TVG16sXpKCzo/ieAQ+GD0yYZ1380Nw==", "requires": { "async": "~0.2.10", "emissary": "^1.3.2", @@ -6397,9 +6397,9 @@ } }, "superstring": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/superstring/-/superstring-2.3.6.tgz", - "integrity": "sha512-kDTXCXArhHL1lRk2zBW7ByRJByqVwoLK3E3jlf8+LcwQLZgSMs9dwrDHDpBdoOm89kstSBSrGcW8OJqNkxjWrQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/superstring/-/superstring-2.4.0.tgz", + "integrity": "sha512-dg1jpBBvxL2pBpCkTfAABYj0AXcVC05wQ2CHz/AVY786BC9wwzgZmkbjVQ2s/PI9Se9QMRwURJ2UE3MF4EygOg==", "requires": { "nan": "^2.10.0" } @@ -6565,9 +6565,9 @@ } }, "text-buffer": { - "version": "13.16.2", - "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.16.2.tgz", - "integrity": "sha512-4cTQqOe/rH8WVRiBOYyv8zigrdsKaArOZi0Xba3IjAG+cw2Hu8pJJPdfvGSMnsiJCZeRQvN4Yvsi0P9T8/odwQ==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/text-buffer/-/text-buffer-13.17.0.tgz", + "integrity": "sha512-6KWUrAUp/fLnAX3i8nPiBAzFzNPMLevybVsS6WnvMc6W1Azod8RNMIw7fSsgcpwPgGjkZUg2HIIEKUgGveC7ZQ==", "requires": { "delegato": "^1.0.0", "diff": "^2.2.1", @@ -6577,7 +6577,7 @@ "fs-plus": "^3.0.0", "grim": "^2.0.2", "mkdirp": "^0.5.1", - "pathwatcher": "8.0.2", + "pathwatcher": "^8.1.0", "serializable": "^1.0.3", "superstring": "2.4.0", "underscore-plus": "^1.0.0" diff --git a/package.json b/package.json index 3111ce680..efd4c2b4b 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "one-light-ui": "file:packages/one-light-ui", "open-on-github": "https://www.atom.io/api/packages/open-on-github/versions/1.3.1/tarball", "package-generator": "https://www.atom.io/api/packages/package-generator/versions/1.3.0/tarball", - "pathwatcher": "8.0.2", + "pathwatcher": "8.1.0", "postcss": "5.2.4", "postcss-selector-parser": "2.2.1", "property-accessors": "^1.1.3", @@ -155,7 +155,7 @@ "symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.2/tarball", "tabs": "https://www.atom.io/api/packages/tabs/versions/0.110.0/tarball", "temp": "^0.9.0", - "text-buffer": "13.16.2", + "text-buffer": "13.17.0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", "tree-sitter": "0.15.0", "tree-sitter-css": "^0.13.7", From 1d13427124941902741048c5a02e12f40b6233d2 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 11:27:03 +0200 Subject: [PATCH 109/184] Auto-format yaml files --- .travis.yml | 26 +- appveyor.yml | 44 +-- script/vsts/nightly-release.yml | 105 ++++--- script/vsts/platforms/linux.yml | 154 +++++----- script/vsts/platforms/macos.yml | 314 +++++++++---------- script/vsts/platforms/windows.yml | 438 +++++++++++++-------------- script/vsts/pull-requests.yml | 35 ++- script/vsts/release-branch-build.yml | 139 +++++---- 8 files changed, 626 insertions(+), 629 deletions(-) diff --git a/.travis.yml b/.travis.yml index f32e2721c..c4eb14e29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,16 @@ language: python python: - - "2.7.13" + - '2.7.13' git: depth: 10 branches: only: - - master - - /^[0-9.]+-releases$/ - - /.*-test-travis$/ + - master + - /^[0-9.]+-releases$/ + - /.*-test-travis$/ matrix: include: @@ -19,7 +19,7 @@ matrix: env: NODE_VERSION=8.9.3 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1 ATOM_JASMINE_REPORTER=list before_install: - - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" + - '/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16' install: - git clone https://github.com/creationix/nvm.git /tmp/.nvm @@ -57,11 +57,11 @@ addons: target_paths: travis-artifacts/$TRAVIS_BUILD_ID apt: packages: - - build-essential - - clang-3.3 - - fakeroot - - git - - libsecret-1-dev - - rpm - - libx11-dev - - libxkbfile-dev + - build-essential + - clang-3.3 + - fakeroot + - git + - libsecret-1-dev + - rpm + - libx11-dev + - libxkbfile-dev diff --git a/appveyor.yml b/appveyor.yml index 5ca67c824..e3602f329 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ image: Visual Studio 2015 -version: "{build}" +version: '{build}' skip_tags: true clone_folder: c:\projects\atom @@ -8,9 +8,9 @@ clone_depth: 10 branches: only: - - master - - /^[0-9.]+-releases$/ - - /^electron-[0-9.]+$/ + - master + - /^[0-9.]+-releases$/ + - /^electron-[0-9.]+$/ platform: - x64 @@ -24,8 +24,8 @@ environment: NODE_VERSION: 8.9.3 matrix: - - TASK: test - - TASK: installer + - TASK: test + - TASK: installer matrix: fast_finish: true @@ -46,28 +46,28 @@ build_script: - IF [%APPVEYOR_REPO_BRANCH%]==[master] IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET IS_SIGNED_ZIP_BRANCH=true - IF [%APPVEYOR_REPO_BRANCH:~0,9%]==[electron-] IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET IS_SIGNED_ZIP_BRANCH=true - IF [%TASK%]==[installer] ( - IF [%IS_RELEASE_BRANCH%]==[true] ( - ECHO Building on release branch - Creating production artifacts && - script\build.cmd --code-sign --compress-artifacts --create-windows-installer - ) ELSE ( - IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( - ECHO Building on %APPVEYOR_REPO_BRANCH% branch - Creating signed zips && - script\build.cmd --code-sign --compress-artifacts - ) ELSE ( - ECHO Skipping installer build for non-release/non-master branch - ) - ) + IF [%IS_RELEASE_BRANCH%]==[true] ( + ECHO Building on release branch - Creating production artifacts && + script\build.cmd --code-sign --compress-artifacts --create-windows-installer ) ELSE ( - ECHO Test build only - Not creating artifacts && - script\build.cmd + IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( + ECHO Building on %APPVEYOR_REPO_BRANCH% branch - Creating signed zips && + script\build.cmd --code-sign --compress-artifacts + ) ELSE ( + ECHO Skipping installer build for non-release/non-master branch + ) + ) + ) ELSE ( + ECHO Test build only - Not creating artifacts && + script\build.cmd ) test_script: - IF [%TASK%]==[test] ( - script\lint.cmd && - script\test.cmd + script\lint.cmd && + script\test.cmd ) ELSE ( - ECHO Skipping tests on installer build matrix row + ECHO Skipping tests on installer build matrix row ) deploy: off diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index 2bacc55a4..199a6b4ca 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -1,65 +1,64 @@ resources: containers: - - container: atom-linux-ci - image: atomeditor/atom-linux-ci:latest + - container: atom-linux-ci + image: atomeditor/atom-linux-ci:latest jobs: + - job: GetReleaseVersion + steps: + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install + - script: node script\vsts\get-release-version.js --nightly + name: Version -- job: GetReleaseVersion - steps: - # This has to be done separately because VSTS inexplicably - # exits the script block after `npm install` completes. - - script: | - cd script\vsts - npm install - displayName: npm install - - script: node script\vsts\get-release-version.js --nightly - name: Version + # Import OS-specific build definitions + - template: platforms/windows.yml + - template: platforms/macos.yml + - template: platforms/linux.yml -# Import OS-specific build definitions -- template: platforms/windows.yml -- template: platforms/macos.yml -- template: platforms/linux.yml + - job: Release + pool: + vmImage: vs2015-win2012r2 # needed for Python 2.7 and gyp -- job: Release - pool: - vmImage: vs2015-win2012r2 # needed for Python 2.7 and gyp + dependsOn: + - GetReleaseVersion + - Windows + - Linux + - macOS_tests - dependsOn: - - GetReleaseVersion - - Windows - - Linux - - macOS_tests + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] - variables: - ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install - # This has to be done separately because VSTS inexplicably - # exits the script block after `npm install` completes. - - script: | - cd script\vsts - npm install - displayName: npm install + - task: DownloadBuildArtifacts@0 + inputs: + itemPattern: '**' + downloadType: 'specific' + displayName: Download Release Artifacts - - task: DownloadBuildArtifacts@0 - inputs: - itemPattern: '**' - downloadType: 'specific' - displayName: Download Release Artifacts - - - script: | - node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - ATOM_RELEASE_VERSION: $(ReleaseVersion) - ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) - ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) - ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) - PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY) - displayName: Create Nightly Release + - script: | + node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) + ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) + ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) + PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY) + displayName: Create Nightly Release diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index e820ef921..3fbebf6be 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -1,91 +1,91 @@ jobs: -- job: Linux - dependsOn: GetReleaseVersion - timeoutInMinutes: 180 + - job: Linux + dependsOn: GetReleaseVersion + timeoutInMinutes: 180 - variables: - ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] - pool: - # This image is used to host the Docker container that runs the build - vmImage: ubuntu-16.04 + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + pool: + # This image is used to host the Docker container that runs the build + vmImage: ubuntu-16.04 - container: atom-linux-ci + container: atom-linux-ci - steps: - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + steps: + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - - script: script/bootstrap - displayName: Bootstrap build environment - env: - CI: true - CI_PROVIDER: VSTS - condition: ne(variables['CacheRestored'], 'true') + - script: script/bootstrap + displayName: Bootstrap build environment + env: + CI: true + CI_PROVIDER: VSTS + condition: ne(variables['CacheRestored'], 'true') - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - - script: script/lint - displayName: Run linter + - script: script/lint + displayName: Run linter - - script: script/build --no-bootstrap --create-debian-package --create-rpm-package --compress-artifacts - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - ATOM_RELEASE_VERSION: $(ReleaseVersion) - displayName: Build Atom + - script: script/build --no-bootstrap --create-debian-package --create-rpm-package --compress-artifacts + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + ATOM_RELEASE_VERSION: $(ReleaseVersion) + displayName: Build Atom - - script: script/test - env: - CI: true - CI_PROVIDER: VSTS - ATOM_JASMINE_REPORTER: list - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - displayName: Run tests - condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) + - script: script/test + env: + CI: true + CI_PROVIDER: VSTS + ATOM_JASMINE_REPORTER: list + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + displayName: Run tests + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" - env: - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - displayName: Post-process test results - condition: ne(variables['Atom.SkipTests'], 'true') + - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" + env: + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + displayName: Post-process test results + condition: ne(variables['Atom.SkipTests'], 'true') - - task: PublishTestResults@2 - inputs: - testResultsFormat: JUnit - searchFolder: $(Common.TestResultsDirectory)/junit - testResultsFiles: "**/*.xml" - mergeTestResults: true - testRunTitle: Linux - condition: ne(variables['Atom.SkipTests'], 'true') + - task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + searchFolder: $(Common.TestResultsDirectory)/junit + testResultsFiles: '**/*.xml' + mergeTestResults: true + testRunTitle: Linux + condition: ne(variables['Atom.SkipTests'], 'true') - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom.x86_64.rpm - ArtifactName: atom.x86_64.rpm - ArtifactType: Container - displayName: Upload atom.x84_64.rpm - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom.x86_64.rpm + ArtifactName: atom.x86_64.rpm + ArtifactType: Container + displayName: Upload atom.x84_64.rpm + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.deb - ArtifactName: atom-amd64.deb - ArtifactType: Container - displayName: Upload atom-amd64.deb - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.deb + ArtifactName: atom-amd64.deb + ArtifactType: Container + displayName: Upload atom-amd64.deb + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.tar.gz - ArtifactName: atom-amd64.tar.gz - ArtifactType: Container - displayName: Upload atom-amd64.tar.gz - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.tar.gz + ArtifactName: atom-amd64.tar.gz + ArtifactType: Container + displayName: Upload atom-amd64.tar.gz + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 253b22203..adf99e509 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -1,182 +1,182 @@ jobs: -- job: macOS_build - displayName: macOS build - dependsOn: GetReleaseVersion - timeoutInMinutes: 180 + - job: macOS_build + displayName: macOS build + dependsOn: GetReleaseVersion + timeoutInMinutes: 180 - variables: - ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] - IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] - IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] - pool: - vmImage: macos-10.13 + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] + pool: + vmImage: macos-10.13 - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 - - script: npm install --global npm@6.2.0 - displayName: Update npm + - script: npm install --global npm@6.2.0 + displayName: Update npm - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - - script: script/bootstrap - displayName: Bootstrap build environment - env: - CI: true - CI_PROVIDER: VSTS - NPM_BIN_PATH: /usr/local/bin/npm - condition: ne(variables['CacheRestored'], 'true') + - script: script/bootstrap + displayName: Bootstrap build environment + env: + CI: true + CI_PROVIDER: VSTS + NPM_BIN_PATH: /usr/local/bin/npm + condition: ne(variables['CacheRestored'], 'true') - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - - script: script/lint - displayName: Run linter + - script: script/lint + displayName: Run linter - - script: | - if [ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]; then - script/build --no-bootstrap --code-sign --compress-artifacts - else - script/build --no-bootstrap --compress-artifacts - fi - displayName: Build Atom - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - IS_RELEASE_BRANCH: $(IsReleaseBranch) - IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) - ATOM_RELEASE_VERSION: $(ReleaseVersion) - ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) - ATOM_MAC_CODE_SIGNING_CERT_PASSWORD: $(ATOM_MAC_CODE_SIGNING_CERT_PASSWORD) - ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN) - ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) + - script: | + if [ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]; then + script/build --no-bootstrap --code-sign --compress-artifacts + else + script/build --no-bootstrap --compress-artifacts + fi + displayName: Build Atom + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + IS_RELEASE_BRANCH: $(IsReleaseBranch) + IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL) + ATOM_MAC_CODE_SIGNING_CERT_PASSWORD: $(ATOM_MAC_CODE_SIGNING_CERT_PASSWORD) + ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN) + ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD) - - script: | - cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) - displayName: Stage Artifacts + - script: | + cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) + displayName: Stage Artifacts - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip - ArtifactName: atom-mac.zip - ArtifactType: Container - displayName: Upload atom-mac.zip - condition: succeeded() + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip + ArtifactName: atom-mac.zip + ArtifactType: Container + displayName: Upload atom-mac.zip + condition: succeeded() - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip - ArtifactName: atom-mac-symbols.zip - ArtifactType: Container - displayName: Upload atom-mac-symbols.zip - condition: succeeded() + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip + ArtifactName: atom-mac-symbols.zip + ArtifactType: Container + displayName: Upload atom-mac-symbols.zip + condition: succeeded() - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json - ArtifactName: atom-api.json - ArtifactType: Container - displayName: Upload atom-api.json - condition: succeeded() + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json + ArtifactName: atom-api.json + ArtifactType: Container + displayName: Upload atom-api.json + condition: succeeded() -- job: macOS_tests - displayName: macOS test - dependsOn: macOS_build - timeoutInMinutes: 180 - pool: - vmImage: macos-10.13 - strategy: - maxParallel: 3 - matrix: - core: - RunCoreTests: true - RunPackageTests: false - packages-1: - RunCoreTests: false - RunPackageTests: 1 - packages-2: - RunCoreTests: false - RunPackageTests: 2 + - job: macOS_tests + displayName: macOS test + dependsOn: macOS_build + timeoutInMinutes: 180 + pool: + vmImage: macos-10.13 + strategy: + maxParallel: 3 + matrix: + core: + RunCoreTests: true + RunPackageTests: false + packages-1: + RunCoreTests: false + RunPackageTests: 1 + packages-2: + RunCoreTests: false + RunPackageTests: 2 - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - - task: DownloadBuildArtifacts@0 - displayName: Download atom-mac.zip - inputs: - artifactName: 'atom-mac.zip' - downloadPath: $(Build.SourcesDirectory) + - task: DownloadBuildArtifacts@0 + displayName: Download atom-mac.zip + inputs: + artifactName: 'atom-mac.zip' + downloadPath: $(Build.SourcesDirectory) - - script: unzip atom-mac.zip/atom-mac.zip -d out - displayName: Unzip atom-mac.zip + - script: unzip atom-mac.zip/atom-mac.zip -d out + displayName: Unzip atom-mac.zip - - task: DownloadBuildArtifacts@0 - displayName: Download atom-mac-symbols.zip - inputs: - artifactName: 'atom-mac-symbols.zip' - downloadPath: $(Build.SourcesDirectory) + - task: DownloadBuildArtifacts@0 + displayName: Download atom-mac-symbols.zip + inputs: + artifactName: 'atom-mac-symbols.zip' + downloadPath: $(Build.SourcesDirectory) - - script: unzip atom-mac-symbols.zip/atom-mac-symbols.zip -d out - displayName: Unzip atom-mac-symbols.zip + - script: unzip atom-mac-symbols.zip/atom-mac-symbols.zip -d out + displayName: Unzip atom-mac-symbols.zip - - script: | - osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver - caffeinate -s script/test # Run with caffeinate to prevent screen saver - env: - CI: true - CI_PROVIDER: VSTS - ATOM_JASMINE_REPORTER: list - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - ATOM_RUN_CORE_TESTS: $(RunCoreTests) - ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests) - displayName: Run tests - condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) + - script: | + osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver + caffeinate -s script/test # Run with caffeinate to prevent screen saver + env: + CI: true + CI_PROVIDER: VSTS + ATOM_JASMINE_REPORTER: list + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + ATOM_RUN_CORE_TESTS: $(RunCoreTests) + ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests) + displayName: Run tests + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" - env: - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit - displayName: Post-process test results - condition: ne(variables['Atom.SkipTests'], 'true') + - script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml" + env: + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit + displayName: Post-process test results + condition: ne(variables['Atom.SkipTests'], 'true') - - task: PublishTestResults@2 - inputs: - testResultsFormat: JUnit - searchFolder: $(Common.TestResultsDirectory)/junit - testResultsFiles: "**/*.xml" - mergeTestResults: true - testRunTitle: MacOS - condition: ne(variables['Atom.SkipTests'], 'true') + - task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + searchFolder: $(Common.TestResultsDirectory)/junit + testResultsFiles: '**/*.xml' + mergeTestResults: true + testRunTitle: MacOS + condition: ne(variables['Atom.SkipTests'], 'true') - - script: | - mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports - cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports - displayName: Stage Crash Reports - condition: failed() + - script: | + mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports + cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports + displayName: Stage Crash Reports + condition: failed() - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports - ArtifactName: crash-reports.zip - displayName: Upload Crash Reports - condition: failed() + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports + ArtifactName: crash-reports.zip + displayName: Upload Crash Reports + condition: failed() diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 444915c5d..9fee7b601 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -1,249 +1,249 @@ jobs: -- job: Windows - dependsOn: GetReleaseVersion - timeoutInMinutes: 180 - strategy: - maxParallel: 2 - matrix: - x64: - buildArch: x64 - x86: - buildArch: x86 + - job: Windows + dependsOn: GetReleaseVersion + timeoutInMinutes: 180 + strategy: + maxParallel: 2 + matrix: + x64: + buildArch: x64 + x86: + buildArch: x86 - pool: - vmImage: vs2015-win2012r2 # needed for python 2.7 and gyp + pool: + vmImage: vs2015-win2012r2 # needed for python 2.7 and gyp - variables: - ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] - IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] - IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 - - script: | - ECHO Installing npm-windows-upgrade - npm install --global --production npm-windows-upgrade - displayName: Install npm-windows-upgrade + - script: | + ECHO Installing npm-windows-upgrade + npm install --global --production npm-windows-upgrade + displayName: Install npm-windows-upgrade - - script: | - ECHO Upgrading npm - npm-windows-upgrade --no-spinner --no-prompt --npm-version 6.2.0 - displayName: Install npm 6.2.0 + - script: | + ECHO Upgrading npm + npm-windows-upgrade --no-spinner --no-prompt --npm-version 6.2.0 + displayName: Install npm 6.2.0 - - script: | - cd script\vsts - npm install - displayName: Install Windows build dependencies + - script: | + cd script\vsts + npm install + displayName: Install Windows build dependencies - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache (x64) - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x64') + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache (x64) + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x64') - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 - displayName: Restore node_modules cache (x86) - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x86') + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + displayName: Restore node_modules cache (x86) + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x86') - - script: | - node script\vsts\windows-run.js script\bootstrap.cmd - env: - BUILD_ARCH: $(buildArch) - CI: true - CI_PROVIDER: VSTS - NPM_BIN_PATH: "D:\\a\\_tool\\node\\8.9.3\\x64\\npm.cmd" - displayName: Bootstrap build environment - condition: ne(variables['CacheRestored'], 'true') + - script: | + node script\vsts\windows-run.js script\bootstrap.cmd + env: + BUILD_ARCH: $(buildArch) + CI: true + CI_PROVIDER: VSTS + NPM_BIN_PATH: "D:\\a\\_tool\\node\\8.9.3\\x64\\npm.cmd" + displayName: Bootstrap build environment + condition: ne(variables['CacheRestored'], 'true') - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache (x64) - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x64') + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache (x64) + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x64') - - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 - displayName: Save node_modules cache (x86) - inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' - condition: eq(variables['buildArch'], 'x86') + - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + displayName: Save node_modules cache (x86) + inputs: + keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + condition: eq(variables['buildArch'], 'x86') - - script: node script\vsts\windows-run.js script\lint.cmd - env: - BUILD_ARCH: $(buildArch) - displayName: Run linter + - script: node script\vsts\windows-run.js script\lint.cmd + env: + BUILD_ARCH: $(buildArch) + displayName: Run linter - - script: | - IF NOT EXIST C:\tmp MKDIR C:\tmp - SET SQUIRREL_TEMP=C:\tmp - IF [%IS_RELEASE_BRANCH%]==[true] ( - ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% - node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts --create-windows-installer - ) ELSE ( - IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( - ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% - node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts - ) ELSE ( - ECHO Pull request build, no code signing will be performed - node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts - ) - ) - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - BUILD_ARCH: $(buildArch) - ATOM_RELEASE_VERSION: $(ReleaseVersion) - ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL) - ATOM_WIN_CODE_SIGNING_CERT_PASSWORD: $(ATOM_WIN_CODE_SIGNING_CERT_PASSWORD) - IS_RELEASE_BRANCH: $(IsReleaseBranch) - IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) - displayName: Build Atom + - script: | + IF NOT EXIST C:\tmp MKDIR C:\tmp + SET SQUIRREL_TEMP=C:\tmp + IF [%IS_RELEASE_BRANCH%]==[true] ( + ECHO Creating production artifacts for release branch %BUILD_SOURCEBRANCHNAME% + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts --create-windows-installer + ) ELSE ( + IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( + ECHO Creating signed CI artifacts for branch %BUILD_SOURCEBRANCHNAME% + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --code-sign --compress-artifacts + ) ELSE ( + ECHO Pull request build, no code signing will be performed + node script\vsts\windows-run.js script\build.cmd --no-bootstrap --compress-artifacts + ) + ) + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + BUILD_ARCH: $(buildArch) + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_WIN_CODE_SIGNING_CERT_DOWNLOAD_URL) + ATOM_WIN_CODE_SIGNING_CERT_PASSWORD: $(ATOM_WIN_CODE_SIGNING_CERT_PASSWORD) + IS_RELEASE_BRANCH: $(IsReleaseBranch) + IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch) + displayName: Build Atom - - script: node script\vsts\windows-run.js script\test.cmd - env: - CI: true - CI_PROVIDER: VSTS - ATOM_JASMINE_REPORTER: list - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit - BUILD_ARCH: $(buildArch) - displayName: Run tests - condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) + - script: node script\vsts\windows-run.js script\test.cmd + env: + CI: true + CI_PROVIDER: VSTS + ATOM_JASMINE_REPORTER: list + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit + BUILD_ARCH: $(buildArch) + displayName: Run tests + condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true')) - - script: > - node script\vsts\windows-run.js script\postprocess-junit-results.cmd - --search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml" - env: - TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit - displayName: Post-process test results - condition: ne(variables['Atom.SkipTests'], 'true') + - script: > + node script\vsts\windows-run.js script\postprocess-junit-results.cmd + --search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml" + env: + TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit + displayName: Post-process test results + condition: ne(variables['Atom.SkipTests'], 'true') - - task: PublishTestResults@2 - inputs: - testResultsFormat: JUnit - searchFolder: $(Common.TestResultsDirectory)\junit - testResultsFiles: "**/*.xml" - mergeTestResults: true - testRunTitle: Windows $(buildArch) - condition: ne(variables['Atom.SkipTests'], 'true') + - task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + searchFolder: $(Common.TestResultsDirectory)\junit + testResultsFiles: '**/*.xml' + mergeTestResults: true + testRunTitle: Windows $(buildArch) + condition: ne(variables['Atom.SkipTests'], 'true') - - script: | - IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports" - IF EXIST "%Temp%\Atom Crashes" ( - FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I - ) - displayName: Stage crash reports - condition: failed() - env: - ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory) + - script: | + IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports" + IF EXIST "%Temp%\Atom Crashes" ( + FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I + ) + displayName: Stage crash reports + condition: failed() + env: + ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports - ArtifactName: crash-reports - displayName: Publish crash reports on non-release branch - condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], '')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports + ArtifactName: crash-reports + displayName: Publish crash reports on non-release branch + condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], '')) - - script: > - node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/" - env: - ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) - ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) - ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) - ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory) - BUILD_ID: $(Build.BuildId) - displayName: Upload crash reports to S3 on release branch - condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], '')) + - script: > + node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/" + env: + ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) + ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) + ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) + ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory) + BUILD_ID: $(Build.BuildId) + displayName: Upload crash reports to S3 on release branch + condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], '')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip - ArtifactName: atom-x64-windows.zip - ArtifactType: Container - displayName: Upload atom-x64-windows.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x64')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip + ArtifactName: atom-x64-windows.zip + ArtifactType: Container + displayName: Upload atom-x64-windows.zip + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x64')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup-x64.exe - ArtifactName: AtomSetup-x64.exe - ArtifactType: Container - displayName: Upload AtomSetup-x64.exe - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup-x64.exe + ArtifactName: AtomSetup-x64.exe + ArtifactType: Container + displayName: Upload AtomSetup-x64.exe + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-$(ReleaseVersion)-full.nupkg - ArtifactName: atom-x64-$(ReleaseVersion)-full.nupkg - ArtifactType: Container - displayName: Upload atom-x64-$(ReleaseVersion)-full.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-$(ReleaseVersion)-full.nupkg + ArtifactName: atom-x64-$(ReleaseVersion)-full.nupkg + ArtifactType: Container + displayName: Upload atom-x64-$(ReleaseVersion)-full.nupkg + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-$(ReleaseVersion)-delta.nupkg - ArtifactName: atom-x64-$(ReleaseVersion)-delta.nupkg - ArtifactType: Container - displayName: Upload atom-x64-$(ReleaseVersion)-delta.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-$(ReleaseVersion)-delta.nupkg + ArtifactName: atom-x64-$(ReleaseVersion)-delta.nupkg + ArtifactType: Container + displayName: Upload atom-x64-$(ReleaseVersion)-delta.nupkg + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) + continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES-x64 - ArtifactName: RELEASES-x64 - ArtifactType: Container - displayName: Upload RELEASES-x64 - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES-x64 + ArtifactName: RELEASES-x64 + ArtifactType: Container + displayName: Upload RELEASES-x64 + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-windows.zip - ArtifactName: atom-windows.zip - ArtifactType: Container - displayName: Upload atom-windows.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x86')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-windows.zip + ArtifactName: atom-windows.zip + ArtifactType: Container + displayName: Upload atom-windows.zip + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x86')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup.exe - ArtifactName: AtomSetup.exe - ArtifactType: Container - displayName: Upload AtomSetup.exe - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup.exe + ArtifactName: AtomSetup.exe + ArtifactType: Container + displayName: Upload AtomSetup.exe + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-$(ReleaseVersion)-full.nupkg - ArtifactName: atom-$(ReleaseVersion)-full.nupkg - ArtifactType: Container - displayName: Upload atom-$(ReleaseVersion)-full.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-$(ReleaseVersion)-full.nupkg + ArtifactName: atom-$(ReleaseVersion)-full.nupkg + ArtifactType: Container + displayName: Upload atom-$(ReleaseVersion)-full.nupkg + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-$(ReleaseVersion)-delta.nupkg - ArtifactName: atom-$(ReleaseVersion)-delta.nupkg - ArtifactType: Container - displayName: Upload atom-$(ReleaseVersion)-delta.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/atom-$(ReleaseVersion)-delta.nupkg + ArtifactName: atom-$(ReleaseVersion)-delta.nupkg + ArtifactType: Container + displayName: Upload atom-$(ReleaseVersion)-delta.nupkg + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) + continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES - ArtifactName: RELEASES - ArtifactType: Container - displayName: Upload RELEASES - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES + ArtifactName: RELEASES + ArtifactType: Container + displayName: Upload RELEASES + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) diff --git a/script/vsts/pull-requests.yml b/script/vsts/pull-requests.yml index 5c59cec39..c09c2d816 100644 --- a/script/vsts/pull-requests.yml +++ b/script/vsts/pull-requests.yml @@ -1,24 +1,23 @@ -trigger: none # No CI builds, only PR builds +trigger: none # No CI builds, only PR builds resources: containers: - - container: atom-linux-ci - image: atomeditor/atom-linux-ci:latest + - container: atom-linux-ci + image: atomeditor/atom-linux-ci:latest jobs: + - job: GetReleaseVersion + steps: + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install + - script: node script\vsts\get-release-version.js + name: Version -- job: GetReleaseVersion - steps: - # This has to be done separately because VSTS inexplicably - # exits the script block after `npm install` completes. - - script: | - cd script\vsts - npm install - displayName: npm install - - script: node script\vsts\get-release-version.js - name: Version - -# Import OS-specific build definitions -- template: platforms/windows.yml -- template: platforms/macos.yml -- template: platforms/linux.yml + # Import OS-specific build definitions + - template: platforms/windows.yml + - template: platforms/macos.yml + - template: platforms/linux.yml diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index 8333c3d7a..af78e0c75 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -1,85 +1,84 @@ trigger: -- master -- 1.* # VSTS only supports wildcards at the end -- electron-* + - master + - 1.* # VSTS only supports wildcards at the end + - electron-* resources: containers: - - container: atom-linux-ci - image: atomeditor/atom-linux-ci:latest + - container: atom-linux-ci + image: atomeditor/atom-linux-ci:latest jobs: + - job: GetReleaseVersion + steps: + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install + - script: node script\vsts\get-release-version.js + name: Version -- job: GetReleaseVersion - steps: - # This has to be done separately because VSTS inexplicably - # exits the script block after `npm install` completes. - - script: | - cd script\vsts - npm install - displayName: npm install - - script: node script\vsts\get-release-version.js - name: Version + # Import OS-specific build definitions. + - template: platforms/windows.yml + - template: platforms/macos.yml + - template: platforms/linux.yml -# Import OS-specific build definitions. -- template: platforms/windows.yml -- template: platforms/macos.yml -- template: platforms/linux.yml + - job: UploadArtifacts + pool: + vmImage: vs2015-win2012r2 # needed for python 2.7 and gyp -- job: UploadArtifacts - pool: - vmImage: vs2015-win2012r2 # needed for python 2.7 and gyp + dependsOn: + - GetReleaseVersion + - Windows + - Linux + - macOS_tests - dependsOn: - - GetReleaseVersion - - Windows - - Linux - - macOS_tests + variables: + ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] + IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] + IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] - variables: - ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ] - IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ] - IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ] + steps: + - task: NodeTool@0 + inputs: + versionSpec: 8.9.3 + displayName: Install Node.js 8.9.3 - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + displayName: npm install - # This has to be done separately because VSTS inexplicably - # exits the script block after `npm install` completes. - - script: | - cd script\vsts - npm install - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - displayName: npm install + - task: DownloadBuildArtifacts@0 + inputs: + itemPattern: '**' + downloadType: 'specific' + displayName: Download Release Artifacts - - task: DownloadBuildArtifacts@0 - inputs: - itemPattern: '**' - downloadType: 'specific' - displayName: Download Release Artifacts + - script: | + node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging" + env: + GITHUB_TOKEN: $(GITHUB_TOKEN) + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) + ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) + ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) + PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY) + displayName: Create Draft Release + condition: and(succeeded(), eq(variables['Atom.AutoDraftRelease'], 'true'), eq(variables['IsReleaseBranch'], 'true')) - - script: | - node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom-staging" - env: - GITHUB_TOKEN: $(GITHUB_TOKEN) - ATOM_RELEASE_VERSION: $(ReleaseVersion) - ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) - ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) - ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) - PACKAGE_CLOUD_API_KEY: $(PACKAGE_CLOUD_API_KEY) - displayName: Create Draft Release - condition: and(succeeded(), eq(variables['Atom.AutoDraftRelease'], 'true'), eq(variables['IsReleaseBranch'], 'true')) - - - script: | - node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/" - env: - ATOM_RELEASE_VERSION: $(ReleaseVersion) - ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) - ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) - ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) - displayName: Upload CI Artifacts to S3 - condition: and(succeeded(), eq(variables['IsSignedZipBranch'], 'true')) + - script: | + node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --assets-path "$(System.ArtifactsDirectory)" --s3-path "vsts-artifacts/$(Build.BuildId)/" + env: + ATOM_RELEASE_VERSION: $(ReleaseVersion) + ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY) + ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET) + ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET) + displayName: Upload CI Artifacts to S3 + condition: and(succeeded(), eq(variables['IsSignedZipBranch'], 'true')) From 5fb69fc7af418590d2c440e0ea0f179d6d6277ef Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 14:01:12 +0200 Subject: [PATCH 110/184] Add .vscode folder to the .gitignore and remove it from the repository --- .gitignore | 1 + .vscode/settings.json | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index ae3a28e59..5457617c5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ Thumbs.db .project .svn .nvm-version +.vscode node_modules npm-debug.log debug.log diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4718ffd99..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.enable": true -} \ No newline at end of file From 31ff493085edf5d652f8a64604deb7ee35eeaf06 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 12 Jun 2019 15:12:19 +0200 Subject: [PATCH 111/184] Upgrade find-and-replace@0.218.13 --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06d48b26d..1dc15e8c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2873,8 +2873,8 @@ } }, "find-and-replace": { - "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.12/tarball", - "integrity": "sha512-ykte8V/n4L+kLrm1tXK0SODYLtPa9go9O0GOoOC5JOhErYMnTP9MRSygUug1bDkiyWOJ2brYrua4abSz/GPajA==", + "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.13/tarball", + "integrity": "sha512-pLWj62GTg/i2p3IKYLz3sbYtY7SDJvR6ZSOFBJuYNsGde6GBxIY5RLuITmgaHISbwt3q/jIy8DVYGbxVpeFm6A==", "requires": { "binary-search": "^1.3.3", "element-resize-detector": "^1.1.10", diff --git a/package.json b/package.json index efd4c2b4b..e3d540ec4 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "etch": "^0.12.6", "event-kit": "^2.5.3", "exception-reporting": "file:packages/exception-reporting", - "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.12/tarball", + "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.13/tarball", "find-parent-dir": "^0.3.0", "first-mate": "7.4.0", "focus-trap": "2.4.5", @@ -200,7 +200,7 @@ "dev-live-reload": "file:./packages/dev-live-reload", "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", - "find-and-replace": "0.218.12", + "find-and-replace": "0.218.13", "fuzzy-finder": "1.13.7", "github": "0.29.0", "git-diff": "file:./packages/git-diff", From 8e836b026ff471ed9983e55199ec0988b23d86d5 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 11:34:33 +0200 Subject: [PATCH 112/184] Update the nodejs version used on CI systems It now matches the version of Node.js that Electron v3.1 is using. --- .travis.yml | 2 +- appveyor.yml | 2 +- script/vsts/nightly-release.yml | 4 ++-- script/vsts/platforms/linux.yml | 8 ++++++++ script/vsts/platforms/macos.yml | 8 ++++---- script/vsts/platforms/windows.yml | 6 +++--- script/vsts/release-branch-build.yml | 4 ++-- script/vsts/windows-run.js | 2 +- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index c4eb14e29..2d4fd2d1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: include: - os: linux dist: trusty - env: NODE_VERSION=8.9.3 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1 ATOM_JASMINE_REPORTER=list + env: NODE_VERSION=10.2.1 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1 ATOM_JASMINE_REPORTER=list before_install: - '/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16' diff --git a/appveyor.yml b/appveyor.yml index e3602f329..dbfb62bc1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,7 @@ environment: ATOM_DEV_RESOURCE_PATH: c:\projects\atom ATOM_JASMINE_REPORTER: list CI: true - NODE_VERSION: 8.9.3 + NODE_VERSION: 10.2.1 matrix: - TASK: test diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index 199a6b4ca..d0ae2239b 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -36,8 +36,8 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 # This has to be done separately because VSTS inexplicably # exits the script block after `npm install` completes. diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index 3fbebf6be..b4a68b1fe 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -12,6 +12,14 @@ jobs: container: atom-linux-ci steps: + - task: NodeTool@0 + inputs: + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 + + - script: npm install --global npm@6.2.0 + displayName: Update npm + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index adf99e509..71e119a24 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -14,8 +14,8 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 - script: npm install --global npm@6.2.0 displayName: Update npm @@ -112,8 +112,8 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 9fee7b601..2230a0b74 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -21,8 +21,8 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 - script: | ECHO Installing npm-windows-upgrade @@ -61,7 +61,7 @@ jobs: BUILD_ARCH: $(buildArch) CI: true CI_PROVIDER: VSTS - NPM_BIN_PATH: "D:\\a\\_tool\\node\\8.9.3\\x64\\npm.cmd" + NPM_BIN_PATH: "D:\\a\\_tool\\node\\10.2.1\\x64\\npm.cmd" displayName: Bootstrap build environment condition: ne(variables['CacheRestored'], 'true') diff --git a/script/vsts/release-branch-build.yml b/script/vsts/release-branch-build.yml index af78e0c75..52c0dfd25 100644 --- a/script/vsts/release-branch-build.yml +++ b/script/vsts/release-branch-build.yml @@ -43,8 +43,8 @@ jobs: steps: - task: NodeTool@0 inputs: - versionSpec: 8.9.3 - displayName: Install Node.js 8.9.3 + versionSpec: 10.2.1 + displayName: Install Node.js 10.2.1 # This has to be done separately because VSTS inexplicably # exits the script block after `npm install` completes. diff --git a/script/vsts/windows-run.js b/script/vsts/windows-run.js index 2ac8760a3..d8538c287 100644 --- a/script/vsts/windows-run.js +++ b/script/vsts/windows-run.js @@ -5,7 +5,7 @@ const path = require('path'); const download = require('download'); const childProcess = require('child_process'); -const nodeVersion = '8.9.3'; +const nodeVersion = '10.2.1'; const nodeFileName = `node-v${nodeVersion}-win-x86`; const extractedNodePath = `c:\\tmp\\${nodeFileName}`; From 8d9a7aa97869a561eb4a9358807391539d28f2c7 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 12:55:08 +0200 Subject: [PATCH 113/184] Add yml files to the node_modules cache key This is to prevent reusing the node_modules folder when there are changes in the build system, which can affect the npm install step (like upgrading the Node.js version). --- script/vsts/platforms/linux.yml | 4 ++-- script/vsts/platforms/macos.yml | 6 +++--- script/vsts/platforms/windows.yml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index b4a68b1fe..cd26d081b 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -23,7 +23,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: - keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' @@ -37,7 +37,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 71e119a24..042b2652e 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -23,7 +23,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' @@ -38,7 +38,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' @@ -118,7 +118,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' + keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 2230a0b74..6432cfa17 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -42,7 +42,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache (x64) inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x64') @@ -50,7 +50,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache (x86) inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x86') @@ -68,7 +68,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache (x64) inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' + keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x64') @@ -76,7 +76,7 @@ jobs: - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 displayName: Save node_modules cache (x86) inputs: - keyfile: 'package.json, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' + keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key' targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' condition: eq(variables['buildArch'], 'x86') From 7c3a628336d9722bac758e1d895d089f28f12108 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 14:25:33 +0200 Subject: [PATCH 114/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20fs-admin@0.5.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 152 ++-------------------------------- package.json | 2 +- script/package-lock.json | 170 ++------------------------------------- script/package.json | 2 +- 4 files changed, 17 insertions(+), 309 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06d48b26d..fe398c148 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1727,11 +1727,6 @@ "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=" }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=" - }, "browserslist": { "version": "4.5.6", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.5.6.tgz", @@ -2481,11 +2476,6 @@ "humanize-plus": "^1.8.1" } }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=" - }, "dom-serializer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", @@ -2981,69 +2971,17 @@ "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" }, "fs-admin": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/fs-admin/-/fs-admin-0.1.7.tgz", - "integrity": "sha512-EQNioqUHgtnX9ErMiPuvHCAx0M1VSa9u4oxGF+EGVYBL15Mg5BxEzGBrTAYHUQDDobqw1Yc+6YqZWwSIIe+EwQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/fs-admin/-/fs-admin-0.5.0.tgz", + "integrity": "sha512-jU0x86bI6wmhdGGcpaO1rI7EpNx/44cEXPsHqFIRgs9SVsk3HSWn9Zd5fd7bdDw3LcmdnazOcJFK9PZsoNecAA==", "requires": { - "mocha": "^3.5.0", - "nan": "^2.10.0" + "nan": "^2.13.2" }, "dependencies": { - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "requires": { - "graceful-readlink": ">= 1.0.0" - } - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "requires": { - "ms": "2.0.0" - } - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - } - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "requires": { - "has-flag": "^1.0.0" - } + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, @@ -3359,11 +3297,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" - }, "grammar-selector": { "version": "file:packages/grammar-selector", "requires": { @@ -3435,11 +3368,6 @@ "sntp": "1.x.x" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" - }, "highlight.js": { "version": "9.12.0", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.12.0.tgz", @@ -3852,11 +3780,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" - }, "json5": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", @@ -4355,65 +4278,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=" }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=" - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=" - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=" - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=" - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=" - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", diff --git a/package.json b/package.json index efd4c2b4b..f8d30ca60 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "find-parent-dir": "^0.3.0", "first-mate": "7.4.0", "focus-trap": "2.4.5", - "fs-admin": "^0.1.7", + "fs-admin": "^0.5.0", "fs-plus": "^3.1.1", "fstream": "0.1.24", "fuzzaldrin": "^2.1", diff --git a/script/package-lock.json b/script/package-lock.json index cfe723743..d723bdaba 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -984,11 +984,6 @@ "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=" }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=" - }, "browserslist": { "version": "3.2.8", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", @@ -1819,11 +1814,6 @@ "wrappy": "1" } }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=" - }, "dir-glob": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", @@ -3501,12 +3491,11 @@ } }, "fs-admin": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/fs-admin/-/fs-admin-0.1.7.tgz", - "integrity": "sha512-EQNioqUHgtnX9ErMiPuvHCAx0M1VSa9u4oxGF+EGVYBL15Mg5BxEzGBrTAYHUQDDobqw1Yc+6YqZWwSIIe+EwQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/fs-admin/-/fs-admin-0.5.0.tgz", + "integrity": "sha512-jU0x86bI6wmhdGGcpaO1rI7EpNx/44cEXPsHqFIRgs9SVsk3HSWn9Zd5fd7bdDw3LcmdnazOcJFK9PZsoNecAA==", "requires": { - "mocha": "^3.5.0", - "nan": "^2.10.0" + "nan": "^2.13.2" } }, "fs-constants": { @@ -3806,21 +3795,11 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" - }, "grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=" - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -3920,11 +3899,6 @@ } } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" - }, "home-or-tmp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", @@ -4584,11 +4558,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" - }, "json5": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", @@ -4808,35 +4777,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash.keys": "^3.0.0" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=" - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=" - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=" - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=" - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", @@ -4847,31 +4787,11 @@ "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=" }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "requires": { - "lodash._baseassign": "^3.0.0", - "lodash._basecreate": "^3.0.0", - "lodash._isiterateecall": "^3.0.0" - } - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=" - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" - }, "lodash.isobject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", @@ -4882,16 +4802,6 @@ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, "lodash.merge": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", @@ -5210,72 +5120,6 @@ } } }, - "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.8", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "he": "1.1.1", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - }, - "dependencies": { - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "requires": { - "graceful-readlink": ">= 1.0.0" - } - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "requires": { - "ms": "2.0.0" - } - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -5287,9 +5131,9 @@ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" }, "nanomatch": { "version": "1.2.13", diff --git a/script/package.json b/script/package.json index 2cdedfcb0..cef1feff4 100644 --- a/script/package.json +++ b/script/package.json @@ -23,7 +23,7 @@ "eslint-plugin-prettier": "^3.0.1", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.0", - "fs-admin": "^0.1.5", + "fs-admin": "^0.5.0", "fs-extra": "0.30.0", "glob": "7.0.3", "joanna": "0.0.10", From 898c12fe21ad35015793f6b1479cf18713f349ba Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Wed, 12 Jun 2019 10:23:18 -0400 Subject: [PATCH 115/184] Rely on Azure Pipelines instead of AppVeyor for Windows builds --- README.md | 2 +- appveyor.yml | 95 ---------------------- docs/build-instructions/build-status.md | 2 +- script/lib/include-path-in-packaged-app.js | 1 - 4 files changed, 2 insertions(+), 98 deletions(-) delete mode 100644 appveyor.yml diff --git a/README.md b/README.md index 4fa635259..f3ffb0ebb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Atom -[![Build status](https://dev.azure.com/github/Atom/_apis/build/status/Atom%20Production%20Branches?branchName=master)](https://dev.azure.com/github/Atom/_build/latest?definitionId=32&branchName=master) [![Linux Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1tkktwh654w07eim?svg=true)](https://ci.appveyor.com/project/Atom/atom) +[![Build status](https://dev.azure.com/github/Atom/_apis/build/status/Atom%20Production%20Branches?branchName=master)](https://dev.azure.com/github/Atom/_build/latest?definitionId=32&branchName=master) [![Linux Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) [![Dependency Status](https://david-dm.org/atom/atom.svg)](https://david-dm.org/atom/atom) [![Join the Atom Community on Slack](https://atom-slack.herokuapp.com/badge.svg)](https://atom-slack.herokuapp.com) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e3602f329..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,95 +0,0 @@ -image: Visual Studio 2015 - -version: '{build}' - -skip_tags: true -clone_folder: c:\projects\atom -clone_depth: 10 - -branches: - only: - - master - - /^[0-9.]+-releases$/ - - /^electron-[0-9.]+$/ - -platform: - - x64 - - x86 - -environment: - global: - ATOM_DEV_RESOURCE_PATH: c:\projects\atom - ATOM_JASMINE_REPORTER: list - CI: true - NODE_VERSION: 8.9.3 - - matrix: - - TASK: test - - TASK: installer - -matrix: - fast_finish: true - exclude: - - platform: x86 - TASK: test - -install: - - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM - - npm install --global npm@6.2.0 - -build_script: - - CD %APPVEYOR_BUILD_FOLDER% - - IF NOT EXIST C:\tmp MKDIR C:\tmp - - SET SQUIRREL_TEMP=C:\tmp - - IF [%APPVEYOR_REPO_BRANCH:~-9%]==[-releases] IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET IS_RELEASE_BRANCH=true - - IF [%APPVEYOR_REPO_BRANCH%]==[master] IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET IS_SIGNED_ZIP_BRANCH=true - - IF [%APPVEYOR_REPO_BRANCH:~0,9%]==[electron-] IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET IS_SIGNED_ZIP_BRANCH=true - - IF [%TASK%]==[installer] ( - IF [%IS_RELEASE_BRANCH%]==[true] ( - ECHO Building on release branch - Creating production artifacts && - script\build.cmd --code-sign --compress-artifacts --create-windows-installer - ) ELSE ( - IF [%IS_SIGNED_ZIP_BRANCH%]==[true] ( - ECHO Building on %APPVEYOR_REPO_BRANCH% branch - Creating signed zips && - script\build.cmd --code-sign --compress-artifacts - ) ELSE ( - ECHO Skipping installer build for non-release/non-master branch - ) - ) - ) ELSE ( - ECHO Test build only - Not creating artifacts && - script\build.cmd - ) - -test_script: - - IF [%TASK%]==[test] ( - script\lint.cmd && - script\test.cmd - ) ELSE ( - ECHO Skipping tests on installer build matrix row - ) - -deploy: off -artifacts: - - path: out\AtomSetup.exe - name: AtomSetup.exe - - path: out\atom-windows.zip - name: atom-windows.zip - - path: out\RELEASES - name: RELEASES - - path: out\AtomSetup-x64.exe - name: AtomSetup-x64.exe - - path: out\atom-x64-windows.zip - name: atom-x64-windows.zip - - path: out\RELEASES-x64 - name: RELEASES-x64 - - path: out\atom-*-delta.nupkg - name: atom-delta.nupkg - - path: out\atom-*-full.nupkg - name: atom-full.nupkg - -cache: - - '%APPVEYOR_BUILD_FOLDER%\electron' - - '%USERPROFILE%\.atom\.apm' - - '%USERPROFILE%\.atom\compile-cache' diff --git a/docs/build-instructions/build-status.md b/docs/build-instructions/build-status.md index a6f7fdfd6..2dc9d3b02 100644 --- a/docs/build-instructions/build-status.md +++ b/docs/build-instructions/build-status.md @@ -2,7 +2,7 @@ | System | Travis | AppVeyor/Win | VSTS | Dependencies | |--------|--------|--------------|------------|--------------| -| [Atom](https://github.com/atom/atom) | [![Travis Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) | [![AppVeyor/Wi Build Status](https://ci.appveyor.com/api/projects/status/1tkktwh654w07eim?svg=true)](https://ci.appveyor.com/project/Atom/atom) | [![Build status](https://github.visualstudio.com/Atom/_apis/build/status/Atom%20Production%20Branches?branch=master)](https://github.visualstudio.com/Atom/_build/latest?definitionId=32&branch=master) | [![Dependency Status](https://david-dm.org/atom/atom.svg)](https://david-dm.org/atom/atom) | +| [Atom](https://github.com/atom/atom) | [![Travis Build Status](https://travis-ci.org/atom/atom.svg?branch=master)](https://travis-ci.org/atom/atom) | | [![Build status](https://github.visualstudio.com/Atom/_apis/build/status/Atom%20Production%20Branches?branch=master)](https://github.visualstudio.com/Atom/_build/latest?definitionId=32&branch=master) | [![Dependency Status](https://david-dm.org/atom/atom.svg)](https://david-dm.org/atom/atom) | | [APM](https://github.com/atom/apm) | [![Travis Build Status](https://travis-ci.org/atom/apm.svg?branch=master)](https://travis-ci.org/atom/apm) | [![AppVeyor/Wi Build Status](https://ci.appveyor.com/api/projects/status/j6ixw374a397ugkb/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/apm/branch/master) | | [![Dependency Status](https://david-dm.org/atom/apm.svg)](https://david-dm.org/atom/apm) | | [Electron](https://github.com/electron/electron) | [![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron) | [![AppVeyor/Wi Build Status](https://ci.appveyor.com/api/projects/status/kvxe4byi7jcxbe26/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron) | | [![Dependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron) diff --git a/script/lib/include-path-in-packaged-app.js b/script/lib/include-path-in-packaged-app.js index 3bb80fd6c..f8caac357 100644 --- a/script/lib/include-path-in-packaged-app.js +++ b/script/lib/include-path-in-packaged-app.js @@ -16,7 +16,6 @@ const EXCLUDE_REGEXPS_SOURCES = [ escapeRegExp('.npmignore'), escapeRegExp('.pairs'), escapeRegExp('.travis.yml'), - escapeRegExp('appveyor.yml'), escapeRegExp('.idea'), escapeRegExp('.editorconfig'), escapeRegExp('.lint'), From 0ba1b422668c26f6e5955fb8e2aeafa5c427757b Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 16:50:48 +0200 Subject: [PATCH 116/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20language-json@1.0.?= =?UTF-8?q?4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06d48b26d..fbbb0d249 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4031,8 +4031,8 @@ } }, "language-json": { - "version": "https://www.atom.io/api/packages/language-json/versions/1.0.3/tarball", - "integrity": "sha512-EQ34IMibK2hcchIWHOyu9pYZS9N+EFlYaw7YRZq0M7AJCIs/FSFLjbNxb+jRmBNqsfioL9bDWFh7lupLrK9Bnw==", + "version": "https://www.atom.io/api/packages/language-json/versions/1.0.4/tarball", + "integrity": "sha512-NNFpsa8vNwB7W3iZp0oljMusKR+kGiqDlJNa31G6Z+rh+VNshv3cbih7oiQYXD6ZkaMtTJyFUBdQVOw9yiQiPw==", "requires": { "tree-sitter-json": "^0.14.0" } diff --git a/package.json b/package.json index efd4c2b4b..0ceed0baf 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "language-hyperlink": "https://www.atom.io/api/packages/language-hyperlink/versions/0.17.1/tarball", "language-java": "https://www.atom.io/api/packages/language-java/versions/0.31.3/tarball", "language-javascript": "https://www.atom.io/api/packages/language-javascript/versions/0.130.0/tarball", - "language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.3/tarball", + "language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.4/tarball", "language-less": "https://www.atom.io/api/packages/language-less/versions/0.34.3/tarball", "language-make": "https://www.atom.io/api/packages/language-make/versions/0.23.0/tarball", "language-mustache": "https://www.atom.io/api/packages/language-mustache/versions/0.14.5/tarball", @@ -241,7 +241,7 @@ "language-hyperlink": "0.17.1", "language-java": "0.31.3", "language-javascript": "0.130.0", - "language-json": "1.0.3", + "language-json": "1.0.4", "language-less": "0.34.3", "language-make": "0.23.0", "language-mustache": "0.14.5", From 21bbfe209a57c998e4e7392a70e1d628b13fca55 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Wed, 12 Jun 2019 13:10:27 -0400 Subject: [PATCH 117/184] Only use AppVeyor on release branches --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dbfb62bc1..11c640117 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,9 +8,7 @@ clone_depth: 10 branches: only: - - master - /^[0-9.]+-releases$/ - - /^electron-[0-9.]+$/ platform: - x64 From 380f6f8d2f2397301444bbefc2698d5850408ad0 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 12 Jun 2019 21:03:20 +0200 Subject: [PATCH 118/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20tree-sitter@0.15.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4a8d7326..6cf29a5e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6532,18 +6532,18 @@ "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" }, "tree-sitter": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.0.tgz", - "integrity": "sha512-3CDZ7X4hSJgMXOo8WWhYIwS06hFDmI3x6/3rX+i+LP4ykL3UWVt5TgNKYjAkgBxbpFEHGkaSBe5LRQu5LHOQ3A==", + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.2.tgz", + "integrity": "sha512-wzUyNy/ela+G4uuZBBCswdVHYZhreKESwkEav0dx/aagTIB367XRnHYu+jUDPANxCHsG7yyP0ESP5zwNd6fyNA==", "requires": { "nan": "^2.13.2", "prebuild-install": "^5.0.0" }, "dependencies": { "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, diff --git a/package.json b/package.json index 745dee541..6fb7b62b5 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "temp": "^0.9.0", "text-buffer": "13.17.0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", - "tree-sitter": "0.15.0", + "tree-sitter": "0.15.2", "tree-sitter-css": "^0.13.7", "tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.0/tarball", "typescript-simple": "1.0.0", From 8e4562f6411af72a22bde1d2fbf227742648cfb4 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 12 Jun 2019 17:16:00 -0700 Subject: [PATCH 119/184] :arrow_up: tree-sitter to 0.15.4 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6cf29a5e7..b0e729f41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6532,9 +6532,9 @@ "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" }, "tree-sitter": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.2.tgz", - "integrity": "sha512-wzUyNy/ela+G4uuZBBCswdVHYZhreKESwkEav0dx/aagTIB367XRnHYu+jUDPANxCHsG7yyP0ESP5zwNd6fyNA==", + "version": "0.15.4", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.4.tgz", + "integrity": "sha512-EgZr6zJevERT/gl7dh2Z2sO0WKHSf8rLTJS38sLe0cTxqxTQ785VxemVCGBHzp8zZ4406sh+ORlB1z5HyORbYw==", "requires": { "nan": "^2.13.2", "prebuild-install": "^5.0.0" diff --git a/package.json b/package.json index 6fb7b62b5..bd808d558 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "temp": "^0.9.0", "text-buffer": "13.17.0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", - "tree-sitter": "0.15.2", + "tree-sitter": "0.15.4", "tree-sitter-css": "^0.13.7", "tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.0/tarball", "typescript-simple": "1.0.0", From 29682804ec86cec8ace2744ded0f112d855657d7 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 13 Jun 2019 00:02:20 -0400 Subject: [PATCH 120/184] :arrow_up: apm@2.3.1 to fix header download URL --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index aa8349589..8b8da2214 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "2.3.0" + "atom-package-manager": "2.3.1" } } From 36d1bcb6ce0ff5a8e326ce5d8fd2dfd49231de14 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 13 Jun 2019 00:14:18 -0400 Subject: [PATCH 121/184] Update package-lock --- apm/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apm/package-lock.json b/apm/package-lock.json index 77c3b7e06..c21d2488a 100644 --- a/apm/package-lock.json +++ b/apm/package-lock.json @@ -4,9 +4,9 @@ "lockfileVersion": 1, "dependencies": { "atom-package-manager": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/atom-package-manager/-/atom-package-manager-2.3.0.tgz", - "integrity": "sha512-WI2HaA19A4rKyaNnaoOE7vIlHBiwXQGq+/Kw1Z38LARvYOuWi7BK2GX0cZYqi4I5Yh5elpxrl01M2QmL09saNg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/atom-package-manager/-/atom-package-manager-2.3.1.tgz", + "integrity": "sha512-CAys5szBJbqhkizMm32o0+uOTpT9rgPh9TdFX0R//usjOAgDr8iJ7oGNfULPvJzaKnBhrokuniKNumAxVyuauA==", "requires": { "@atom/plist": "0.4.4", "asar-require": "0.3.0", From 961599261eaf6a303552de2d846cdd46d055211b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 13 Jun 2019 10:27:35 +0200 Subject: [PATCH 122/184] Update nsfw@1.0.24 to fix memory leaks on Linux --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd808d558..b5db761e1 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "MIT", "electronVersion": "3.1.10", "dependencies": { - "@atom/nsfw": "1.0.23", + "@atom/nsfw": "1.0.24", "@atom/source-map-support": "^0.3.4", "@atom/watcher": "1.3.1", "about": "file:packages/about", From 6e61c4de558c1b802b5058a99b5746c89495ebf1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 13 Jun 2019 10:32:06 +0200 Subject: [PATCH 123/184] Update package-lock.json --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b0e729f41..85369853c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,9 +29,9 @@ } }, "@atom/nsfw": { - "version": "1.0.23", - "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.23.tgz", - "integrity": "sha512-mo6G3eYzQzmdUWjCHO/2a4dWPPYYOZjAXjA4QtLGVXlnTMn08gC7JUEuztjAld1Qk+MYyV613O3ACj8xZ4KEog==", + "version": "1.0.24", + "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.24.tgz", + "integrity": "sha512-/pv/m+HRX/E8qvN+lUijsLWCcx24503l4J4Wf2mfVqaXxexYIKVMGZS1ZikX0Vf507sUbtD7600JiBK/RBaRhg==", "requires": { "fs-extra": "^7.0.0", "nan": "^2.10.0" From 6d9f6befd2301e84c5824337f00f752227c772c1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 13 Jun 2019 16:36:55 +0200 Subject: [PATCH 124/184] Increase timeout for atom-application.test.js on CI On Azure and Travis, we recently started observing a few test failures in atom-application.test.js. After staring at those tests for a bit, it doesn't seem like they are failing due to a race condition. Instead, it is possible that these tests are simply timing out due to CI containers sometimes being overloaded and, thus, slower. I tested this hypothesis locally by running tests on a VM while stress-testing the host machine. Tests would eventually have passed, but they timed out before having the chance to do so. This commit increases the timeout on CI to 10 seconds for `AtomApplication` tests in an attempt to fix the spurious failures we were observing. This is similar to what we've historically done for renderer process tests (see https://github.com/atom/atom/blob/7faea50190a8c6738b6ecee105645ee274a32b6e/spec/spec-helper.coffee#L50). --- spec/main-process/atom-application.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/main-process/atom-application.test.js b/spec/main-process/atom-application.test.js index be5dbd1c1..bf04be3e0 100644 --- a/spec/main-process/atom-application.test.js +++ b/spec/main-process/atom-application.test.js @@ -47,6 +47,10 @@ const { describe('AtomApplication', function() { let scenario, sinon; + if (process.env.CI) { + this.timeout(10 * 1000); + } + beforeEach(async function() { sinon = sandbox.create(); scenario = await LaunchScenario.create(sinon); From 83119fb3e4ab61a59f1e6c43281171b55cf53890 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:14:31 -0400 Subject: [PATCH 125/184] Update onDidChangeFiles spec to use real clock Prior to this change, the spec was using the fake clock, which was preventing the `setTimeout` from ever calling the `expire` function. Co-Authored-By: Antonio Scandurra --- spec/project-spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/project-spec.js b/spec/project-spec.js index 48d85f026..f123dc84a 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1081,6 +1081,7 @@ describe('Project', () => { }; it('reports filesystem changes within project paths', () => { + jasmine.useRealClock(); const dirOne = temp.mkdirSync('atom-spec-project-one'); const fileOne = path.join(dirOne, 'file-one.txt'); const fileTwo = path.join(dirOne, 'file-two.txt'); From f9405cb25d704af13e6647ea467c9a23421576c3 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:16:53 -0400 Subject: [PATCH 126/184] Fix test initialization If multiple specs were to populate the events var, one spec would pollute the others. So, let's reset the events var at the beginning of each spec. Co-Authored-By: Antonio Scandurra --- spec/project-spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/project-spec.js b/spec/project-spec.js index f123dc84a..4f69a7f6a 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1042,11 +1042,12 @@ describe('Project', () => { }); describe('.onDidChangeFiles()', () => { - let sub = []; - const events = []; + let sub; + let events; let checkCallback = () => {}; beforeEach(() => { + events = [] sub = atom.project.onDidChangeFiles(incoming => { events.push(...incoming); checkCallback(); From c7d17f6233cc576f185f6d59ad499f4ce5c7318b Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:23:30 -0400 Subject: [PATCH 127/184] If spec succeeds, clear the timeout Prior to this change, the `console.error` statement _always_ ran, regardless of whether the promise resolved successfully. With this change, we clear the timeout in the scenario where the promise resolves successfully. Co-Authored-By: Antonio Scandurra --- spec/project-spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/project-spec.js b/spec/project-spec.js index 4f69a7f6a..3017aaf92 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1059,11 +1059,13 @@ describe('Project', () => { const waitForEvents = paths => { const remaining = new Set(paths.map(p => fs.realpathSync(p))); return new Promise((resolve, reject) => { + let expireTimeoutId; checkCallback = () => { for (let event of events) { remaining.delete(event.path); } if (remaining.size === 0) { + clearTimeout(expireTimeoutId) resolve(); } }; @@ -1076,8 +1078,8 @@ describe('Project', () => { ); }; + expireTimeoutId = setTimeout(expire, 2000); checkCallback(); - setTimeout(expire, 2000); }); }; From 9fa32c7c22b2aa8443205a262867a16a1e5c2d98 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:35:12 -0400 Subject: [PATCH 128/184] Convert spec to use async/await Co-Authored-By: Antonio Scandurra --- spec/project-spec.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/spec/project-spec.js b/spec/project-spec.js index 3017aaf92..3da6e150a 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1083,7 +1083,7 @@ describe('Project', () => { }); }; - it('reports filesystem changes within project paths', () => { + it('reports filesystem changes within project paths', async () => { jasmine.useRealClock(); const dirOne = temp.mkdirSync('atom-spec-project-one'); const fileOne = path.join(dirOne, 'file-one.txt'); @@ -1092,24 +1092,17 @@ describe('Project', () => { const fileThree = path.join(dirTwo, 'file-three.txt'); // Ensure that all preexisting watchers are stopped - waitsForPromise(() => stopAllWatchers()); + await stopAllWatchers(); - runs(() => atom.project.setPaths([dirOne])); - waitsForPromise(() => atom.project.getWatcherPromise(dirOne)); + atom.project.setPaths([dirOne]); + await atom.project.getWatcherPromise(dirOne); - runs(() => { - expect(atom.project.watcherPromisesByPath[dirTwo]).toEqual(undefined); - - fs.writeFileSync(fileThree, 'three\n'); - fs.writeFileSync(fileTwo, 'two\n'); - fs.writeFileSync(fileOne, 'one\n'); - }); - - waitsForPromise(() => waitForEvents([fileOne, fileTwo])); - - runs(() => - expect(events.some(event => event.path === fileThree)).toBeFalsy() - ); + expect(atom.project.watcherPromisesByPath[dirTwo]).toEqual(undefined); + fs.writeFileSync(fileThree, 'three\n'); + fs.writeFileSync(fileTwo, 'two\n'); + fs.writeFileSync(fileOne, 'one\n'); + await waitForEvents([fileOne, fileTwo]); + expect(events.some(event => event.path === fileThree)).toBeFalsy() }); }); From d03d2772b56ac85144fa1ef1617d79e6345c4bf8 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:45:24 -0400 Subject: [PATCH 129/184] :shirt: Co-Authored-By: Antonio Scandurra --- spec/project-spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/project-spec.js b/spec/project-spec.js index 3da6e150a..a812418c7 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1047,7 +1047,7 @@ describe('Project', () => { let checkCallback = () => {}; beforeEach(() => { - events = [] + events = []; sub = atom.project.onDidChangeFiles(incoming => { events.push(...incoming); checkCallback(); @@ -1065,7 +1065,7 @@ describe('Project', () => { remaining.delete(event.path); } if (remaining.size === 0) { - clearTimeout(expireTimeoutId) + clearTimeout(expireTimeoutId); resolve(); } }; @@ -1102,7 +1102,7 @@ describe('Project', () => { fs.writeFileSync(fileTwo, 'two\n'); fs.writeFileSync(fileOne, 'one\n'); await waitForEvents([fileOne, fileTwo]); - expect(events.some(event => event.path === fileThree)).toBeFalsy() + expect(events.some(event => event.path === fileThree)).toBeFalsy(); }); }); From a0742f8e9da8ebf5ed3848c10f511fc693ff4269 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 13 Jun 2019 11:52:47 -0400 Subject: [PATCH 130/184] Disable flaky spec on Windows until we can identify a proper fix --- spec/project-spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/project-spec.js b/spec/project-spec.js index a812418c7..dec6e9d7f 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1084,6 +1084,8 @@ describe('Project', () => { }; it('reports filesystem changes within project paths', async () => { + if (process.platform === 'win32') return; // Flaky results on Windows: https://github.com/atom/atom/issues/19507 + jasmine.useRealClock(); const dirOne = temp.mkdirSync('atom-spec-project-one'); const fileOne = path.join(dirOne, 'file-one.txt'); From 00e3aa87210f87d3c42cdbe5a2881a44b64e12cd Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Thu, 13 Jun 2019 14:31:00 -0700 Subject: [PATCH 131/184] :fire: Use organization level templates Move to the organization level templates for issues and pull requests, removing one of the many copies we have floating around. --- .github/ISSUE_TEMPLATE/Feature_request.md | 41 ----------- .github/ISSUE_TEMPLATE/bug_report.md | 46 ------------ .github/PULL_REQUEST_TEMPLATE/bug_fix.md | 59 ---------------- .../PULL_REQUEST_TEMPLATE/documentation.md | 30 -------- .../PULL_REQUEST_TEMPLATE/feature_change.md | 70 ------------------- .../performance_improvement.md | 55 --------------- .github/lock.yml | 2 +- CONTRIBUTING.md | 6 +- ISSUE_TEMPLATE.md | 40 ----------- PULL_REQUEST_TEMPLATE.md | 8 +-- 10 files changed, 8 insertions(+), 349 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/bug_fix.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/documentation.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/feature_change.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/performance_improvement.md delete mode 100644 ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md deleted file mode 100644 index 5b85299a6..000000000 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - - - -## Summary - -One paragraph explanation of the feature. - -## Motivation - -Why are we doing this? What use cases does it support? What is the expected outcome? - -## Describe alternatives you've considered - -A clear and concise description of the alternative solutions you've considered. Be sure to explain why Atom's existing customizability isn't suitable for this feature. - -## Additional context - -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 293c66c18..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - - - -### Prerequisites - -* [ ] Put an X between the brackets on this line if you have done all of the following: - * Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode - * Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/ - * Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq - * Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom - * Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages - -### Description - -[Description of the issue] - -### Steps to Reproduce - -1. [First Step] -2. [Second Step] -3. [and so on...] - -**Expected behavior:** [What you expect to happen] - -**Actual behavior:** [What actually happens] - -**Reproduces how often:** [What percentage of the time does it reproduce?] - -### Versions - -You can get this information from copy and pasting the output of `atom --version` and `apm --version` from the command line. Also, please include the OS and what version of the OS you're running. - -### Additional Information - -Any additional information, configuration or data that might be necessary to reproduce the issue. diff --git a/.github/PULL_REQUEST_TEMPLATE/bug_fix.md b/.github/PULL_REQUEST_TEMPLATE/bug_fix.md deleted file mode 100644 index e6a293012..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/bug_fix.md +++ /dev/null @@ -1,59 +0,0 @@ -### Requirements for Contributing a Bug Fix - -* Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. -* The pull request must only fix an existing bug. To contribute other changes, you must use a different template. You can see all templates at https://github.com/atom/atom/tree/master/.github/PULL_REQUEST_TEMPLATE. -* The pull request must update the test suite to demonstrate the changed functionality. For guidance, please see https://flight-manual.atom.io/hacking-atom/sections/writing-specs/. -* After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see https://github.com/atom/atom/tree/master/CONTRIBUTING.md#pull-requests. - -### Identify the Bug - - - -### Description of the Change - - - -### Alternate Designs - - - -### Possible Drawbacks - - - -### Verification Process - - - -### Release Notes - - diff --git a/.github/PULL_REQUEST_TEMPLATE/documentation.md b/.github/PULL_REQUEST_TEMPLATE/documentation.md deleted file mode 100644 index 3fc1e4072..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/documentation.md +++ /dev/null @@ -1,30 +0,0 @@ -### Requirements for Contributing Documentation - -* Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. -* The pull request must only contribute documentation (for example, markdown files or API docs). To contribute other changes, you must use a different template. You can see all templates at https://github.com/atom/atom/tree/master/.github/PULL_REQUEST_TEMPLATE. - -### Description of the Change - - - -### Release Notes - - diff --git a/.github/PULL_REQUEST_TEMPLATE/feature_change.md b/.github/PULL_REQUEST_TEMPLATE/feature_change.md deleted file mode 100644 index cc6ed68af..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/feature_change.md +++ /dev/null @@ -1,70 +0,0 @@ -### Requirements for Adding, Changing, or Removing a Feature - -* Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. -* The pull request must contribute a change that has been endorsed by the maintainer team. See details in the template below. -* The pull request must update the test suite to exercise the updated functionality. For guidance, please see https://flight-manual.atom.io/hacking-atom/sections/writing-specs/. -* After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see https://github.com/atom/atom/tree/master/CONTRIBUTING.md#pull-requests. - -### Issue or RFC Endorsed by Atom's Maintainers - - - -### Description of the Change - - - -### Alternate Designs - - - -### Possible Drawbacks - - - -### Verification Process - - - -### Release Notes - - diff --git a/.github/PULL_REQUEST_TEMPLATE/performance_improvement.md b/.github/PULL_REQUEST_TEMPLATE/performance_improvement.md deleted file mode 100644 index f75f5fb28..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/performance_improvement.md +++ /dev/null @@ -1,55 +0,0 @@ -### Requirements for Contributing a Performance Improvement - -* Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion. -* The pull request must only affect performance of existing functionality. To contribute other changes, you must use a different template. You can see all templates at https://github.com/atom/atom/tree/master/.github/PULL_REQUEST_TEMPLATE. -* After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see https://github.com/atom/atom/tree/master/CONTRIBUTING.md#pull-requests. - -### Description of the Change - - - -### Quantitative Performance Benefits - - - -### Possible Drawbacks - - - -### Verification Process - - - -### Applicable Issues - - - -### Release Notes - - diff --git a/.github/lock.yml b/.github/lock.yml index 39319ee90..ba43e69a4 100644 --- a/.github/lock.yml +++ b/.github/lock.yml @@ -8,7 +8,7 @@ lockComment: > any recent activity after it was closed. If you can still reproduce this issue in [Safe Mode](https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode) then please open a new issue and fill out - [the entire issue template](https://github.com/atom/atom/blob/master/ISSUE_TEMPLATE.md) + [the entire issue template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) to ensure that we have enough information to address your issue. Thanks! # Issues or pull requests with these labels will not be locked exemptLabels: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d57e61ab1..e05fcb18b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,7 +113,7 @@ When we make a significant decision in how we maintain the project and what we c This section guides you through submitting a bug report for Atom. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:. -Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE.md), the information it asks for helps us resolve issues faster. +Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md), the information it asks for helps us resolve issues faster. > **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. @@ -126,7 +126,7 @@ Before creating bug reports, please check [this list](#before-submitting-a-bug-r #### How Do I Submit A (Good) Bug Report? -Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined [which repository](#atom-and-packages) your bug is related to, create an issue on that repository and provide the following information by filling in [the template](ISSUE_TEMPLATE.md). +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined [which repository](#atom-and-packages) your bug is related to, create an issue on that repository and provide the following information by filling in [the template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md). Explain the problem and include additional details to help maintainers reproduce the problem: @@ -163,7 +163,7 @@ Include details about your configuration and environment: This section guides you through submitting an enhancement suggestion for Atom, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:. -Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](ISSUE_TEMPLATE.md), including the steps that you imagine you would take if the feature you're requesting existed. +Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md), including the steps that you imagine you would take if the feature you're requesting existed. #### Before Submitting An Enhancement Suggestion diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index cf1773856..000000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,40 +0,0 @@ - - -### Prerequisites - -* [ ] Put an X between the brackets on this line if you have done all of the following: - * Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode - * Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/ - * Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq - * Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom - * Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages - -### Description - -[Description of the issue] - -### Steps to Reproduce - -1. [First Step] -2. [Second Step] -3. [and so on...] - -**Expected behavior:** [What you expect to happen] - -**Actual behavior:** [What actually happens] - -**Reproduces how often:** [What percentage of the time does it reproduce?] - -### Versions - -You can get this information from copy and pasting the output of `atom --version` and `apm --version` from the command line. Also, please include the OS and what version of the OS you're running. - -### Additional Information - -Any additional information, configuration or data that might be necessary to reproduce the issue. diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 7414fa3b1..af13a69e8 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ ⚛👋 Hello there! Welcome. Please follow the steps below to tell us about your contribution. 1. Copy the correct template for your contribution - - 🐛 Are you fixing a bug? Copy the template from https://bit.ly/atom-bugfix - - 📈 Are you improving performance? Copy the template from https://bit.ly/atom-perf - - 📝 Are you updating documentation? Copy the template from https://bit.ly/atom-docs - - 💻 Are you changing functionality? Copy the template from https://bit.ly/atom-behavior + - 🐛 Are you fixing a bug? Copy the template from + - 📈 Are you improving performance? Copy the template from + - 📝 Are you updating documentation? Copy the template from + - 💻 Are you changing functionality? Copy the template from 2. Replace this text with the contents of the template 3. Fill in all sections of the template 4. Click "Create pull request" From 24dd5e5a73ee74d3d4556d4b91410c6047a8ec66 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 13 Jun 2019 14:54:44 -0700 Subject: [PATCH 132/184] Update to Tree-sitter 0.15.5 --- package-lock.json | 6 +++--- package.json | 2 +- spec/tree-sitter-language-mode-spec.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85369853c..3eebf78fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6532,9 +6532,9 @@ "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" }, "tree-sitter": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.4.tgz", - "integrity": "sha512-EgZr6zJevERT/gl7dh2Z2sO0WKHSf8rLTJS38sLe0cTxqxTQ785VxemVCGBHzp8zZ4406sh+ORlB1z5HyORbYw==", + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.5.tgz", + "integrity": "sha512-3rrww3lc9NNbbVPT1uGkvbom5Ivr/lZqpzru/x+S0Jnh/jHKACNz7ED1JiAPKfR89eLRJxBGh+ZV5g+QqQrQaw==", "requires": { "nan": "^2.13.2", "prebuild-install": "^5.0.0" diff --git a/package.json b/package.json index b5db761e1..ea3f8ba2c 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "temp": "^0.9.0", "text-buffer": "13.17.0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", - "tree-sitter": "0.15.4", + "tree-sitter": "0.15.5", "tree-sitter-css": "^0.13.7", "tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.0/tarball", "typescript-simple": "1.0.0", diff --git a/spec/tree-sitter-language-mode-spec.js b/spec/tree-sitter-language-mode-spec.js index 06e7fd6de..2dba1c3a2 100644 --- a/spec/tree-sitter-language-mode-spec.js +++ b/spec/tree-sitter-language-mode-spec.js @@ -1811,7 +1811,7 @@ describe('TreeSitterLanguageMode', () => { [0, 5], [0, 8] ]); - expect(editor.bufferRangeForScopeAtPosition(null, [0, 9])).toEqual([ + expect(editor.bufferRangeForScopeAtPosition(null, [0, 8])).toEqual([ [0, 8], [0, 9] ]); From c7b55e5ceae15343be28e4ddca954c2277ea1970 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 13 Jun 2019 22:25:23 -0400 Subject: [PATCH 133/184] Install apm using ci --- script/lib/install-apm.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index a233f6119..510b429a7 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -6,10 +6,9 @@ const CONFIG = require('../config'); module.exports = function(ci) { console.log('Installing apm'); - // npm ci leaves apm with a bunch of unmet dependencies childProcess.execFileSync( CONFIG.getNpmBinPath(), - ['--global-style', '--loglevel=error', 'install'], + ['--global-style', '--loglevel=error', ci ? 'ci' : 'install'], { env: process.env, cwd: CONFIG.apmRootPath } ); }; From 86ad1c66049a450b28ad44fd469c6667f7f8b345 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 13 Jun 2019 22:26:52 -0400 Subject: [PATCH 134/184] Revert "Install apm using ci" This reverts commit c7b55e5ceae15343be28e4ddca954c2277ea1970. --- script/lib/install-apm.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index 510b429a7..a233f6119 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -6,9 +6,10 @@ const CONFIG = require('../config'); module.exports = function(ci) { console.log('Installing apm'); + // npm ci leaves apm with a bunch of unmet dependencies childProcess.execFileSync( CONFIG.getNpmBinPath(), - ['--global-style', '--loglevel=error', ci ? 'ci' : 'install'], + ['--global-style', '--loglevel=error', 'install'], { env: process.env, cwd: CONFIG.apmRootPath } ); }; From faf6adf4ea05de0450a9a10e56225178c363c8f6 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 14 Jun 2019 14:24:17 +0200 Subject: [PATCH 135/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20autocomplete-plus@?= =?UTF-8?q?2.42.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85369853c..3df2e1e43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1358,8 +1358,8 @@ "integrity": "sha512-AHEZOz7RcIdPWlGQByHGUE9yVhn1O9qJQRHehvkN8riiUyJpNpaImk7dloH8Nw/JX14tKJhjT+EadY2u/+j7IQ==" }, "autocomplete-plus": { - "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.2/tarball", - "integrity": "sha512-DtjYUHXRZRgAv604C8YAhj2p7+6oPz7molJnurE2mHvhvWA7wxwojKzJejNQMKwc/Up4mA/CcZBeuCVRMckgzw==", + "version": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.3/tarball", + "integrity": "sha512-/5Ou9lH8Yc7F7Hfl7UDu8zpVZCEYfYCGs0FxR+Z6+yS0O5k7TfYoJE74KgHHhW3vGAgDPph8/JIPptc5/a1YbQ==", "requires": { "atom-slick": "^2.0.0", "dompurify": "^1.0.8", diff --git a/package.json b/package.json index b5db761e1..a0eeec4a9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "autocomplete-atom-api": "https://www.atom.io/api/packages/autocomplete-atom-api/versions/0.10.7/tarball", "autocomplete-css": "https://www.atom.io/api/packages/autocomplete-css/versions/0.17.5/tarball", "autocomplete-html": "https://www.atom.io/api/packages/autocomplete-html/versions/0.8.8/tarball", - "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.2/tarball", + "autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.3/tarball", "autocomplete-snippets": "https://www.atom.io/api/packages/autocomplete-snippets/versions/1.12.1/tarball", "autoflow": "file:packages/autoflow", "autosave": "https://www.atom.io/api/packages/autosave/versions/0.24.6/tarball", @@ -187,7 +187,7 @@ "autocomplete-atom-api": "0.10.7", "autocomplete-css": "0.17.5", "autocomplete-html": "0.8.8", - "autocomplete-plus": "2.42.2", + "autocomplete-plus": "2.42.3", "autocomplete-snippets": "1.12.1", "autoflow": "file:./packages/autoflow", "autosave": "0.24.6", From 8c8fa10fcde3db3f667c974903320c6634ca94a5 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 14 Jun 2019 16:43:46 +0200 Subject: [PATCH 136/184] Tweak package-lock to not load fs-extra twice on main-process --- package-lock.json | 48 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3df2e1e43..ae7a235d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,18 +35,6 @@ "requires": { "fs-extra": "^7.0.0", "nan": "^2.10.0" - }, - "dependencies": { - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - } } }, "@atom/source-map-support": { @@ -68,16 +56,6 @@ "prebuild-install": "5.2.4" }, "dependencies": { - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "nan": { "version": "2.12.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", @@ -2991,9 +2969,9 @@ "integrity": "sha1-a+Dem+mYzhavivwkSXue6bfM2a0=" }, "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -3246,6 +3224,16 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "moment": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", @@ -6175,16 +6163,6 @@ "ms": "^2.1.1" } }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", From 8734f66aabfe7df8f3097eff863d424b9759759c Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Fri, 14 Jun 2019 11:19:49 -0400 Subject: [PATCH 137/184] :arrow_up: atom/nsfw@1.0.25 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85369853c..c3e068561 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,9 +29,9 @@ } }, "@atom/nsfw": { - "version": "1.0.24", - "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.24.tgz", - "integrity": "sha512-/pv/m+HRX/E8qvN+lUijsLWCcx24503l4J4Wf2mfVqaXxexYIKVMGZS1ZikX0Vf507sUbtD7600JiBK/RBaRhg==", + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/@atom/nsfw/-/nsfw-1.0.25.tgz", + "integrity": "sha512-V7g509EVRCCkzoQW/QA7lQsROrjsfYYEJRHzEuc6+PAH88Z4oAs7D3W8MOJrBPo+6e06gxEwfxZjIq7BQbpfwQ==", "requires": { "fs-extra": "^7.0.0", "nan": "^2.10.0" diff --git a/package.json b/package.json index b5db761e1..321c5938d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "MIT", "electronVersion": "3.1.10", "dependencies": { - "@atom/nsfw": "1.0.24", + "@atom/nsfw": "1.0.25", "@atom/source-map-support": "^0.3.4", "@atom/watcher": "1.3.1", "about": "file:packages/about", From 44cad8f586c7794f3af2faa8264306c5c27bf709 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Fri, 14 Jun 2019 11:20:37 -0400 Subject: [PATCH 138/184] Revert "Disable flaky spec on Windows until we can identify a proper fix" This reverts commit a0742f8e9d. As of 8734f66aab, we're now using the nsfw fixes from https://github.com/atom/nsfw/pull/9, which should resolve the flakiness we were seeing on Windows. --- spec/project-spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/project-spec.js b/spec/project-spec.js index dec6e9d7f..a812418c7 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -1084,8 +1084,6 @@ describe('Project', () => { }; it('reports filesystem changes within project paths', async () => { - if (process.platform === 'win32') return; // Flaky results on Windows: https://github.com/atom/atom/issues/19507 - jasmine.useRealClock(); const dirOne = temp.mkdirSync('atom-spec-project-one'); const fileOne = path.join(dirOne, 'file-one.txt'); From 57f70e2d7d30f485dc879fd4d1130752c1a42709 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Fri, 14 Jun 2019 09:21:07 -0700 Subject: [PATCH 139/184] Apply suggestions from code review New `bit.ly` links and a change to one of the target templates. Co-Authored-By: Jason Rudolph --- CONTRIBUTING.md | 2 +- PULL_REQUEST_TEMPLATE.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e05fcb18b..83b59fcb5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,7 +163,7 @@ Include details about your configuration and environment: This section guides you through submitting an enhancement suggestion for Atom, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:. -Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md), including the steps that you imagine you would take if the feature you're requesting existed. +Before creating enhancement suggestions, please check [this list](#before-submitting-an-enhancement-suggestion) as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion). Fill in [the template](https://github.com/atom/.github/blob/master/.github/ISSUE_TEMPLATE/feature_request.md), including the steps that you imagine you would take if the feature you're requesting existed. #### Before Submitting An Enhancement Suggestion diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index af13a69e8..cdf247b79 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ ⚛👋 Hello there! Welcome. Please follow the steps below to tell us about your contribution. 1. Copy the correct template for your contribution - - 🐛 Are you fixing a bug? Copy the template from - - 📈 Are you improving performance? Copy the template from - - 📝 Are you updating documentation? Copy the template from - - 💻 Are you changing functionality? Copy the template from + - 🐛 Are you fixing a bug? Copy the template from + - 📈 Are you improving performance? Copy the template from + - 📝 Are you updating documentation? Copy the template from + - 💻 Are you changing functionality? Copy the template from 2. Replace this text with the contents of the template 3. Fill in all sections of the template 4. Click "Create pull request" From f866a107ccda05dd7c66f1df589a807a427fb0b9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 14 Jun 2019 10:17:04 -0700 Subject: [PATCH 140/184] :arrow_up: bracket-matcher (prerelease) --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3eebf78fb..e490802aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1715,8 +1715,8 @@ } }, "bracket-matcher": { - "version": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.0/tarball", - "integrity": "sha512-bgAsyS23bu3Y9LqRul4/IjOIqUZxpnIZGBEaxBHGcC5vW/ZHCr3SYsPsN2hLXwTHvXArwgcBt1Uylc0tz25FSQ==", + "version": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1-0/tarball", + "integrity": "sha512-t6zMOe69vTMuEiKWIAkzGiISkcZilxMx2Nr51Kynqibf0TDVvghlXAXyugL3ToGuusPKmZgMs9U9lr2c7UUd8g==", "requires": { "first-mate": "^7.0.1", "underscore-plus": "1.x" diff --git a/package.json b/package.json index ea3f8ba2c..c583ae02e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "base16-tomorrow-dark-theme": "file:packages/base16-tomorrow-dark-theme", "base16-tomorrow-light-theme": "file:packages/base16-tomorrow-light-theme", "bookmarks": "https://www.atom.io/api/packages/bookmarks/versions/0.46.0/tarball", - "bracket-matcher": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.0/tarball", + "bracket-matcher": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1-0/tarball", "chai": "3.5.0", "chart.js": "^2.3.0", "clear-cut": "^2.0.2", @@ -193,7 +193,7 @@ "autosave": "0.24.6", "background-tips": "0.28.0", "bookmarks": "0.46.0", - "bracket-matcher": "0.91.0", + "bracket-matcher": "0.91.1-0", "command-palette": "0.43.5", "dalek": "file:./packages/dalek", "deprecation-cop": "file:./packages/deprecation-cop", From 376b2e108e3ffd8766085c3cac25d3b4b1327d18 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 14 Jun 2019 19:23:57 +0200 Subject: [PATCH 141/184] Shim `tokens` in tokenized lines returned from `TreeSitterLanguageMode` Co-Authored-By: Nathan Sobo --- spec/tree-sitter-language-mode-spec.js | 41 ++++++++++++++++++++++++++ src/tokenized-line.coffee | 22 ++++++++------ src/tree-sitter-language-mode.js | 37 ++++++++++++++++++++++- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/spec/tree-sitter-language-mode-spec.js b/spec/tree-sitter-language-mode-spec.js index 06e7fd6de..de3f12599 100644 --- a/spec/tree-sitter-language-mode-spec.js +++ b/spec/tree-sitter-language-mode-spec.js @@ -2210,6 +2210,47 @@ describe('TreeSitterLanguageMode', () => { expect(editor.getSelectedText()).toBe('html ` c${def()}e${f}g `'); }); }); + + describe('.tokenizedLineForRow(row)', () => { + it('returns a shimmed TokenizedLine with tokens', () => { + const grammar = new TreeSitterGrammar(atom.grammars, jsGrammarPath, { + parser: 'tree-sitter-javascript', + scopes: { + program: 'source', + 'call_expression > identifier': 'function', + property_identifier: 'property', + 'call_expression > member_expression > property_identifier': 'method', + identifier: 'variable' + } + }); + + buffer.setText('aa.bbb = cc(d.eee());\n\n \n b'); + + const languageMode = new TreeSitterLanguageMode({ buffer, grammar }); + buffer.setLanguageMode(languageMode); + + expect(languageMode.tokenizedLineForRow(0).tokens).toEqual([ + { value: 'aa', scopes: ['source', 'variable'] }, + { value: '.', scopes: ['source'] }, + { value: 'bbb', scopes: ['source', 'property'] }, + { value: ' = ', scopes: ['source'] }, + { value: 'cc', scopes: ['source', 'function'] }, + { value: '(', scopes: ['source'] }, + { value: 'd', scopes: ['source', 'variable'] }, + { value: '.', scopes: ['source'] }, + { value: 'eee', scopes: ['source', 'method'] }, + { value: '());', scopes: ['source'] } + ]); + expect(languageMode.tokenizedLineForRow(1).tokens).toEqual([]); + expect(languageMode.tokenizedLineForRow(2).tokens).toEqual([ + { value: ' ', scopes: ['source'] } + ]); + expect(languageMode.tokenizedLineForRow(3).tokens).toEqual([ + { value: ' ', scopes: ['source'] }, + { value: 'b', scopes: ['source', 'variable'] } + ]); + }); + }); }); function nextHighlightingUpdate(languageMode) { diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 986ec0442..abace0fcd 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -10,21 +10,25 @@ class TokenizedLine return unless properties? - {@openScopes, @text, @tags, @ruleStack, @tokenIterator, @grammar} = properties + {@openScopes, @text, @tags, @ruleStack, @tokenIterator, @grammar, tokens} = properties + @cachedTokens = tokens getTokenIterator: -> @tokenIterator.reset(this) Object.defineProperty @prototype, 'tokens', get: -> - iterator = @getTokenIterator() - tokens = [] + if @cachedTokens + @cachedTokens + else + iterator = @getTokenIterator() + tokens = [] - while iterator.next() - tokens.push(new Token({ - value: iterator.getText() - scopes: iterator.getScopes().slice() - })) + while iterator.next() + tokens.push(new Token({ + value: iterator.getText() + scopes: iterator.getScopes().slice() + })) - tokens + tokens tokenAtBufferColumn: (bufferColumn) -> @tokens[@tokenIndexAtBufferColumn(bufferColumn)] diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 4391b02b2..66ac0174a 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -488,9 +488,44 @@ class TreeSitterLanguageMode { */ tokenizedLineForRow(row) { + const lineText = this.buffer.lineForRow(row); + const tokens = []; + + const iterator = this.buildHighlightIterator(); + let start = { row, column: 0 }; + const scopes = iterator.seek(start, row); + while (true) { + const end = iterator.getPosition(); + if (end.row > row) { + end.row = row; + end.column = lineText.length; + } + + if (end.column > start.column) { + tokens.push( + new Token({ + value: lineText.substring(start.column, end.column), + scopes: scopes.map(s => this.grammar.scopeNameForScopeId(s)) + }) + ); + } + + if (end.column < lineText.length) { + for (const _ of iterator.getCloseScopeIds()) { + scopes.pop(); + } + scopes.push(...iterator.getOpenScopeIds()); + start = end; + iterator.moveToSuccessor(); + } else { + break; + } + } + return new TokenizedLine({ openScopes: [], - text: this.buffer.lineForRow(row), + text: lineText, + tokens, tags: [], ruleStack: [], lineEnding: this.buffer.lineEndingForRow(row), From d5604bd3289aed4622b65279695ac82e03af4cb4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 13 Jun 2019 13:50:01 -0600 Subject: [PATCH 142/184] Assign originalFontSize when workspace is initialized --- src/atom-environment.js | 4 +++- src/workspace.js | 14 ++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/atom-environment.js b/src/atom-environment.js index b4a7e8e43..36830ff76 100644 --- a/src/atom-environment.js +++ b/src/atom-environment.js @@ -313,6 +313,8 @@ class AtomEnvironment { this.attachSaveStateListeners(); this.windowEventHandler.initialize(this.window, this.document); + this.workspace.initialize(); + const didChangeStyles = this.didChangeStyles.bind(this); this.disposables.add(this.styles.onDidAddStyleElement(didChangeStyles)); this.disposables.add(this.styles.onDidUpdateStyleElement(didChangeStyles)); @@ -429,7 +431,7 @@ class AtomEnvironment { this.workspace.reset(this.packages); this.registerDefaultOpeners(); this.project.reset(this.packages); - this.workspace.subscribeToEvents(); + this.workspace.initialize(); this.grammars.clear(); this.textEditors.clear(); this.views.clear(); diff --git a/src/workspace.js b/src/workspace.js index 9262e45f7..1299187dd 100644 --- a/src/workspace.js +++ b/src/workspace.js @@ -256,8 +256,6 @@ module.exports = class Workspace extends Model { }; this.incoming = new Map(); - - this.subscribeToEvents(); } get paneContainer() { @@ -375,9 +373,9 @@ module.exports = class Workspace extends Model { this.consumeServices(this.packageManager); } - subscribeToEvents() { + initialize() { + this.originalFontSize = this.config.get('editor.fontSize'); this.project.onDidChangePaths(this.updateWindowTitle); - this.subscribeToFontSize(); this.subscribeToAddedItems(); this.subscribeToMovedItems(); this.subscribeToDockToggling(); @@ -1753,14 +1751,6 @@ module.exports = class Workspace extends Model { } } - subscribeToFontSize() { - return this.config.onDidChange('editor.fontSize', () => { - if (this.originalFontSize == null) { - this.originalFontSize = this.config.get('editor.fontSize'); - } - }); - } - // Removes the item's uri from the list of potential items to reopen. itemOpened(item) { let uri; From e6db41fc276d7b989f11155f50c08b945c4c717b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 14 Jun 2019 12:11:16 -0700 Subject: [PATCH 143/184] :arrow_up: bracket-matcher from pre-release to patch --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6af3ec5a..9efd71bb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1715,8 +1715,8 @@ } }, "bracket-matcher": { - "version": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1-0/tarball", - "integrity": "sha512-t6zMOe69vTMuEiKWIAkzGiISkcZilxMx2Nr51Kynqibf0TDVvghlXAXyugL3ToGuusPKmZgMs9U9lr2c7UUd8g==", + "version": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1/tarball", + "integrity": "sha512-aBbNNVfEAzzNu71ZZ4+P9Y0AxBUB74wseVF/Mu88wCrOQq889IHdiW+wzayfli0F6MXNH1wIh/zYPeZHzvU/MQ==", "requires": { "first-mate": "^7.0.1", "underscore-plus": "1.x" diff --git a/package.json b/package.json index bbc58e359..e6b520fd1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "base16-tomorrow-dark-theme": "file:packages/base16-tomorrow-dark-theme", "base16-tomorrow-light-theme": "file:packages/base16-tomorrow-light-theme", "bookmarks": "https://www.atom.io/api/packages/bookmarks/versions/0.46.0/tarball", - "bracket-matcher": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1-0/tarball", + "bracket-matcher": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.1/tarball", "chai": "3.5.0", "chart.js": "^2.3.0", "clear-cut": "^2.0.2", @@ -193,7 +193,7 @@ "autosave": "0.24.6", "background-tips": "0.28.0", "bookmarks": "0.46.0", - "bracket-matcher": "0.91.1-0", + "bracket-matcher": "0.91.1", "command-palette": "0.43.5", "dalek": "file:./packages/dalek", "deprecation-cop": "file:./packages/deprecation-cop", From 3f2309522aed772be72698a26124ac31b324c425 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Fri, 14 Jun 2019 15:28:48 -0400 Subject: [PATCH 144/184] Revert "add delay to watch-path tests to make them less flaky" This reverts commit dd40782166. With the upgrade to atom/nsfw v1.0.25 in https://github.com/atom/atom/pull/19525, we should no longer need the delay introduced in dd40782166. --- spec/path-watcher-spec.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/spec/path-watcher-spec.js b/spec/path-watcher-spec.js index 5f97338b1..a2a9a4e6d 100644 --- a/spec/path-watcher-spec.js +++ b/spec/path-watcher-spec.js @@ -7,7 +7,6 @@ import { promisify } from 'util'; import { CompositeDisposable } from 'event-kit'; import { watchPath, stopAllWatchers } from '../src/path-watcher'; -import { timeoutPromise } from './async-spec-helpers'; temp.track(); @@ -22,7 +21,6 @@ describe('watchPath', function() { let subs; beforeEach(function() { - jasmine.useRealClock(); subs = new CompositeDisposable(); }); @@ -111,12 +109,6 @@ describe('watchPath', function() { waitForChanges(rootWatcher, subFile), waitForChanges(childWatcher, subFile) ]); - - // In Windows64, in some situations nsfw (the currently default watcher) - // does not trigger the change events if they happen just after start watching, - // so we need to wait some time. More info: https://github.com/atom/atom/issues/19442 - await timeoutPromise(300); - await writeFile(subFile, 'subfile\n', { encoding: 'utf8' }); await firstChanges; @@ -164,11 +156,6 @@ describe('watchPath', function() { expect(subWatcher0.native).toBe(parentWatcher.native); expect(subWatcher1.native).toBe(parentWatcher.native); - // In Windows64, in some situations nsfw (the currently default watcher) - // does not trigger the change events if they happen just after start watching, - // so we need to wait some time. More info: https://github.com/atom/atom/issues/19442 - await timeoutPromise(300); - // Ensure events are filtered correctly await Promise.all([ appendFile(rootFile, 'change\n', { encoding: 'utf8' }), From 228f12eb61b5212d0831a2a7d204bdf2a99263f6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 14 Jun 2019 14:14:27 -0600 Subject: [PATCH 145/184] Fix lint error --- src/tree-sitter-language-mode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 66ac0174a..52b93b508 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -511,7 +511,8 @@ class TreeSitterLanguageMode { } if (end.column < lineText.length) { - for (const _ of iterator.getCloseScopeIds()) { + const closeScopeCount = iterator.getCloseScopeIds().length; + for (let i = 0; i < closeScopeCount; i++) { scopes.pop(); } scopes.push(...iterator.getOpenScopeIds()); From 14f5f99639b9a7d1a7937a7732a42fd9735050a9 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Sat, 15 Jun 2019 16:50:23 +1000 Subject: [PATCH 146/184] go with default include approach --- packages/grammar-selector/lib/grammar-list-view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 47018d7bd..a50a34483 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -100,7 +100,7 @@ module.exports = class GrammarListView { } let grammars = atom.grammars - .getGrammars({ includeTreeSitter: true }) + .getGrammars() .filter(grammar => { return grammar !== atom.grammars.nullGrammar && grammar.name; }); @@ -116,7 +116,7 @@ module.exports = class GrammarListView { } } atom.grammars - .getGrammars({ includeTreeSitter: false }) + .getGrammars({ textMateOnly: true }) .forEach(grammar => { if ( grammar !== atom.grammars.nullGrammar && From 29a7b776e30e06ed8b46417df676638b49e34593 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Sat, 15 Jun 2019 17:05:37 +1000 Subject: [PATCH 147/184] fix lint --- .../grammar-selector/lib/grammar-list-view.js | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index a50a34483..40cf457bd 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -99,11 +99,9 @@ module.exports = class GrammarListView { this.currentGrammar = this.autoDetect; } - let grammars = atom.grammars - .getGrammars() - .filter(grammar => { - return grammar !== atom.grammars.nullGrammar && grammar.name; - }); + let grammars = atom.grammars.getGrammars().filter(grammar => { + return grammar !== atom.grammars.nullGrammar && grammar.name; + }); if (atom.config.get('grammar-selector.hideDuplicateTextMateGrammars')) { const oldGrammars = grammars; @@ -115,17 +113,15 @@ module.exports = class GrammarListView { grammars.push(grammar); } } - atom.grammars - .getGrammars({ textMateOnly: true }) - .forEach(grammar => { - if ( - grammar !== atom.grammars.nullGrammar && - grammar.name && - !blacklist.has(grammar.name) - ) { - grammars.push(grammar); - } - }); + atom.grammars.getGrammars({ textMateOnly: true }).forEach(grammar => { + if ( + grammar !== atom.grammars.nullGrammar && + grammar.name && + !blacklist.has(grammar.name) + ) { + grammars.push(grammar); + } + }); } grammars.sort((a, b) => { From 80c559354761131ed87b646c3fdd8330cf704aca Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 17 Jun 2019 18:09:06 +0200 Subject: [PATCH 148/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20scandal@3.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 17 +++++++++++++---- package.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9efd71bb7..4b9a3cd96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5667,18 +5667,27 @@ "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=" }, "scandal": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/scandal/-/scandal-3.1.0.tgz", - "integrity": "sha1-m0AkuXxxm74lAIzAm6rHn7tdNQE=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/scandal/-/scandal-3.2.0.tgz", + "integrity": "sha512-kXICe3ygxwyyO3Ur+k49UzQlu8yrdQgzD03eMgV8sMWDom9q4qpEvZuQRUcbyAujC1TpISPRUPoirOIO1bRxcQ==", "requires": { "argparse": "^1.0.2", - "git-utils": "^5.0.0", + "git-utils": "^5.6.0", "isbinaryfile": "^2.0.4", "minimatch": "^2.0.9", "split": "^1.0.0", "temp": "^0.8.3" }, "dependencies": { + "git-utils": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.6.0.tgz", + "integrity": "sha512-eOBROJEQPQtkqzZe5V0m43YhKjhmzXTqULxlhoaCwORClnHtZIwkJQTS6THXRbvIqDq/cRHta85IqTbVzdvB5g==", + "requires": { + "fs-plus": "^3.0.0", + "nan": "^2.0.0" + } + }, "minimatch": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", diff --git a/package.json b/package.json index e6b520fd1..bdfdb8bf8 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "property-accessors": "^1.1.3", "random-words": "0.0.1", "resolve": "^1.1.6", - "scandal": "^3.1.0", + "scandal": "^3.2.0", "scoped-property-store": "^0.17.0", "scrollbar-style": "^3.2", "season": "^6.0.2", From f0f9eadac3a67621dbf122f698bf738417ca6e55 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 17 Jun 2019 18:15:21 +0200 Subject: [PATCH 149/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20git-utils@5.6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b9a3cd96..43fedb531 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3192,9 +3192,9 @@ } }, "git-utils": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.5.0.tgz", - "integrity": "sha512-4t3f2pU4HPgKOyTXyaEdMHTBwa24ubC4FykCXlqnsPgHlupSq66d0/aq0h92BgnyGwI3ogqx9D0a+Uw/jNckOg==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.6.0.tgz", + "integrity": "sha512-eOBROJEQPQtkqzZe5V0m43YhKjhmzXTqULxlhoaCwORClnHtZIwkJQTS6THXRbvIqDq/cRHta85IqTbVzdvB5g==", "requires": { "fs-plus": "^3.0.0", "nan": "^2.0.0" diff --git a/package.json b/package.json index bdfdb8bf8..ba55ec36f 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "fuzzaldrin": "^2.1", "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.7/tarball", "git-diff": "file:packages/git-diff", - "git-utils": "5.5.0", + "git-utils": "5.6.0", "github": "https://www.atom.io/api/packages/github/versions/0.29.0/tarball", "glob": "^7.1.1", "go-to-line": "file:packages/go-to-line", From 5595c110728496bd9c455870a368eefa3a24dc8e Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 14 Jun 2019 19:56:13 +0200 Subject: [PATCH 150/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20electron-winstalle?= =?UTF-8?q?r@3.0.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/package-lock.json | 202 +++++++++++++++++++++++++++------------ script/package.json | 2 +- 2 files changed, 143 insertions(+), 61 deletions(-) diff --git a/script/package-lock.json b/script/package-lock.json index d723bdaba..432c19cf9 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -119,6 +119,14 @@ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==" }, + "@babel/runtime": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", + "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==", + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, "@babel/template": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", @@ -507,27 +515,34 @@ "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, "asar": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/asar/-/asar-0.11.0.tgz", - "integrity": "sha1-uSbnksMV+MBIxDNx4yWwnJenZGQ=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asar/-/asar-1.0.0.tgz", + "integrity": "sha512-MBiDU5cDr9UWuY2F0zq2fZlnyRq1aOPmJGMas22Qa14K1odpRXL3xkMHPN3uw2hAK5mD89Q+/KidOUtpi4V0Cg==", "requires": { - "chromium-pickle-js": "^0.1.0", - "commander": "^2.9.0", - "cuint": "^0.2.1", - "glob": "^6.0.4", - "minimatch": "^3.0.0", - "mkdirp": "^0.5.0", - "mksnapshot": "^0.3.0" + "chromium-pickle-js": "^0.2.0", + "commander": "^2.19.0", + "cuint": "^0.2.2", + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "pify": "^4.0.1", + "tmp-promise": "^1.0.5" }, "dependencies": { + "commander": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" + }, "glob": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", - "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "requires": { + "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -539,6 +554,11 @@ "requires": { "brace-expansion": "^1.1.7" } + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" } } }, @@ -1174,9 +1194,9 @@ "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" }, "chromium-pickle-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.1.0.tgz", - "integrity": "sha1-HUixB9ghJqLz4hHC6iX4A7pVGyE=" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU=" }, "circular-json": { "version": "0.3.3", @@ -2281,33 +2301,61 @@ "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=" }, "electron-winstaller": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-2.6.4.tgz", - "integrity": "sha1-a0gHboc6bqNWJR8Ve2i55dwDtak=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-3.0.4.tgz", + "integrity": "sha512-u3wTQUzBBBGWbExkKvgKt69EMoF0xC8uLQS5vTXtwr97BH8ffSW8CcHvVGWRyRDIhg2AA+togKOKWr41wgCeiA==", "requires": { - "asar": "^0.11.0", - "bluebird": "^3.3.4", - "debug": "^2.2.0", - "fs-extra": "^0.26.7", + "@babel/runtime": "^7.3.4", + "asar": "^1.0.0", + "debug": "^4.1.1", + "fs-extra": "^7.0.1", "lodash.template": "^4.2.2", - "temp": "^0.8.3" + "pify": "^4.0.1", + "temp": "^0.9.0" }, "dependencies": { - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } }, "fs-extra": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", - "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "requires": { "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + }, + "temp": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.0.tgz", + "integrity": "sha512-YfUhPQCJoNQE5N+FJQcdPz63O3x3sdT4Xju69Gj4iZe0lBKOtnAMi0SLj9xKhGkcGhsxThvTJ/usxtFPo438zQ==", + "requires": { + "rimraf": "~2.6.2" } } } @@ -5096,30 +5144,6 @@ "resolved": "https://registry.npmjs.org/mkpath/-/mkpath-0.1.0.tgz", "integrity": "sha1-dVSm+Nhxg0zJe1RisSLEwSTW3pE=" }, - "mksnapshot": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/mksnapshot/-/mksnapshot-0.3.1.tgz", - "integrity": "sha1-JQHAVldDbXQs6Vik/5LHfkDdN+Y=", - "requires": { - "decompress-zip": "0.3.0", - "fs-extra": "0.26.7", - "request": "^2.79.0" - }, - "dependencies": { - "fs-extra": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", - "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - } - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -9024,6 +9048,11 @@ "through": "~2.3.8" } }, + "regenerator-runtime": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", + "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" + }, "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", @@ -10425,6 +10454,59 @@ "os-tmpdir": "~1.0.2" } }, + "tmp-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-1.1.0.tgz", + "integrity": "sha512-8+Ah9aB1IRXCnIOxXZ0uFozV1nMU5xiu7hhFVUSxZ3bYu+psD4TzagCzVbexUCgNNGJnsmNDQlS4nG3mTyoNkw==", + "requires": { + "bluebird": "^3.5.0", + "tmp": "0.1.0" + }, + "dependencies": { + "bluebird": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz", + "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==" + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "tmp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", + "requires": { + "rimraf": "^2.6.3" + } + } + } + }, "to-buffer": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", diff --git a/script/package.json b/script/package.json index cef1feff4..c10f44a4e 100644 --- a/script/package.json +++ b/script/package.json @@ -14,7 +14,7 @@ "electron-link": "0.4.0", "electron-mksnapshot": "^3.1.10", "electron-packager": "12.2.0", - "electron-winstaller": "2.6.4", + "electron-winstaller": "^3.0.4", "eslint": "^5.16.0", "eslint-config-prettier": "^4.2.0", "eslint-config-standard": "^12.0.0", From 0e7d99dce98d67cf464d95e4edb0f9308f4bb87e Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 17 Jun 2019 10:16:46 +0200 Subject: [PATCH 151/184] Update name of windows autoupdater executable --- script/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build b/script/build index 193eb7310..5c1eb0575 100755 --- a/script/build +++ b/script/build @@ -109,7 +109,7 @@ if (!argv.generateApiDocs) { if (argv.codeSign) { const executablesToSign = [ path.join(packagedAppPath, 'Atom.exe') ] if (argv.createWindowsInstaller) { - executablesToSign.push(path.join(__dirname, 'node_modules', 'electron-winstaller', 'vendor', 'Update.exe')) + executablesToSign.push(path.join(__dirname, 'node_modules', 'electron-winstaller', 'vendor', 'Squirrel.exe')) } codeSignOnWindows(executablesToSign) } else { From 8ea1bc24aaeba09678d1f2b1d943d837361a54c7 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 17 Jun 2019 22:52:08 +0200 Subject: [PATCH 152/184] Dedupe git-utils dependency --- package-lock.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 43fedb531..7c8512752 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5679,15 +5679,6 @@ "temp": "^0.8.3" }, "dependencies": { - "git-utils": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.6.0.tgz", - "integrity": "sha512-eOBROJEQPQtkqzZe5V0m43YhKjhmzXTqULxlhoaCwORClnHtZIwkJQTS6THXRbvIqDq/cRHta85IqTbVzdvB5g==", - "requires": { - "fs-plus": "^3.0.0", - "nan": "^2.0.0" - } - }, "minimatch": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", From c67794cf96cd16403a8621dc291112d6a4774b84 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Mon, 17 Jun 2019 20:33:58 +0200 Subject: [PATCH 153/184] Improve logic to generate nightly release notes --- script/vsts/lib/release-notes.js | 64 +++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/script/vsts/lib/release-notes.js b/script/vsts/lib/release-notes.js index c76c23317..360125148 100644 --- a/script/vsts/lib/release-notes.js +++ b/script/vsts/lib/release-notes.js @@ -97,32 +97,60 @@ module.exports.generateForNightly = async function( releaseVersion, githubToken ) { - const releases = await octokit.repos.getReleases({ - owner: 'atom', - repo: 'atom-nightly-releases' - }); - const previousRelease = getPreviousRelease(releaseVersion, releases.data); - const oldReleaseNotes = previousRelease ? previousRelease.body : undefined; - const latestCommitResult = childProcess.spawnSync('git', [ 'rev-parse', '--short', 'HEAD' ]); + if (!latestCommitResult) { + console.log("Couldn't get the current commmit from git."); - if (latestCommitResult && oldReleaseNotes) { - const latestCommit = latestCommitResult.stdout.toString().trim(); - const extractMatch = oldReleaseNotes.match( - /atom\/atom\/compare\/([0-9a-f]{5,40})\.\.\.([0-9a-f]{5,40})/ - ); - if (extractMatch) { - return `### Click [here](https://github.com/atom/atom/compare/${ - extractMatch[2] - }...${latestCommit}) to see the changes included with this release! :atom: :night_with_stars:`; - } + return undefined; } - return undefined; + const latestCommit = latestCommitResult.stdout.toString().trim(); + const output = [ + `### This nightly release is based on https://github.com/atom/atom/commit/${latestCommit} :atom: :night_with_stars:` + ]; + + try { + const releases = await octokit.repos.getReleases({ + owner: 'atom', + repo: 'atom-nightly-releases' + }); + + const previousRelease = getPreviousRelease(releaseVersion, releases.data); + const oldReleaseNotes = previousRelease ? previousRelease.body : undefined; + + if (oldReleaseNotes) { + const extractMatch = oldReleaseNotes.match( + /atom\/atom\/commit\/([0-9a-f]{5,40})/ + ); + if (extractMatch.length > 1 && extractMatch[1]) { + output.push('', '---', ''); + const previousCommit = extractMatch[1]; + + if ( + previousCommit === latestCommit || + previousCommit.startsWith(latestCommit) || + latestCommit.startsWith(previousCommit) + ) { + // TODO: Maybe we can bail out and not publish a release if it contains no commits? + output.push('No changes have been included in this release'); + } else { + output.push( + `Click [here](https://github.com/atom/atom/compare/${previousCommit}...${latestCommit}) to see the changes included with this release!` + ); + } + } + } + } catch (e) { + console.log( + 'Error when trying to find the previous nightly release: ' + e.message + ); + } + + return output; }; function extractWrittenReleaseNotes(oldReleaseNotes) { From 6708932b4abe4dbddf4d6bdda4401e1c2209c7a5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Jun 2019 15:32:10 -0700 Subject: [PATCH 154/184] :arrow_up: tree-sitter-rust --- package-lock.json | 8 ++++---- packages/language-rust-bundled/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7c8512752..be0db41f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4010,7 +4010,7 @@ "language-rust-bundled": { "version": "file:packages/language-rust-bundled", "requires": { - "tree-sitter-rust": "^0.13.7" + "tree-sitter-rust": "^0.15.1" } }, "language-sass": { @@ -6675,9 +6675,9 @@ } }, "tree-sitter-rust": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.13.7.tgz", - "integrity": "sha512-OX7VlqNhw67yIB69ZhgtJb6sXhwLVwGx991EjLf4PP2bY4dWBgmZ+KxwxN7HBwk9RdUsNLf0KbTwzVRadKhPGw==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.15.1.tgz", + "integrity": "sha512-nkuVgr/1QS/IkC1IE9DhjMKbGUUNymrMnRlV6HcOOOsW8s4ubCaL9Yu0M+eyVwSGjiD92xWEZMtt1I5ekUILYg==", "requires": { "nan": "^2.8.0" } diff --git a/packages/language-rust-bundled/package.json b/packages/language-rust-bundled/package.json index 91c1662ab..b178f0d86 100644 --- a/packages/language-rust-bundled/package.json +++ b/packages/language-rust-bundled/package.json @@ -10,7 +10,7 @@ "repository": "https://github.com/atom/atom", "license": "MIT", "dependencies": { - "tree-sitter-rust": "^0.13.7" + "tree-sitter-rust": "^0.15.1" }, "engines": { "atom": ">=1.0.0 <2.0.0" From 8988f87da476f6ef52e988cf05b05059c65dddce Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Jun 2019 15:33:35 -0700 Subject: [PATCH 155/184] Use injection to re-parse rust macro calls and defs as rust --- .../language-rust-bundled/grammars/tree-sitter-rust.cson | 1 + packages/language-rust-bundled/lib/main.js | 9 +++++++++ packages/language-rust-bundled/package.json | 1 + 3 files changed, 11 insertions(+) create mode 100644 packages/language-rust-bundled/lib/main.js diff --git a/packages/language-rust-bundled/grammars/tree-sitter-rust.cson b/packages/language-rust-bundled/grammars/tree-sitter-rust.cson index 6f77d1b90..651e2e247 100644 --- a/packages/language-rust-bundled/grammars/tree-sitter-rust.cson +++ b/packages/language-rust-bundled/grammars/tree-sitter-rust.cson @@ -2,6 +2,7 @@ name: 'Rust' scopeName: 'source.rust' type: 'tree-sitter' parser: 'tree-sitter-rust' +injectionRegex: 'rust' fileTypes: [ 'rs' diff --git a/packages/language-rust-bundled/lib/main.js b/packages/language-rust-bundled/lib/main.js new file mode 100644 index 000000000..982a9b338 --- /dev/null +++ b/packages/language-rust-bundled/lib/main.js @@ -0,0 +1,9 @@ +exports.activate = function() { + for (const nodeType of ['macro_invocation', 'macro_rule']) { + atom.grammars.addInjectionPoint('source.rust', { + type: nodeType, + language() { return 'rust'; }, + content(node) { return node.lastChild; }, + }); + } +}; diff --git a/packages/language-rust-bundled/package.json b/packages/language-rust-bundled/package.json index b178f0d86..ca6e7bdda 100644 --- a/packages/language-rust-bundled/package.json +++ b/packages/language-rust-bundled/package.json @@ -7,6 +7,7 @@ "grammar", "rust" ], + "main": "lib/main.js", "repository": "https://github.com/atom/atom", "license": "MIT", "dependencies": { From 7bfd33c5193f4363045d93727ad23acbbea690d0 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Jun 2019 15:34:10 -0700 Subject: [PATCH 156/184] Add `includeChildren` injection point API, use it for rust injections --- packages/language-rust-bundled/lib/main.js | 9 +- spec/tree-sitter-language-mode-spec.js | 78 ++++++++++ src/tree-sitter-language-mode.js | 171 ++++++++++++++------- 3 files changed, 198 insertions(+), 60 deletions(-) diff --git a/packages/language-rust-bundled/lib/main.js b/packages/language-rust-bundled/lib/main.js index 982a9b338..7a996b689 100644 --- a/packages/language-rust-bundled/lib/main.js +++ b/packages/language-rust-bundled/lib/main.js @@ -2,8 +2,13 @@ exports.activate = function() { for (const nodeType of ['macro_invocation', 'macro_rule']) { atom.grammars.addInjectionPoint('source.rust', { type: nodeType, - language() { return 'rust'; }, - content(node) { return node.lastChild; }, + language() { + return 'rust'; + }, + content(node) { + return node.lastChild; + }, + includeChildren: true }); } }; diff --git a/spec/tree-sitter-language-mode-spec.js b/spec/tree-sitter-language-mode-spec.js index 117132bf2..8919a54ec 100644 --- a/spec/tree-sitter-language-mode-spec.js +++ b/spec/tree-sitter-language-mode-spec.js @@ -27,6 +27,9 @@ const ejsGrammarPath = require.resolve( const rubyGrammarPath = require.resolve( 'language-ruby/grammars/tree-sitter-ruby.cson' ); +const rustGrammarPath = require.resolve( + 'language-rust-bundled/grammars/tree-sitter-rust.cson' +); describe('TreeSitterLanguageMode', () => { let editor, buffer; @@ -831,6 +834,81 @@ describe('TreeSitterLanguageMode', () => { ]); }); + it('respects the `includeChildren` property of injection points', async () => { + const rustGrammar = new TreeSitterGrammar( + atom.grammars, + rustGrammarPath, + { + scopeName: 'rust', + parser: 'tree-sitter-rust', + scopes: { + identifier: 'variable', + field_identifier: 'property', + 'call_expression > field_expression > field_identifier': + 'function', + 'macro_invocation > identifier': 'macro' + }, + injectionRegExp: 'rust', + injectionPoints: [ + { + type: 'macro_invocation', + language() { + return 'rust'; + }, + content(node) { + return node.lastChild; + }, + + // The tokens within a `token_tree` are all parsed as separate + // children of the `token_tree`. By default, when adding a language + // injection for a node, the node's children's ranges would be + // excluded from the injection. But for this injection point + // (parsing token trees as rust code), we want to reparse all of the + // content of the token tree. + includeChildren: true + } + ] + } + ); + + atom.grammars.addGrammar(rustGrammar); + + // Macro call within another macro call. + buffer.setText('assert_eq!(a.b.c(), vec![d.e()]); f.g();'); + + const languageMode = new TreeSitterLanguageMode({ + buffer, + grammar: rustGrammar, + grammars: atom.grammars + }); + buffer.setLanguageMode(languageMode); + + // There should not be duplicate scopes due to the root layer + // and for the injected rust layer. + expectTokensToEqual(editor, [ + [ + { text: 'assert_eq', scopes: ['macro'] }, + { text: '!(', scopes: [] }, + { text: 'a', scopes: ['variable'] }, + { text: '.', scopes: [] }, + { text: 'b', scopes: ['property'] }, + { text: '.', scopes: [] }, + { text: 'c', scopes: ['function'] }, + { text: '(), ', scopes: [] }, + { text: 'vec', scopes: ['macro'] }, + { text: '![', scopes: [] }, + { text: 'd', scopes: ['variable'] }, + { text: '.', scopes: [] }, + { text: 'e', scopes: ['function'] }, + { text: '()]); ', scopes: [] }, + { text: 'f', scopes: ['variable'] }, + { text: '.', scopes: [] }, + { text: 'g', scopes: ['function'] }, + { text: '();', scopes: [] } + ] + ]); + }); + it('notifies onDidTokenize listeners the first time all syntax highlighting is done', async () => { const promise = new Promise(resolve => { editor.onDidTokenize(event => { diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 52b93b508..7d6ecf8cb 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -32,7 +32,7 @@ class TreeSitterLanguageMode { this.config = config; this.grammarRegistry = grammars; this.parser = new Parser(); - this.rootLanguageLayer = new LanguageLayer(this, grammar); + this.rootLanguageLayer = new LanguageLayer(this, grammar, 0, true); this.injectionsMarkerLayer = buffer.addMarkerLayer(); if (syncTimeoutMicros != null) { @@ -637,13 +637,14 @@ class TreeSitterLanguageMode { } class LanguageLayer { - constructor(languageMode, grammar, contentChildTypes) { + constructor(languageMode, grammar, depth, isOpaque) { this.languageMode = languageMode; this.grammar = grammar; this.tree = null; this.currentParsePromise = null; this.patchSinceCurrentParseStarted = null; - this.contentChildTypes = contentChildTypes; + this.depth = depth; + this.isOpaque = isOpaque; } buildHighlightIterator() { @@ -885,7 +886,8 @@ class LanguageLayer { marker.languageLayer = new LanguageLayer( this.languageMode, grammar, - injectionPoint.contentChildTypes + this.depth + 1, + injectionPoint.includeChildren ); marker.parentLanguageLayer = this; } @@ -895,7 +897,8 @@ class LanguageLayer { new NodeRangeSet( nodeRangeSet, injectionNodes, - injectionPoint.newlinesBetween + injectionPoint.newlinesBetween, + injectionPoint.includeChildren ) ); } @@ -910,7 +913,6 @@ class LanguageLayer { } if (markersToUpdate.size > 0) { - this.lastUpdateWasAsync = true; const promises = []; for (const [marker, nodeRangeSet] of markersToUpdate) { promises.push(marker.languageLayer.update(nodeRangeSet)); @@ -938,6 +940,7 @@ class HighlightIterator { constructor(languageMode) { this.languageMode = languageMode; this.iterators = null; + this.opaqueLayerDepth = 0; } seek(targetPosition, endRow) { @@ -947,55 +950,97 @@ class HighlightIterator { } ); - this.iterators = [ - this.languageMode.rootLanguageLayer.buildHighlightIterator() - ]; - for (const marker of injectionMarkers) { - this.iterators.push(marker.languageLayer.buildHighlightIterator()); - } - this.iterators.sort((a, b) => b.getIndex() - a.getIndex()); - const containingTags = []; const containingTagStartIndices = []; const targetIndex = this.languageMode.buffer.characterIndexForPosition( targetPosition ); - for (let i = this.iterators.length - 1; i >= 0; i--) { - this.iterators[i].seek( - targetIndex, - containingTags, - containingTagStartIndices - ); + + this.iterators = []; + const iterator = this.languageMode.rootLanguageLayer.buildHighlightIterator(); + if (iterator.seek(targetIndex, containingTags, containingTagStartIndices)) { + this.iterators.push(iterator); } - this.iterators.sort((a, b) => b.getIndex() - a.getIndex()); + for (const marker of injectionMarkers) { + const iterator = marker.languageLayer.buildHighlightIterator(); + if ( + iterator.seek(targetIndex, containingTags, containingTagStartIndices) + ) { + this.iterators.push(iterator); + } + } + this.iterators.sort((a, b) => b.compare(a)); return containingTags; } moveToSuccessor() { - const lastIndex = this.iterators.length - 1; - const leader = this.iterators[lastIndex]; - leader.moveToSuccessor(); - const leaderCharIndex = leader.getIndex(); - let i = lastIndex; - while (i > 0 && this.iterators[i - 1].getIndex() < leaderCharIndex) i--; - if (i < lastIndex) this.iterators.splice(i, 0, this.iterators.pop()); + let leader = last(this.iterators); + if (leader.moveToSuccessor()) { + const leaderIndex = this.iterators.length - 1; + let i = leaderIndex; + while (i > 0 && this.iterators[i - 1].compare(leader) < 0) i--; + if (i < leaderIndex) { + this.iterators.splice(i, 0, this.iterators.pop()); + this.trackLayerDepth(); + } + } else { + this.iterators.pop(); + this.trackLayerDepth(); + } + } + + trackLayerDepth() { + let i = this.iterators.length - 1; + let iterator = this.iterators[i]; + if (!iterator) return; + const offset = iterator.getOffset(); + if (iterator.languageLayer.isOpaque) { + this.opaqueLayerDepth = iterator.languageLayer.depth; + } + + while (i > 0) { + i--; + iterator = this.iterators[i]; + if (iterator.startOffset > offset) break; + if (iterator.languageLayer.isOpaque) { + const { depth } = iterator.languageLayer; + if (depth > this.opaqueLayerDepth) { + this.opaqueLayerDepth = depth; + } + } + } } getPosition() { - return last(this.iterators).getPosition(); + const iterator = last(this.iterators); + if (iterator) { + return iterator.getPosition(); + } else { + return Point.INFINITY; + } } getCloseScopeIds() { - return last(this.iterators).getCloseScopeIds(); + const iterator = last(this.iterators); + if (iterator && iterator.languageLayer.depth >= this.opaqueLayerDepth) { + return iterator.getCloseScopeIds(); + } else { + return []; + } } getOpenScopeIds() { - return last(this.iterators).getOpenScopeIds(); + const iterator = last(this.iterators); + if (iterator && iterator.languageLayer.depth >= this.opaqueLayerDepth) { + return iterator.getOpenScopeIds(); + } else { + return []; + } } logState() { const iterator = last(this.iterators); - if (iterator.treeCursor) { + if (iterator && iterator.treeCursor) { console.log( iterator.getPosition(), iterator.treeCursor.nodeType, @@ -1029,6 +1074,8 @@ class LayerHighlightIterator { this.atEnd = false; this.treeCursor = treeCursor; + this.startOffset = this.treeCursor.startIndex; + // In order to determine which selectors match its current node, the iterator maintains // a list of the current node's ancestors. Because the selectors can use the `:nth-child` // pseudo-class, each node's child index is also stored. @@ -1046,7 +1093,6 @@ class LayerHighlightIterator { seek(targetIndex, containingTags, containingTagStartIndices) { while (this.treeCursor.gotoParent()) {} - this.done = false; this.atEnd = true; this.closeTags.length = 0; this.openTags.length = 0; @@ -1057,8 +1103,7 @@ class LayerHighlightIterator { const containingTagEndIndices = []; if (targetIndex >= this.treeCursor.endIndex) { - this.done = true; - return; + return false; } let childIndex = -1; @@ -1099,14 +1144,14 @@ class LayerHighlightIterator { } } - return containingTags; + return true; } moveToSuccessor() { this.closeTags.length = 0; this.openTags.length = 0; - while (!this.done && !this.closeTags.length && !this.openTags.length) { + while (!this.closeTags.length && !this.openTags.length) { if (this.atEnd) { if (this._moveRight()) { const scopeId = this._currentScopeId(); @@ -1116,7 +1161,7 @@ class LayerHighlightIterator { } else if (this._moveUp(true)) { this.atEnd = true; } else { - this.done = true; + return false; } } else if (!this._moveDown()) { const scopeId = this._currentScopeId(); @@ -1125,28 +1170,34 @@ class LayerHighlightIterator { this._moveUp(false); } } + + return true; } getPosition() { - if (this.done) { - return Point.INFINITY; - } else if (this.atEnd) { + if (this.atEnd) { return this.treeCursor.endPosition; } else { return this.treeCursor.startPosition; } } - getIndex() { - if (this.done) { - return Infinity; - } else if (this.atEnd) { + getOffset() { + if (this.atEnd) { return this.treeCursor.endIndex; } else { return this.treeCursor.startIndex; } } + compare(other) { + let result = this.getOffset() - other.getOffset(); + if (result !== 0) return result; + if (this.atEnd && !other.atEnd) return -1; + if (other.atEnd && !this.atEnd) return 1; + return this.depth - other.depth; + } + getCloseScopeIds() { return this.closeTags.slice(); } @@ -1156,6 +1207,7 @@ class LayerHighlightIterator { } // Private methods + _moveUp(atLastChild) { let result = false; const { endIndex } = this.treeCursor; @@ -1264,7 +1316,7 @@ class NullHighlightIterator { return []; } moveToSuccessor() {} - getIndex() { + getOffset() { return Infinity; } getPosition() { @@ -1279,10 +1331,11 @@ class NullHighlightIterator { } class NodeRangeSet { - constructor(previous, nodes, newlinesBetween) { + constructor(previous, nodes, newlinesBetween, includeChildren) { this.previous = previous; this.nodes = nodes; this.newlinesBetween = newlinesBetween; + this.includeChildren = includeChildren; } getRanges(buffer) { @@ -1293,18 +1346,20 @@ class NodeRangeSet { let position = node.startPosition; let index = node.startIndex; - for (const child of node.children) { - const nextIndex = child.startIndex; - if (nextIndex > index) { - this._pushRange(buffer, previousRanges, result, { - startIndex: index, - endIndex: nextIndex, - startPosition: position, - endPosition: child.startPosition - }); + if (!this.includeChildren) { + for (const child of node.children) { + const nextIndex = child.startIndex; + if (nextIndex > index) { + this._pushRange(buffer, previousRanges, result, { + startIndex: index, + endIndex: nextIndex, + startPosition: position, + endPosition: child.startPosition + }); + } + position = child.endPosition; + index = child.endIndex; } - position = child.endPosition; - index = child.endIndex; } if (node.endIndex > index) { From ea6d06152bb705d31e304764fd8ff83e497f7f86 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Jun 2019 17:17:04 -0700 Subject: [PATCH 157/184] Load language-rust at snapshot-generation time --- src/initialize-application-window.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/initialize-application-window.js b/src/initialize-application-window.js index d8388ab9f..f32d7633d 100644 --- a/src/initialize-application-window.js +++ b/src/initialize-application-window.js @@ -41,6 +41,7 @@ if (global.isGeneratingSnapshot) { require('language-html'); require('language-javascript'); require('language-ruby'); + require('language-rust-bundled'); require('language-typescript'); require('line-ending-selector'); require('link'); From f7b8e5f12fdd3f4b52e007dc2e5b9fb00416e370 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Jun 2019 17:52:55 -0700 Subject: [PATCH 158/184] Implement .compare on NullHighlightIterator --- src/tree-sitter-language-mode.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 7d6ecf8cb..bcf00c7c3 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -1315,6 +1315,9 @@ class NullHighlightIterator { seek() { return []; } + compare() { + return 1; + } moveToSuccessor() {} getOffset() { return Infinity; From afeee24f9b66450bb713021093cb75a79da5f4df Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 18 Jun 2019 18:06:20 +0200 Subject: [PATCH 159/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20fuzzy-finder@1.13.?= =?UTF-8?q?8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e5cb3915..6760133df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3048,8 +3048,8 @@ "integrity": "sha1-gy9kifvodnaUWVmckUpnDsIpR+4=" }, "fuzzy-finder": { - "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.7/tarball", - "integrity": "sha512-79C7IWrHrPk5UKL48KlcHoFy8T+FGfh/HXRwChkxrLYCrUZSl8a+Bj956j2xIRVanO+lNAnLR5QVyrDhbJ2McA==", + "version": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.8/tarball", + "integrity": "sha512-uhBHzD0B42k4KQ+CktomP16nxH/0fxlM9of3r/1bEAAxK4i0+/4Z22Qmxv3qsawo+4DxFUc3P9KCTgjxZHTaBA==", "requires": { "@atom/fuzzy-native": "^1.0.3", "async": "0.2.6", diff --git a/package.json b/package.json index ba55ec36f..0c6c7d185 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "fs-plus": "^3.1.1", "fstream": "0.1.24", "fuzzaldrin": "^2.1", - "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.7/tarball", + "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.8/tarball", "git-diff": "file:packages/git-diff", "git-utils": "5.6.0", "github": "https://www.atom.io/api/packages/github/versions/0.29.0/tarball", @@ -201,7 +201,7 @@ "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", "find-and-replace": "0.218.13", - "fuzzy-finder": "1.13.7", + "fuzzy-finder": "1.13.8", "github": "0.29.0", "git-diff": "file:./packages/git-diff", "go-to-line": "file:./packages/go-to-line", From 5e6770bb3fe7853596d2a6c6fb6c1ba87b926941 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 18 Jun 2019 11:52:31 -0700 Subject: [PATCH 160/184] Implement scope boundary deduping by detecting each duplicate --- src/tree-sitter-language-mode.js | 129 ++++++++++++++++--------------- 1 file changed, 68 insertions(+), 61 deletions(-) diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index bcf00c7c3..77d902cee 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -32,7 +32,7 @@ class TreeSitterLanguageMode { this.config = config; this.grammarRegistry = grammars; this.parser = new Parser(); - this.rootLanguageLayer = new LanguageLayer(this, grammar, 0, true); + this.rootLanguageLayer = new LanguageLayer(this, grammar, 0); this.injectionsMarkerLayer = buffer.addMarkerLayer(); if (syncTimeoutMicros != null) { @@ -637,14 +637,13 @@ class TreeSitterLanguageMode { } class LanguageLayer { - constructor(languageMode, grammar, depth, isOpaque) { + constructor(languageMode, grammar, depth) { this.languageMode = languageMode; this.grammar = grammar; this.tree = null; this.currentParsePromise = null; this.patchSinceCurrentParseStarted = null; this.depth = depth; - this.isOpaque = isOpaque; } buildHighlightIterator() { @@ -886,8 +885,7 @@ class LanguageLayer { marker.languageLayer = new LanguageLayer( this.languageMode, grammar, - this.depth + 1, - injectionPoint.includeChildren + this.depth + 1 ); marker.parentLanguageLayer = this; } @@ -940,7 +938,6 @@ class HighlightIterator { constructor(languageMode) { this.languageMode = languageMode; this.iterators = null; - this.opaqueLayerDepth = 0; } seek(targetPosition, endRow) { @@ -961,6 +958,9 @@ class HighlightIterator { if (iterator.seek(targetIndex, containingTags, containingTagStartIndices)) { this.iterators.push(iterator); } + + // Populate the iterators array with all of the iterators whose syntax + // trees span the given position. for (const marker of injectionMarkers) { const iterator = marker.languageLayer.buildHighlightIterator(); if ( @@ -969,46 +969,54 @@ class HighlightIterator { this.iterators.push(iterator); } } + + // Sort the iterators so that the last one in the array is the earliest + // in the document, and represents the current position. this.iterators.sort((a, b) => b.compare(a)); + this.detectCoveredScope(); + return containingTags; } moveToSuccessor() { + // Advance the earliest layer iterator to its next scope boundary. let leader = last(this.iterators); + + // Maintain the sorting of the iterators by their position in the document. if (leader.moveToSuccessor()) { const leaderIndex = this.iterators.length - 1; let i = leaderIndex; while (i > 0 && this.iterators[i - 1].compare(leader) < 0) i--; if (i < leaderIndex) { this.iterators.splice(i, 0, this.iterators.pop()); - this.trackLayerDepth(); } } else { + // If the layer iterator was at the end of its syntax tree, then remove + // it from the array. this.iterators.pop(); - this.trackLayerDepth(); } + + this.detectCoveredScope(); } - trackLayerDepth() { - let i = this.iterators.length - 1; - let iterator = this.iterators[i]; - if (!iterator) return; - const offset = iterator.getOffset(); - if (iterator.languageLayer.isOpaque) { - this.opaqueLayerDepth = iterator.languageLayer.depth; - } - - while (i > 0) { - i--; - iterator = this.iterators[i]; - if (iterator.startOffset > offset) break; - if (iterator.languageLayer.isOpaque) { - const { depth } = iterator.languageLayer; - if (depth > this.opaqueLayerDepth) { - this.opaqueLayerDepth = depth; - } + // Detect whether or not another more deeply-nested language layer has a + // scope boundary at this same position. If so, the current language layer's + // scope boundary should not be reported. + detectCoveredScope() { + const layerCount = this.iterators.length; + if (layerCount > 1) { + const first = this.iterators[layerCount - 1]; + const next = this.iterators[layerCount - 2]; + if ( + next.offset === first.offset && + next.atEnd === first.atEnd && + next.languageLayer.depth > first.languageLayer.depth + ) { + this.currentScopeIsCovered = true; + return; } } + this.currentScopeIsCovered = false; } getPosition() { @@ -1022,20 +1030,18 @@ class HighlightIterator { getCloseScopeIds() { const iterator = last(this.iterators); - if (iterator && iterator.languageLayer.depth >= this.opaqueLayerDepth) { + if (iterator && !this.currentScopeIsCovered) { return iterator.getCloseScopeIds(); - } else { - return []; } + return []; } getOpenScopeIds() { const iterator = last(this.iterators); - if (iterator && iterator.languageLayer.depth >= this.opaqueLayerDepth) { + if (iterator && !this.currentScopeIsCovered) { return iterator.getOpenScopeIds(); - } else { - return []; } + return []; } logState() { @@ -1044,23 +1050,28 @@ class HighlightIterator { console.log( iterator.getPosition(), iterator.treeCursor.nodeType, + `depth=${iterator.languageLayer.depth}`, new Range( iterator.languageLayer.tree.rootNode.startPosition, iterator.languageLayer.tree.rootNode.endPosition ).toString() ); - console.log( - 'close', - iterator.closeTags.map(id => - this.languageMode.grammar.scopeNameForScopeId(id) - ) - ); - console.log( - 'open', - iterator.openTags.map(id => - this.languageMode.grammar.scopeNameForScopeId(id) - ) - ); + if (this.currentScopeIsCovered) { + console.log('covered'); + } else { + console.log( + 'close', + iterator.closeTags.map(id => + this.languageMode.grammar.scopeNameForScopeId(id) + ) + ); + console.log( + 'open', + iterator.openTags.map(id => + this.languageMode.grammar.scopeNameForScopeId(id) + ) + ); + } } } } @@ -1073,8 +1084,7 @@ class LayerHighlightIterator { // in the syntax tree. this.atEnd = false; this.treeCursor = treeCursor; - - this.startOffset = this.treeCursor.startIndex; + this.offset = 0; // In order to determine which selectors match its current node, the iterator maintains // a list of the current node's ancestors. Because the selectors can use the `:nth-child` @@ -1136,12 +1146,14 @@ class LayerHighlightIterator { } if (this.atEnd) { - const currentIndex = this.treeCursor.endIndex; + this.offset = this.treeCursor.endIndex; for (let i = 0, { length } = containingTags; i < length; i++) { - if (containingTagEndIndices[i] === currentIndex) { + if (containingTagEndIndices[i] === this.offset) { this.closeTags.push(containingTags[i]); } } + } else { + this.offset = this.treeCursor.startIndex; } return true; @@ -1171,6 +1183,12 @@ class LayerHighlightIterator { } } + if (this.atEnd) { + this.offset = this.treeCursor.endIndex; + } else { + this.offset = this.treeCursor.startIndex; + } + return true; } @@ -1182,20 +1200,12 @@ class LayerHighlightIterator { } } - getOffset() { - if (this.atEnd) { - return this.treeCursor.endIndex; - } else { - return this.treeCursor.startIndex; - } - } - compare(other) { - let result = this.getOffset() - other.getOffset(); + const result = this.offset - other.offset; if (result !== 0) return result; if (this.atEnd && !other.atEnd) return -1; if (other.atEnd && !this.atEnd) return 1; - return this.depth - other.depth; + return this.languageLayer.depth - other.languageLayer.depth; } getCloseScopeIds() { @@ -1319,9 +1329,6 @@ class NullHighlightIterator { return 1; } moveToSuccessor() {} - getOffset() { - return Infinity; - } getPosition() { return Point.INFINITY; } From dbdff0f56c72ea731403d3d5bb3a7e3e0907aa8a Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 18 Jun 2019 17:37:15 -0700 Subject: [PATCH 161/184] :arrow_up: language packages --- .eslintignore | 2 +- package-lock.json | 149 +++++++++++++------------ package.json | 32 +++--- spec/tree-sitter-language-mode-spec.js | 8 +- 4 files changed, 99 insertions(+), 92 deletions(-) diff --git a/.eslintignore b/.eslintignore index 2c1ef701c..b54c3b8df 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ **/spec/fixtures/**/*.js node_modules /vendor/ -/out/ \ No newline at end of file +/out/ diff --git a/package-lock.json b/package-lock.json index addc6a725..3109d65ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3874,11 +3874,11 @@ } }, "language-c": { - "version": "https://www.atom.io/api/packages/language-c/versions/0.60.17/tarball", - "integrity": "sha512-jGu5Eo/QqqmMM1r62nYJhLdgop/pf4RUUK+udYyp0mOQpU3qPRT+9lVv14/9SDpwkiBB1DQSLJekhVobcD0McQ==", + "version": "https://www.atom.io/api/packages/language-c/versions/0.60.18/tarball", + "integrity": "sha512-q+oTv3QtnLGP8L3qIuWdOQ9XVKskVTsCp8hvURaSz9MGIIjKIK1ssO/r/gkCiBF/AWqaBuglYix4E6RmytHlVg==", "requires": { - "tree-sitter-c": "^0.13.13", - "tree-sitter-cpp": "^0.13.15" + "tree-sitter-c": "^0.15.0", + "tree-sitter-cpp": "^0.15.0" } }, "language-clojure": { @@ -3909,19 +3909,19 @@ "integrity": "sha512-xvsGO/d3/XsKJmwdAz9VGHo6t7A13VuJeuEoZaoLmvzwkVpFdpJcK8PNwVMPHav+lpNeu73qiXmqS+YIlvLwLQ==" }, "language-go": { - "version": "https://www.atom.io/api/packages/language-go/versions/0.47.0/tarball", - "integrity": "sha512-41lrL5fCPKJSxZ+GUkOemPcDSfme2E2KULuhJGnWLUun5vTrqevtkLgQGAnqH+M/D9zOqJH6H3Lc2kYPrLdUaA==", + "version": "https://www.atom.io/api/packages/language-go/versions/0.47.1/tarball", + "integrity": "sha512-SiySXDxMZ0nUvNCBAClB8sbil0VQi6MJq2ut+jNuNLKtXvO+PtuHxohtbfsSwSYeET0a8ylVahLv1lo0HBgUjw==", "requires": { - "tree-sitter-go": "^0.13.3" + "tree-sitter-go": "^0.15.0" } }, "language-html": { - "version": "https://www.atom.io/api/packages/language-html/versions/0.52.1/tarball", - "integrity": "sha512-39BmsxqzTJcb6u5bSqv/k/bigdZibbMm3BHascMuWHHl5swIQlJhYf+QPR3ozaojNK/aFbx4hj4zDolmlFEKlA==", + "version": "https://www.atom.io/api/packages/language-html/versions/0.52.3/tarball", + "integrity": "sha512-NcEU2LTS76VgnLJIc7sN8QGpiYqTmIPwB+jAv7Wg6kzbt7H0GGZwlUCtHqo7OUFnF9dc++BtDLNKUCNchnh6UA==", "requires": { "atom-grammar-test": "^0.6.3", - "tree-sitter-embedded-template": "^0.13.0", - "tree-sitter-html": "^0.13.2" + "tree-sitter-embedded-template": "^0.15.0", + "tree-sitter-html": "^0.15.0" } }, "language-hyperlink": { @@ -3933,12 +3933,12 @@ "integrity": "sha512-QXVHoj0eJDbl3pJK+Dm0+vnR1yRB80lSrvThwoVnnxsNphovsglXSGkhHoZ6RbEwkX9fEhtwOrhLUspT2NkG3A==" }, "language-javascript": { - "version": "https://www.atom.io/api/packages/language-javascript/versions/0.130.0/tarball", - "integrity": "sha512-PHuHeuHivsm8gYZR2FopxhBMIbapFFLdztyao7E9D/qDlayyTGHoGzBVPMBPXWCOh/JUnco8JArhOCAOv83Mng==", + "version": "https://www.atom.io/api/packages/language-javascript/versions/0.130.1/tarball", + "integrity": "sha512-KLz0V7EjpoYQxihWXYiNqFIdbZrOO4lMXg2K7ZA5y8/vb44reOQu1UnOwiC3f6kd1bPyJfv9zR2dUYoXVREy1Q==", "requires": { - "tree-sitter-javascript": "^0.13.10", - "tree-sitter-jsdoc": "^0.13.4", - "tree-sitter-regex": "^0.13.1" + "tree-sitter-javascript": "^0.15.0", + "tree-sitter-jsdoc": "^0.15.0", + "tree-sitter-regex": "^0.15.0" } }, "language-json": { @@ -3977,18 +3977,18 @@ "integrity": "sha512-HD6HI41u57i0/Tu9catiriURhJsef0RDrzJDkGDtdFkE9F9KPxC9Fayq2JBLJrhIyADRVXFxwxsfwQ2Jmh6hxg==" }, "language-python": { - "version": "https://www.atom.io/api/packages/language-python/versions/0.53.2/tarball", - "integrity": "sha512-ACNHWQWlRUfWrOb5MTvjP2wMTFdAq8Wnd3tWXYEd/TcfECtmCGy+6h33dt9X6SmAZz6OGKQ7V8lnVbOlh3X+Fw==", + "version": "https://www.atom.io/api/packages/language-python/versions/0.53.3/tarball", + "integrity": "sha512-oZJ1WLqpdkpx8ca08jG6BmP/S6YNyu15Q0qMQKAle6ucbK0MagdmpaEcTP/1PkIIncCLaYa1Kdi15QZ+mCva8Q==", "requires": { "atom-grammar-test": "^0.6.4", - "tree-sitter-python": "^0.14.0" + "tree-sitter-python": "^0.15.0" } }, "language-ruby": { - "version": "https://www.atom.io/api/packages/language-ruby/versions/0.72.16/tarball", - "integrity": "sha512-7Ju9OP+fIo5qvFWFLuSR8KJe7wldZYI8m3ToBcds4v0+Q8i7+xNO2marC0JD72uEiK/x26xP9pYv/isSqTQ4dg==", + "version": "https://www.atom.io/api/packages/language-ruby/versions/0.72.17/tarball", + "integrity": "sha512-Yz+Kq06P07qz6KrC3I9vkMf60HjWTFGZBr8XTZOFs1AyLlHdxhXOnm67Rimlb4deCbGjzLda2JhqRkbUq6Y9FQ==", "requires": { - "tree-sitter-ruby": "^0.13.12" + "tree-sitter-ruby": "^0.15.0" } }, "language-ruby-on-rails": { @@ -4006,10 +4006,10 @@ "integrity": "sha512-qaH8BDNBOkpbR4thmcRimEphnrzzhpDxeQM+WCM3Unp3a8r3aV2xcY9LlvbZxpclz8TOUyvuc5qgj1YI//ge9w==" }, "language-shellscript": { - "version": "https://www.atom.io/api/packages/language-shellscript/versions/0.27.11/tarball", - "integrity": "sha512-SgVIqPfJz47jaJOe8d6INI6dIJUhznSsyF3rIyePQoDzimjPIOsgrMQEXYjfHicVts/q4Pa6D6x8v/sn2fTgog==", + "version": "https://www.atom.io/api/packages/language-shellscript/versions/0.27.12/tarball", + "integrity": "sha512-qulEv2pSginsKhMuIrqjBLmuNIEHorAjhNQZRsycW+cKR4c4Py+NEoMoGETEJhzIgxDs7bw7vffbFNRHUCPLgA==", "requires": { - "tree-sitter-bash": "^0.13.9" + "tree-sitter-bash": "^0.15.0" } }, "language-source": { @@ -4033,10 +4033,10 @@ "integrity": "sha512-6xFDqM6nZpynmxGKUS85iUWY0yeub7GYvLyzSOqDejMuOL5UXAITnSNcb7jhr+hQA8KTj5dCmRjphkAQER4Ucg==" }, "language-typescript": { - "version": "https://www.atom.io/api/packages/language-typescript/versions/0.5.0/tarball", - "integrity": "sha512-rRArdgBSjIxfMceapfPil4n5fraIr3lBWGWuXpRqGvYkmB7scvt01MpbCvdKlJGz/KAd7wKG8criIYqBvy2QDg==", + "version": "https://www.atom.io/api/packages/language-typescript/versions/0.5.2/tarball", + "integrity": "sha512-ji8aJg5QOueUHwwljnhDX/MkGSNReAJ2U0JyrB1HHZSJuYz89w1uSYYkoUfwK05FOkMLQr8kPi6SruZyIcRCUQ==", "requires": { - "tree-sitter-typescript": "^0.14.0" + "tree-sitter-typescript": "^0.15.1" } }, "language-xml": { @@ -6526,26 +6526,26 @@ } }, "tree-sitter-bash": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/tree-sitter-bash/-/tree-sitter-bash-0.13.9.tgz", - "integrity": "sha512-b0L+QLS2eeIVrHnnbkFlvO1nElhPwqTxLIwyTeJytPYT0TS50Pe7bP+uPi3gkHT1YajxcauCxX1aDWDiZK1h5Q==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-bash/-/tree-sitter-bash-0.15.0.tgz", + "integrity": "sha512-rqXLK1S7ILV2W/mHrugruycDIJE/LXZzIqOUAWBXN4cTiFTcCnLlreTAu8nRqpxfPk76qQeJ9Os5D14Comg21Q==", "requires": { "nan": "^2.10.0", "prebuild-install": "^5.0.0" } }, "tree-sitter-c": { - "version": "0.13.13", - "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.13.13.tgz", - "integrity": "sha512-ToGn+YgTnidSN7Y1qYoEUlk6kws+WKsEL7G3GmQ62ZUhxE7Oumom65l+QS0JuQXpLeic4BWhXEhOKugOkYpqzA==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.15.0.tgz", + "integrity": "sha512-TCae6lqrzIoOL0LAbAoC//zrdzqyouJO7zp9qTfVJmlz/BEw5Z6UrnDYNt6n1t1ENPDVgUAjPI8dU0TuZfjF2A==", "requires": { "nan": "^2.10.0" } }, "tree-sitter-cpp": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/tree-sitter-cpp/-/tree-sitter-cpp-0.13.15.tgz", - "integrity": "sha512-S+29FaAfWFCkG02Lw0p4dVFRYnFua9Ua8tY+oFM9ZTgZMaBc7o5rfXVCxNIv5kXKdkHVq0TJWybsFJhtLlQuAw==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-cpp/-/tree-sitter-cpp-0.15.0.tgz", + "integrity": "sha512-ckK6eIGljzEaOrGRR+5aQGQTXgkTcV6iiqZJoSlPSCNbbSjQHztNRFFlV5yWwQxHnpGfgNUdHnQgnEqd3ffObQ==", "requires": { "nan": "^2.10.0" } @@ -6566,49 +6566,56 @@ } }, "tree-sitter-embedded-template": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/tree-sitter-embedded-template/-/tree-sitter-embedded-template-0.13.0.tgz", - "integrity": "sha512-IJVjMcL2Bg+qF+HibtEXTF4CE6A66ppGSqU8E+2ddn2pCqDtZGREhI+KfqerF9NpKSo1OtbvhXiEXPdXQANLGg==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-embedded-template/-/tree-sitter-embedded-template-0.15.0.tgz", + "integrity": "sha512-LyDtwopMlAHg3T4qeBCywKIMGC4A+a59Y4OaE0LO+UtPVgm5xC3kY+Rq3A9T3Dp6L4ZxZl+zL6LBQA5D0mMnlg==", "requires": { "nan": "^2.0.0" } }, "tree-sitter-go": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.13.3.tgz", - "integrity": "sha512-pXnlEDMwrCdnYaOzfEzlMlWqZEKDJXEG4bPvc9j5JSd7IYDWBrwxo+XXuraLSlbj1mJL2kKLIDO8cKDNxUscHw==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.15.0.tgz", + "integrity": "sha512-booht80IETCTTj79Yeicr0UmH9DhZeg8IA58Cf8evuARatbebsUQdh4Zg49Ye+15zVD663/LM+NxkmnJLfq2Rw==", "requires": { "nan": "^2.10.0" } }, "tree-sitter-html": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/tree-sitter-html/-/tree-sitter-html-0.13.5.tgz", - "integrity": "sha512-lawojfDlj/9ujEYvLoW4+WTTh2ocrYCYP2Dw5LmwxuvvE2lHr/D4RWA8W1N4jpR58tVef0SSqnnQwJkl1pNIeA==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-html/-/tree-sitter-html-0.15.0.tgz", + "integrity": "sha512-i8pUX4hNljVpo35D4S+8iopJBU6mS8XRbupjEycjsI7+FSBhr8tnMrx9hjjYhgKYCHdxTnYGTi9K7jc0p3gVDA==", "requires": { "nan": "^2.10.0" } }, "tree-sitter-javascript": { - "version": "0.13.10", - "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.13.10.tgz", - "integrity": "sha512-ku/841Nu7k/VXwI2ifm7xxv2cUiiYztLlIeYTYZXpjaIHMfFer5XZRgmZldJHVthTQ9uRMEr7UQ0qeqnWKzOlg==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.15.0.tgz", + "integrity": "sha512-1MJ1gO2Bp///UNexxUfGfh5A75Gb5qFxklAhQPgrbWSK6OgjgaHRiYMmW5tRMqoexSp3U2+9bp4j4Nc3Q2lEpg==", "requires": { - "nan": "^2.4.0" + "nan": "^2.12.1" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + } } }, "tree-sitter-jsdoc": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/tree-sitter-jsdoc/-/tree-sitter-jsdoc-0.13.4.tgz", - "integrity": "sha512-823BIawpN3JegYIhP3tTUlVO+Qc1iaGSl9CEiXt5Lun58TOV56HMnqq6iWgtdcMVcykO24C6Yeovqk+3y20FFw==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-jsdoc/-/tree-sitter-jsdoc-0.15.0.tgz", + "integrity": "sha512-Z5jPAYpB0ofLJYwXTr8oQLBMHqIzMNnpGYKaMVIMpt+wa6ee9pSyy4Uq/tMUQB3qxiYT+66Ij8hu4ou1TNW2CA==", "requires": { "nan": "^2.11.1" }, "dependencies": { "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, @@ -6621,34 +6628,34 @@ } }, "tree-sitter-python": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.14.0.tgz", - "integrity": "sha512-Kcj5AUdeI4/c/JLsQV8OFI0zLrwcQ1nKoqCRr+W73Tp5SIK+Dd1ILNC5TFHPw1IqOGstcg8AH0XTeU0uq3boZg==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.15.0.tgz", + "integrity": "sha512-lOV84DUTsyab8xRfU0o8pBQOKAZPjIJsGL7q0buuORHQvvwnvy3iwF/83OGSyiNYRJzPz6gW+E1N/VgNNavMHA==", "requires": { "nan": "^2.4.0" } }, "tree-sitter-regex": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/tree-sitter-regex/-/tree-sitter-regex-0.13.1.tgz", - "integrity": "sha512-A+ULuVOc37NOjmmmddqXMRwUq8g51FCRZ7YSupLdFcHngl1adI3nBRPskC9A8e++9jF+5fLytwA4X6uHW/v/mg==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-regex/-/tree-sitter-regex-0.15.0.tgz", + "integrity": "sha512-e6SWC2vvDwFlTrKZMiqrKz5+6YpOawjb4wh7VyQClpF5fjOC6AeQO0EB0+oWXXKcveFZK0Xdn+cB/zY0GHwYrg==", "requires": { "nan": "^2.10.0" } }, "tree-sitter-ruby": { - "version": "0.13.14", - "resolved": "https://registry.npmjs.org/tree-sitter-ruby/-/tree-sitter-ruby-0.13.14.tgz", - "integrity": "sha512-ye0Bpzp12HifMoocwhDVR0Adqo7DdR44anPHkx1qhhmdpzMdzsW7WzQYBTJjQo/iFXsgahl/Q9L7AwNI+2cKLw==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/tree-sitter-ruby/-/tree-sitter-ruby-0.15.0.tgz", + "integrity": "sha512-DWLepimzxB6miFLS2dRUQHvQKxEyd3nkzl4WuYvGZEeqiVb3Y4KbzCgk4LCuhmqb+nhONZEgHsNBSN0G6hcpGw==", "requires": { "nan": "^2.12.1", "prebuild-install": "^5.0.0" }, "dependencies": { "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" } } }, @@ -6661,9 +6668,9 @@ } }, "tree-sitter-typescript": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/tree-sitter-typescript/-/tree-sitter-typescript-0.14.0.tgz", - "integrity": "sha512-gx54LvIbjIdqSYGwau5G4Kr7j1oEwfWoZDKrR3jUlINEwskNOXaOzgsSdIM92JnFyqdBU+N6mBHpzjafbJ8EFw==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tree-sitter-typescript/-/tree-sitter-typescript-0.15.1.tgz", + "integrity": "sha512-xntREG9BE+zknNgcwmeVuq5/AT+lVCSUKvhX6T6KoZLk5OPY5EfHrTqGTxS97KDlSRiGfGPheOPMNzIgk/kwNQ==", "requires": { "nan": "^2.10.0" } diff --git a/package.json b/package.json index 0c6c7d185..7594bad3d 100644 --- a/package.json +++ b/package.json @@ -77,18 +77,18 @@ "jasmine-tagged": "^1.1.4", "key-path-helpers": "^0.4.0", "keybinding-resolver": "https://www.atom.io/api/packages/keybinding-resolver/versions/0.39.0/tarball", - "language-c": "https://www.atom.io/api/packages/language-c/versions/0.60.17/tarball", + "language-c": "https://www.atom.io/api/packages/language-c/versions/0.60.18/tarball", "language-clojure": "https://www.atom.io/api/packages/language-clojure/versions/0.22.8/tarball", "language-coffee-script": "https://www.atom.io/api/packages/language-coffee-script/versions/0.50.0/tarball", "language-csharp": "https://www.atom.io/api/packages/language-csharp/versions/1.1.0/tarball", "language-css": "https://www.atom.io/api/packages/language-css/versions/0.44.0/tarball", "language-gfm": "https://www.atom.io/api/packages/language-gfm/versions/0.90.6/tarball", "language-git": "https://www.atom.io/api/packages/language-git/versions/0.19.1/tarball", - "language-go": "https://www.atom.io/api/packages/language-go/versions/0.47.0/tarball", - "language-html": "https://www.atom.io/api/packages/language-html/versions/0.52.1/tarball", + "language-go": "https://www.atom.io/api/packages/language-go/versions/0.47.1/tarball", + "language-html": "https://www.atom.io/api/packages/language-html/versions/0.52.3/tarball", "language-hyperlink": "https://www.atom.io/api/packages/language-hyperlink/versions/0.17.1/tarball", "language-java": "https://www.atom.io/api/packages/language-java/versions/0.31.3/tarball", - "language-javascript": "https://www.atom.io/api/packages/language-javascript/versions/0.130.0/tarball", + "language-javascript": "https://www.atom.io/api/packages/language-javascript/versions/0.130.1/tarball", "language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.4/tarball", "language-less": "https://www.atom.io/api/packages/language-less/versions/0.34.3/tarball", "language-make": "https://www.atom.io/api/packages/language-make/versions/0.23.0/tarball", @@ -97,18 +97,18 @@ "language-perl": "https://www.atom.io/api/packages/language-perl/versions/0.38.1/tarball", "language-php": "https://www.atom.io/api/packages/language-php/versions/0.44.1/tarball", "language-property-list": "https://www.atom.io/api/packages/language-property-list/versions/0.9.1/tarball", - "language-python": "https://www.atom.io/api/packages/language-python/versions/0.53.2/tarball", - "language-ruby": "https://www.atom.io/api/packages/language-ruby/versions/0.72.16/tarball", + "language-python": "https://www.atom.io/api/packages/language-python/versions/0.53.3/tarball", + "language-ruby": "https://www.atom.io/api/packages/language-ruby/versions/0.72.17/tarball", "language-ruby-on-rails": "https://www.atom.io/api/packages/language-ruby-on-rails/versions/0.25.3/tarball", "language-rust-bundled": "file:packages/language-rust-bundled", "language-sass": "https://www.atom.io/api/packages/language-sass/versions/0.62.0/tarball", - "language-shellscript": "https://www.atom.io/api/packages/language-shellscript/versions/0.27.11/tarball", + "language-shellscript": "https://www.atom.io/api/packages/language-shellscript/versions/0.27.12/tarball", "language-source": "https://www.atom.io/api/packages/language-source/versions/0.9.0/tarball", "language-sql": "https://www.atom.io/api/packages/language-sql/versions/0.25.10/tarball", "language-text": "https://www.atom.io/api/packages/language-text/versions/0.7.4/tarball", "language-todo": "https://www.atom.io/api/packages/language-todo/versions/0.29.4/tarball", "language-toml": "https://www.atom.io/api/packages/language-toml/versions/0.20.0/tarball", - "language-typescript": "https://www.atom.io/api/packages/language-typescript/versions/0.5.0/tarball", + "language-typescript": "https://www.atom.io/api/packages/language-typescript/versions/0.5.2/tarball", "language-xml": "https://www.atom.io/api/packages/language-xml/versions/0.35.3/tarball", "language-yaml": "https://www.atom.io/api/packages/language-yaml/versions/0.32.0/tarball", "less-cache": "1.1.0", @@ -229,18 +229,18 @@ "welcome": "0.36.9", "whitespace": "0.37.7", "wrap-guide": "0.41.0", - "language-c": "0.60.17", + "language-c": "0.60.18", "language-clojure": "0.22.8", "language-coffee-script": "0.50.0", "language-csharp": "1.1.0", "language-css": "0.44.0", "language-gfm": "0.90.6", "language-git": "0.19.1", - "language-go": "0.47.0", - "language-html": "0.52.1", + "language-go": "0.47.1", + "language-html": "0.52.3", "language-hyperlink": "0.17.1", "language-java": "0.31.3", - "language-javascript": "0.130.0", + "language-javascript": "0.130.1", "language-json": "1.0.4", "language-less": "0.34.3", "language-make": "0.23.0", @@ -249,18 +249,18 @@ "language-perl": "0.38.1", "language-php": "0.44.1", "language-property-list": "0.9.1", - "language-python": "0.53.2", - "language-ruby": "0.72.16", + "language-python": "0.53.3", + "language-ruby": "0.72.17", "language-ruby-on-rails": "0.25.3", "language-rust-bundled": "file:./packages/language-rust-bundled", "language-sass": "0.62.0", - "language-shellscript": "0.27.11", + "language-shellscript": "0.27.12", "language-source": "0.9.0", "language-sql": "0.25.10", "language-text": "0.7.4", "language-todo": "0.29.4", "language-toml": "0.20.0", - "language-typescript": "0.5.0", + "language-typescript": "0.5.2", "language-xml": "0.35.3", "language-yaml": "0.32.0" }, diff --git a/spec/tree-sitter-language-mode-spec.js b/spec/tree-sitter-language-mode-spec.js index 8919a54ec..b3ae42b1c 100644 --- a/spec/tree-sitter-language-mode-spec.js +++ b/spec/tree-sitter-language-mode-spec.js @@ -1555,7 +1555,7 @@ describe('TreeSitterLanguageMode', () => { scopes: {}, folds: [ { - type: ['element', 'raw_element'], + type: ['element', 'script_element'], start: { index: 0 }, end: { index: -1 } } @@ -1696,7 +1696,7 @@ describe('TreeSitterLanguageMode', () => { parser: 'tree-sitter-html', scopes: { fragment: 'text.html', - raw_element: 'script.tag' + script_element: 'script.tag' }, injectionRegExp: 'html', injectionPoints: [SCRIPT_TAG_INJECTION_POINT] @@ -1859,7 +1859,7 @@ describe('TreeSitterLanguageMode', () => { 'text.html', 'fragment', 'element', - 'raw_element', + 'script_element', 'raw_text', 'program', 'expression_statement', @@ -2409,7 +2409,7 @@ const HTML_TEMPLATE_LITERAL_INJECTION_POINT = { }; const SCRIPT_TAG_INJECTION_POINT = { - type: 'raw_element', + type: 'script_element', language() { return 'javascript'; }, From 136ec1474e5f16bd8b6074f2827965950a8e171b Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 19 Jun 2019 09:16:19 +0200 Subject: [PATCH 162/184] Fix generation of release notes for nightly builds --- script/vsts/lib/release-notes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/lib/release-notes.js b/script/vsts/lib/release-notes.js index 360125148..144518d17 100644 --- a/script/vsts/lib/release-notes.js +++ b/script/vsts/lib/release-notes.js @@ -150,7 +150,7 @@ module.exports.generateForNightly = async function( ); } - return output; + return output.join('\n'); }; function extractWrittenReleaseNotes(oldReleaseNotes) { From ef8e5bc12a55d8281ddd4b71a3c4d28cf8242830 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 19 Jun 2019 09:42:42 +0200 Subject: [PATCH 163/184] Generate delta nightly updaters for windows We've recently updated to electron-winstaller@3.0.4, which includes a new version of Squirrel.Windows with the following fix: https://github.com/anaisbetts/NuGet/pull/1 Thanks to that fix we don't need anymore to disable delta nuget updaters, since that won't fail anymore. --- script/lib/create-windows-installer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 9308a3c2b..8b68f53a8 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -25,7 +25,6 @@ module.exports = packagedAppPath => { ), outputDirectory: CONFIG.buildOutputPath, noMsi: true, - noDelta: CONFIG.channel === 'nightly', // Delta packages are broken for nightly versions past nightly9 due to Squirrel/NuGet limitations remoteReleases: `${updateUrlPrefix}/api/updates${archSuffix}?version=${ CONFIG.computedAppVersion }`, From 2c516fb705e43dc8d8b0a546955ea2ea4268958a Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 19 Jun 2019 16:10:50 +0200 Subject: [PATCH 164/184] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20electron-winstalle?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this PR Atom uses a custom version of `electron-winstaller` named `@atom/electron-winstaller` which contains a custom version of `Squirrel.Windows` built from https://github.com/Squirrel/Squirrel.Windows/pull/149 This should fix the issues when upgrading from e.g nightly-9 to nightly-10 --- script/build | 2 +- script/lib/code-sign-on-windows.js | 1 + script/lib/create-windows-installer.js | 2 +- script/package-lock.json | 120 ++++++++++++------------- script/package.json | 2 +- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/script/build b/script/build index 5c1eb0575..9219edad2 100755 --- a/script/build +++ b/script/build @@ -109,7 +109,7 @@ if (!argv.generateApiDocs) { if (argv.codeSign) { const executablesToSign = [ path.join(packagedAppPath, 'Atom.exe') ] if (argv.createWindowsInstaller) { - executablesToSign.push(path.join(__dirname, 'node_modules', 'electron-winstaller', 'vendor', 'Squirrel.exe')) + executablesToSign.push(path.join(__dirname, 'node_modules', '@atom', 'electron-winstaller', 'vendor', 'Squirrel.exe')) } codeSignOnWindows(executablesToSign) } else { diff --git a/script/lib/code-sign-on-windows.js b/script/lib/code-sign-on-windows.js index 93bd3e65d..181f58c15 100644 --- a/script/lib/code-sign-on-windows.js +++ b/script/lib/code-sign-on-windows.js @@ -40,6 +40,7 @@ module.exports = function(filesToSign) { __dirname, '..', 'node_modules', + '@atom', 'electron-winstaller', 'vendor', 'signtool.exe' diff --git a/script/lib/create-windows-installer.js b/script/lib/create-windows-installer.js index 8b68f53a8..17171546a 100644 --- a/script/lib/create-windows-installer.js +++ b/script/lib/create-windows-installer.js @@ -1,6 +1,6 @@ 'use strict'; -const electronInstaller = require('electron-winstaller'); +const electronInstaller = require('@atom/electron-winstaller'); const fs = require('fs'); const glob = require('glob'); const path = require('path'); diff --git a/script/package-lock.json b/script/package-lock.json index 432c19cf9..9b3839dae 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -8,6 +8,66 @@ "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-4.0.2.tgz", "integrity": "sha512-XtGk+IF57pr852UK1AhQJXqmm1WmSgS5uISL+LPs0z/iAxXouMvdlLJrHPeukP6gd7yR2rDTMSMkHNODgwIq7A==" }, + "@atom/electron-winstaller": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@atom/electron-winstaller/-/electron-winstaller-0.0.1.tgz", + "integrity": "sha512-E8bGTBrhf4HsZZS5oPxQgx8XL2wCz04vi0gtYzQH+i9gpxdkuGuV+RHGAtQY+k+wbG5RVR89sB6ICMmhUYNi2Q==", + "requires": { + "@babel/runtime": "^7.3.4", + "asar": "^1.0.0", + "debug": "^4.1.1", + "fs-extra": "^7.0.1", + "lodash.template": "^4.2.2", + "pify": "^4.0.1", + "temp": "^0.9.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + }, + "temp": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.0.tgz", + "integrity": "sha512-YfUhPQCJoNQE5N+FJQcdPz63O3x3sdT4Xju69Gj4iZe0lBKOtnAMi0SLj9xKhGkcGhsxThvTJ/usxtFPo438zQ==", + "requires": { + "rimraf": "~2.6.2" + } + } + } + }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", @@ -2300,66 +2360,6 @@ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz", "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=" }, - "electron-winstaller": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-3.0.4.tgz", - "integrity": "sha512-u3wTQUzBBBGWbExkKvgKt69EMoF0xC8uLQS5vTXtwr97BH8ffSW8CcHvVGWRyRDIhg2AA+togKOKWr41wgCeiA==", - "requires": { - "@babel/runtime": "^7.3.4", - "asar": "^1.0.0", - "debug": "^4.1.1", - "fs-extra": "^7.0.1", - "lodash.template": "^4.2.2", - "pify": "^4.0.1", - "temp": "^0.9.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" - }, - "temp": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.0.tgz", - "integrity": "sha512-YfUhPQCJoNQE5N+FJQcdPz63O3x3sdT4Xju69Gj4iZe0lBKOtnAMi0SLj9xKhGkcGhsxThvTJ/usxtFPo438zQ==", - "requires": { - "rimraf": "~2.6.2" - } - } - } - }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", diff --git a/script/package.json b/script/package.json index c10f44a4e..35d0cf00e 100644 --- a/script/package.json +++ b/script/package.json @@ -14,7 +14,7 @@ "electron-link": "0.4.0", "electron-mksnapshot": "^3.1.10", "electron-packager": "12.2.0", - "electron-winstaller": "^3.0.4", + "@atom/electron-winstaller": "0.0.1", "eslint": "^5.16.0", "eslint-config-prettier": "^4.2.0", "eslint-config-standard": "^12.0.0", From 288cd124b7cb8faa6b826b01bcd829c5c86fb1d8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 19 Jun 2019 10:06:24 -0700 Subject: [PATCH 165/184] Fix exception when multiple language layers are not yet highlighted --- src/tree-sitter-language-mode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tree-sitter-language-mode.js b/src/tree-sitter-language-mode.js index 77d902cee..6d8c93368 100644 --- a/src/tree-sitter-language-mode.js +++ b/src/tree-sitter-language-mode.js @@ -1010,7 +1010,7 @@ class HighlightIterator { if ( next.offset === first.offset && next.atEnd === first.atEnd && - next.languageLayer.depth > first.languageLayer.depth + next.depth > first.depth ) { this.currentScopeIsCovered = true; return; @@ -1079,6 +1079,7 @@ class HighlightIterator { class LayerHighlightIterator { constructor(languageLayer, treeCursor) { this.languageLayer = languageLayer; + this.depth = this.languageLayer.depth; // The iterator is always positioned at either the start or the end of some node // in the syntax tree. From 7d5a52f755dff54374113916860bc295cbfaf01c Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Thu, 20 Jun 2019 11:47:15 +1000 Subject: [PATCH 166/184] clean up duplicate removal --- .../grammar-selector/lib/grammar-list-view.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 40cf457bd..536f45162 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -104,24 +104,13 @@ module.exports = class GrammarListView { }); if (atom.config.get('grammar-selector.hideDuplicateTextMateGrammars')) { - const oldGrammars = grammars; - grammars = []; const blacklist = new Set(); - for (const grammar of oldGrammars) { + grammars.forEach(grammar => { if (isTreeSitter(grammar)) { blacklist.add(grammar.name); - grammars.push(grammar); - } - } - atom.grammars.getGrammars({ textMateOnly: true }).forEach(grammar => { - if ( - grammar !== atom.grammars.nullGrammar && - grammar.name && - !blacklist.has(grammar.name) - ) { - grammars.push(grammar); } }); + grammars = grammars.filter(grammar => isTreeSitter(grammar) || !blacklist.has(grammar.name)); } grammars.sort((a, b) => { From 5b344aea6dc5bc327f92ebcd806a8b3e3609ee79 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Thu, 20 Jun 2019 12:02:18 +1000 Subject: [PATCH 167/184] fix lint --- packages/grammar-selector/lib/grammar-list-view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 536f45162..3250c0cd7 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -110,7 +110,9 @@ module.exports = class GrammarListView { blacklist.add(grammar.name); } }); - grammars = grammars.filter(grammar => isTreeSitter(grammar) || !blacklist.has(grammar.name)); + grammars = grammars.filter( + grammar => isTreeSitter(grammar) || !blacklist.has(grammar.name) + ); } grammars.sort((a, b) => { From 4cc1afbb68c9e48c3391910c73f9d4ff29fff4d4 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Thu, 20 Jun 2019 14:09:55 +1000 Subject: [PATCH 168/184] imitate public interface --- src/tree-sitter-grammar.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/tree-sitter-grammar.js b/src/tree-sitter-grammar.js index 07be7448c..c1a3227fe 100644 --- a/src/tree-sitter-grammar.js +++ b/src/tree-sitter-grammar.js @@ -119,6 +119,27 @@ module.exports = class TreeSitterGrammar { } } } + + /* + Section - Backward compatibility shims + */ + + onDidUpdate(callback) { + // do nothing + } + + tokenizeLines(text, compatibilityMode = true) { + return text + .split('\n') + .map(line => this.tokenizeLine(line, null, false)); + } + + tokenizeLine(line, ruleStack, firstLine) { + return { + value: line, + scopes: [this.scopeName] + }; + } }; const preprocessScopes = value => From 2cc3bff1bee4d994b2eaae5bb536a0621aea2bcd Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Thu, 20 Jun 2019 14:29:01 +1000 Subject: [PATCH 169/184] fix lint --- src/tree-sitter-grammar.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tree-sitter-grammar.js b/src/tree-sitter-grammar.js index c1a3227fe..e7e5e431d 100644 --- a/src/tree-sitter-grammar.js +++ b/src/tree-sitter-grammar.js @@ -129,9 +129,7 @@ module.exports = class TreeSitterGrammar { } tokenizeLines(text, compatibilityMode = true) { - return text - .split('\n') - .map(line => this.tokenizeLine(line, null, false)); + return text.split('\n').map(line => this.tokenizeLine(line, null, false)); } tokenizeLine(line, ruleStack, firstLine) { From a6c21292beab45531194a917721145551aa35451 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Thu, 20 Jun 2019 11:13:19 +0200 Subject: [PATCH 170/184] Publish nightly releases to atom repo on packagecloud.io --- script/vsts/nightly-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/vsts/nightly-release.yml b/script/vsts/nightly-release.yml index d0ae2239b..2faacf724 100644 --- a/script/vsts/nightly-release.yml +++ b/script/vsts/nightly-release.yml @@ -53,7 +53,7 @@ jobs: displayName: Download Release Artifacts - script: | - node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" + node $(Build.SourcesDirectory)\script\vsts\upload-artifacts.js --create-github-release --assets-path "$(System.ArtifactsDirectory)" --linux-repo-name "atom" env: GITHUB_TOKEN: $(GITHUB_TOKEN) ATOM_RELEASE_VERSION: $(ReleaseVersion) From 73274fb70a0a012319a72363f395fe8ccadb096a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Jun 2019 14:20:31 +0200 Subject: [PATCH 171/184] Run script/bootstrap for pull requests originated from forks --- script/vsts/platforms/macos.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index 042b2652e..a3f11c712 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -122,6 +122,16 @@ jobs: targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2' + # The artifact caching task does not work on forks, so we need to + # bootstrap again for pull requests coming from forked repositories. + - script: script/bootstrap + displayName: Bootstrap build environment + env: + CI: true + CI_PROVIDER: VSTS + NPM_BIN_PATH: /usr/local/bin/npm + condition: ne(variables['CacheRestored'], 'true') + - task: DownloadBuildArtifacts@0 displayName: Download atom-mac.zip inputs: From 6dcc0f1f749ab550cf3fd6c1e5e18777f52d62b3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Jun 2019 14:29:23 +0200 Subject: [PATCH 172/184] Use a different polkit policy name for each Atom channel on Linux Using the same name would generate an exception when trying to install more than one version of Atom at the same time. --- resources/linux/redhat/atom.spec.in | 2 +- script/lib/create-debian-package.js | 7 ++++++- script/lib/create-rpm-package.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/linux/redhat/atom.spec.in b/resources/linux/redhat/atom.spec.in index 7a4888895..7c3c4a768 100644 --- a/resources/linux/redhat/atom.spec.in +++ b/resources/linux/redhat/atom.spec.in @@ -52,5 +52,5 @@ cp "icons/16.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/16x16/apps <%= installDir %>/bin/<%= apmFileName %> <%= installDir %>/share/<%= appFileName %>/ <%= installDir %>/share/applications/<%= appFileName %>.desktop -<%= installDir %>/share/polkit-1/actions/atom.policy +<%= installDir %>/share/polkit-1/actions/<%= policyFileName %> <%= installDir %>/share/icons/hicolor/ diff --git a/script/lib/create-debian-package.js b/script/lib/create-debian-package.js index 4bc1a1dff..e79d256e8 100644 --- a/script/lib/create-debian-package.js +++ b/script/lib/create-debian-package.js @@ -209,7 +209,12 @@ module.exports = function(packagedAppPath) { ); fs.copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.policy'), - path.join(debianPackageShareDirPath, 'polkit-1', 'actions', 'atom.policy') + path.join( + debianPackageShareDirPath, + 'polkit-1', + 'actions', + `atom-${CONFIG.channel}.policy` + ) ); console.log(`Generating .deb file from ${debianPackageDirPath}`); diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 52f33d32a..46d768a41 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -19,6 +19,7 @@ module.exports = function(packagedAppPath) { // RPM versions can't have dashes or tildes in them. // (Ref.: https://twiki.cern.ch/twiki/bin/view/Main/RPMAndDebVersioning) const appVersion = CONFIG.appMetadata.version.replace(/-/g, '.'); + const policyFileName = `atom-${CONFIG.channel}.policy`; const rpmPackageDirPath = path.join(CONFIG.homeDirPath, 'rpmbuild'); const rpmPackageBuildDirPath = path.join(rpmPackageDirPath, 'BUILD'); @@ -114,7 +115,7 @@ module.exports = function(packagedAppPath) { console.log(`Copying atom.policy into "${rpmPackageBuildDirPath}"`); fs.copySync( path.join(CONFIG.repositoryRootPath, 'resources', 'linux', 'atom.policy'), - path.join(rpmPackageBuildDirPath, 'atom.policy') + path.join(rpmPackageBuildDirPath, policyFileName) ); console.log(`Generating .rpm package from "${rpmPackageDirPath}"`); From c52399b0434403272ac6cf2ae0373a790d7c9106 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Jun 2019 15:10:05 +0200 Subject: [PATCH 173/184] Update policy filename for RPM spec.in --- resources/linux/redhat/atom.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/linux/redhat/atom.spec.in b/resources/linux/redhat/atom.spec.in index 7c3c4a768..f1bd93e5e 100644 --- a/resources/linux/redhat/atom.spec.in +++ b/resources/linux/redhat/atom.spec.in @@ -26,7 +26,7 @@ chmod 755 "%{buildroot}/<%= installDir %>/bin/<%= appFileName %>" mkdir -p "%{buildroot}/<%= installDir %>/share/applications/" cp "<%= appFileName %>.desktop" "%{buildroot}/<%= installDir %>/share/applications/" mkdir -p "%{buildroot}/<%= installDir %>/share/polkit-1/actions/" -cp "atom.policy" "%{buildroot}/<%= installDir %>/share/polkit-1/actions/atom.policy" +cp "<%= policyFileName %>" "%{buildroot}/<%= installDir %>/share/polkit-1/actions/<%= policyFileName %>" mkdir -p "%{buildroot}/<%= installDir %>/share/icons/hicolor/1024x1024/apps" cp "icons/1024.png" "%{buildroot}/<%= installDir %>/share/icons/hicolor/1024x1024/apps/<%= appFileName %>.png" From 85567ff70e673fbdc68fc82bb1c3d537106dcbb2 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Jun 2019 15:11:15 +0200 Subject: [PATCH 174/184] Pass `policyFileName` variable to RPM spec template --- script/lib/create-rpm-package.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/create-rpm-package.js b/script/lib/create-rpm-package.js index 46d768a41..a8bd143dd 100644 --- a/script/lib/create-rpm-package.js +++ b/script/lib/create-rpm-package.js @@ -81,7 +81,8 @@ module.exports = function(packagedAppPath) { apmFileName: apmExecutableName, description: appDescription, installDir: '/usr', - version: appVersion + version: appVersion, + policyFileName }); fs.writeFileSync(rpmPackageSpecFilePath, rpmPackageSpecsContents); From e4add632d6016f17a7e7fe623d12444b598ab58b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 20 Jun 2019 09:52:47 -0600 Subject: [PATCH 175/184] :arrow_up: git-utils@5.6.1 to fix .gitignore edge cases Incorporates changes in https://github.com/atom/git-utils/pull/97 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3109d65ef..fa8d7b5d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3170,9 +3170,9 @@ } }, "git-utils": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.6.0.tgz", - "integrity": "sha512-eOBROJEQPQtkqzZe5V0m43YhKjhmzXTqULxlhoaCwORClnHtZIwkJQTS6THXRbvIqDq/cRHta85IqTbVzdvB5g==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/git-utils/-/git-utils-5.6.1.tgz", + "integrity": "sha512-wDF7vSbH940NupuMFC87As0x/VSke51P7xTnkdSlk96YN3tzOagXzBUNq5Nq16KOVuMSxcGj1l3qHF5VXl39Ng==", "requires": { "fs-plus": "^3.0.0", "nan": "^2.0.0" diff --git a/package.json b/package.json index 7594bad3d..6f44e1f64 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "fuzzaldrin": "^2.1", "fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.13.8/tarball", "git-diff": "file:packages/git-diff", - "git-utils": "5.6.0", + "git-utils": "5.6.1", "github": "https://www.atom.io/api/packages/github/versions/0.29.0/tarball", "glob": "^7.1.1", "go-to-line": "file:packages/go-to-line", From ed75930d21bfe873e152f54c1f59ac27c6c840f0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 20 Jun 2019 18:17:50 +0200 Subject: [PATCH 176/184] Upgrade npm on Azure Pipelines when running macOS tests --- script/vsts/platforms/macos.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index a3f11c712..a8674eaf9 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -115,6 +115,9 @@ jobs: versionSpec: 10.2.1 displayName: Install Node.js 10.2.1 + - script: npm install --global npm@6.2.0 + displayName: Update npm + - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 displayName: Restore node_modules cache inputs: From f65475d8558c68964c9cbed615d16801efc526a2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 20 Jun 2019 14:38:53 -0600 Subject: [PATCH 177/184] :arrow_up: find-and-replace@0.218.14 to fix flaky tests --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index fa8d7b5d9..2f299a248 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2841,8 +2841,8 @@ } }, "find-and-replace": { - "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.13/tarball", - "integrity": "sha512-pLWj62GTg/i2p3IKYLz3sbYtY7SDJvR6ZSOFBJuYNsGde6GBxIY5RLuITmgaHISbwt3q/jIy8DVYGbxVpeFm6A==", + "version": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.14/tarball", + "integrity": "sha512-ceaKDpLAyUmebe0q5aJ9vsiz3bZK8BAR9zDJwo3vl7Lb/GfK1QYrh8UllapOfltGdqCB59sKfAW/c3GBOzvrpA==", "requires": { "binary-search": "^1.3.3", "element-resize-detector": "^1.1.10", diff --git a/package.json b/package.json index 6f44e1f64..19bb8d1cb 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "etch": "^0.12.6", "event-kit": "^2.5.3", "exception-reporting": "file:packages/exception-reporting", - "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.13/tarball", + "find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.218.14/tarball", "find-parent-dir": "^0.3.0", "first-mate": "7.4.0", "focus-trap": "2.4.5", @@ -200,7 +200,7 @@ "dev-live-reload": "file:./packages/dev-live-reload", "encoding-selector": "0.23.9", "exception-reporting": "file:./packages/exception-reporting", - "find-and-replace": "0.218.13", + "find-and-replace": "0.218.14", "fuzzy-finder": "1.13.8", "github": "0.29.0", "git-diff": "file:./packages/git-diff", From a92c86f1946e2d8310cbed08a374076c50321883 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Fri, 21 Jun 2019 14:57:31 +1000 Subject: [PATCH 178/184] Default to no Tree-sitter grammars --- packages/grammar-selector/lib/grammar-list-view.js | 8 +++++--- src/grammar-registry.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/grammar-selector/lib/grammar-list-view.js b/packages/grammar-selector/lib/grammar-list-view.js index 3250c0cd7..cbd1528fe 100644 --- a/packages/grammar-selector/lib/grammar-list-view.js +++ b/packages/grammar-selector/lib/grammar-list-view.js @@ -99,9 +99,11 @@ module.exports = class GrammarListView { this.currentGrammar = this.autoDetect; } - let grammars = atom.grammars.getGrammars().filter(grammar => { - return grammar !== atom.grammars.nullGrammar && grammar.name; - }); + let grammars = atom.grammars + .getGrammars({ includeTreeSitter: true }) + .filter(grammar => { + return grammar !== atom.grammars.nullGrammar && grammar.name; + }); if (atom.config.get('grammar-selector.hideDuplicateTextMateGrammars')) { const blacklist = new Set(); diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 3542cc89c..223fa8357 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -618,13 +618,13 @@ module.exports = class GrammarRegistry { // Extended: Get all the grammars in this registry. // // * `options` (optional) {Object} - // * `textMateOnly` (optional) {Boolean} Set to ignore + // * `includeTreeSitter` (optional) {Boolean} Set to include // [Tree-sitter](https://github.blog/2018-10-31-atoms-new-parsing-system/) grammars // // Returns a non-empty {Array} of {Grammar} instances. getGrammars(params) { let tmGrammars = this.textmateRegistry.getGrammars(); - if (params && params.textMateOnly) return tmGrammars; + if (!(params && params.includeTreeSitter)) return tmGrammars; const tsGrammars = Object.values(this.treeSitterGrammarsById).filter( g => g.scopeName From cec3b058fb72960da24b735bfbdcd4d9dc976990 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Fri, 21 Jun 2019 15:19:36 +1000 Subject: [PATCH 179/184] restore tree-sitter in grammar iterator --- src/grammar-registry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grammar-registry.js b/src/grammar-registry.js index 223fa8357..5deda75e1 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -350,7 +350,7 @@ module.exports = class GrammarRegistry { } forEachGrammar(callback) { - this.grammars.forEach(callback); + this.getGrammars({ includeTreeSitter: true }).forEach(callback); } grammarForId(languageId) { From 166d968daa152ea9659587193d06f6aaa68331d0 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Fri, 21 Jun 2019 16:11:50 +1000 Subject: [PATCH 180/184] adjust specs --- spec/grammar-registry-spec.js | 8 ++++---- spec/workspace-spec.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/grammar-registry-spec.js b/spec/grammar-registry-spec.js index 8eddd06ac..2905092ff 100644 --- a/spec/grammar-registry-spec.js +++ b/spec/grammar-registry-spec.js @@ -882,14 +882,14 @@ describe('GrammarRegistry', () => { await atom.packages.activatePackage('language-javascript'); }); - it('returns both Tree-sitter and TextMate grammars by default', async () => { - const allGrammars = atom.grammars.getGrammars(); - const tmGrammars = atom.grammars.getGrammars({ textMateOnly: true }); + it('returns only Tree-sitter grammars by default', async () => { + const tmGrammars = atom.grammars.getGrammars(); + const allGrammars = atom.grammars.getGrammars({ includeTreeSitter: true }); expect(allGrammars.length).toBeGreaterThan(tmGrammars.length); }); it('executes the foreach callback on both Tree-sitter and TextMate grammars', async () => { - const numAllGrammars = atom.grammars.getGrammars().length; + const numAllGrammars = atom.grammars.getGrammars({ includeTreeSitter: true }).length; let i = 0; atom.grammars.forEachGrammar(() => i++); expect(i).toBe(numAllGrammars); diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 7a23283ec..5af18e3cc 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -1994,7 +1994,7 @@ describe('Workspace', () => { expect( atom2.grammars - .getGrammars() + .getGrammars({ includeTreeSitter: true }) .map(grammar => grammar.scopeName) .sort() ).toEqual([ From 9e1e647ec7394bf06dd2b9598469531333ddf311 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Fri, 21 Jun 2019 16:32:16 +1000 Subject: [PATCH 181/184] fix lint --- spec/grammar-registry-spec.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/grammar-registry-spec.js b/spec/grammar-registry-spec.js index 2905092ff..05fd98b18 100644 --- a/spec/grammar-registry-spec.js +++ b/spec/grammar-registry-spec.js @@ -884,12 +884,16 @@ describe('GrammarRegistry', () => { it('returns only Tree-sitter grammars by default', async () => { const tmGrammars = atom.grammars.getGrammars(); - const allGrammars = atom.grammars.getGrammars({ includeTreeSitter: true }); + const allGrammars = atom.grammars.getGrammars({ + includeTreeSitter: true + }); expect(allGrammars.length).toBeGreaterThan(tmGrammars.length); }); it('executes the foreach callback on both Tree-sitter and TextMate grammars', async () => { - const numAllGrammars = atom.grammars.getGrammars({ includeTreeSitter: true }).length; + const numAllGrammars = atom.grammars.getGrammars({ + includeTreeSitter: true + }).length; let i = 0; atom.grammars.forEachGrammar(() => i++); expect(i).toBe(numAllGrammars); From 5f220a8224f21aa33d0d52126935968cab133ef5 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Fri, 21 Jun 2019 19:44:24 +1000 Subject: [PATCH 182/184] fix spec --- packages/grammar-selector/spec/grammar-selector-spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grammar-selector/spec/grammar-selector-spec.js b/packages/grammar-selector/spec/grammar-selector-spec.js index 730fd620f..3e36b4c2e 100644 --- a/packages/grammar-selector/spec/grammar-selector-spec.js +++ b/packages/grammar-selector/spec/grammar-selector-spec.js @@ -33,7 +33,9 @@ describe('GrammarSelector', () => { // -1 for removing nullGrammar, +1 for adding "Auto Detect" // Tree-sitter names the regex and JSDoc grammars expect(grammarView.querySelectorAll('li').length).toBe( - atom.grammars.grammars.filter(g => g.name).length + atom.grammars + .getGrammars({ includeTreeSitter: true }) + .filter(g => g.name).length ); expect(grammarView.querySelectorAll('li')[0].textContent).toBe( 'Auto Detect' From 2d78a1fdf27666edb3815afd768b7ac40d0413e9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 21 Jun 2019 09:26:51 -0700 Subject: [PATCH 183/184] :arrow_up: tree-sitter for incremental parsing bugfix --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f299a248..63f01e405 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6510,9 +6510,9 @@ "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" }, "tree-sitter": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.5.tgz", - "integrity": "sha512-3rrww3lc9NNbbVPT1uGkvbom5Ivr/lZqpzru/x+S0Jnh/jHKACNz7ED1JiAPKfR89eLRJxBGh+ZV5g+QqQrQaw==", + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.15.6.tgz", + "integrity": "sha512-OYe9n9Td3iSoGpV39kOZymnjQfkzBaOOzaPEBsAZuBhoVsr+FjLl8IqqyQg8iNNJOEBI5Qc1LbDH1acVXVHIpA==", "requires": { "nan": "^2.13.2", "prebuild-install": "^5.0.0" diff --git a/package.json b/package.json index 19bb8d1cb..db056d36b 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "temp": "^0.9.0", "text-buffer": "13.17.0", "timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball", - "tree-sitter": "0.15.5", + "tree-sitter": "0.15.6", "tree-sitter-css": "^0.13.7", "tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.0/tarball", "typescript-simple": "1.0.0", From c96b4a9774ecb63bb8d4b93eedf673d4ce97a4fa Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Mon, 24 Jun 2019 14:47:40 -0500 Subject: [PATCH 184/184] fix comment docks --- src/workspace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workspace.js b/src/workspace.js index 1299187dd..9fd52faf7 100644 --- a/src/workspace.js +++ b/src/workspace.js @@ -76,7 +76,7 @@ const ALL_LOCATIONS = ['center', 'left', 'right', 'bottom']; // Returns a {String} containing a longer version of the title to display in // places like the window title or on tabs their short titles are ambiguous. // -// #### `onDidChangeTitle` +// #### `onDidChangeTitle(callback)` // // Called by the workspace so it can be notified when the item's title changes. // Must return a {Disposable}.