From 564692fd30e7c27695bb1bf79c882e4889140848 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Fri, 15 May 2015 11:38:48 -0700 Subject: [PATCH 01/74] Update initial paths with local paths only --- src/atom.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index 0d029b61d..2639eaca6 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -763,7 +763,8 @@ class Atom extends Model # Notify the browser project of the window's current project path watchProjectPath: -> @disposables.add @project.onDidChangePaths => - @constructor.updateLoadSetting('initialPaths', @project.getPaths()) + @constructor.updateLoadSetting('initialPaths', + @project.getPaths().filter((projectPath) -> fs.existsSync(projectPath))) exit: (status) -> app = remote.require('app') From d22eb697cc82b7dd88caf3420888772345efa922 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Mon, 18 May 2015 19:03:59 -0700 Subject: [PATCH 02/74] Include remote paths, but skip normalization in the save/restore execution flow --- src/atom.coffee | 3 +-- src/browser/atom-application.coffee | 9 ++++++++- src/default-directory-provider.coffee | 9 ++++++++- src/window-event-handler.coffee | 8 ++++---- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 2639eaca6..0d029b61d 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -763,8 +763,7 @@ class Atom extends Model # Notify the browser project of the window's current project path watchProjectPath: -> @disposables.add @project.onDidChangePaths => - @constructor.updateLoadSetting('initialPaths', - @project.getPaths().filter((projectPath) -> fs.existsSync(projectPath))) + @constructor.updateLoadSetting('initialPaths', @project.getPaths()) exit: (status) -> app = remote.require('app') diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index d81660a49..91e423d15 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -369,7 +369,12 @@ class AtomApplication # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, windowDimensions, profileStartup, window}={}) -> - pathsToOpen = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen) + pathsToOpen = pathsToOpen.map (pathToOpen) -> + if fs.existsSync(pathToOpen) + fs.normalize(pathToOpen) + else + pathToOpen + locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen) unless pidToKillWhenClosed or newWindow @@ -517,6 +522,8 @@ class AtomApplication new AtomWindow({bootstrapScript, @resourcePath, exitWhenDone, isSpec, specDirectory, devMode}) locationForPathToOpen: (pathToOpen) -> + {protocol} = url.parse(pathToOpen) + return {pathToOpen} if protocol? return {pathToOpen} unless pathToOpen return {pathToOpen} if fs.existsSync(pathToOpen) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 9e25e097b..0b3aef7c2 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -1,6 +1,7 @@ {Directory} = require 'pathwatcher' fs = require 'fs-plus' path = require 'path' +url = require 'url' module.exports = class DefaultDirectoryProvider @@ -21,7 +22,13 @@ class DefaultDirectoryProvider else projectPath - new Directory(directoryPath) + # TODO: Stop normalizing the path in pathwatcher's Directory. + directory = new Directory(directoryPath) + if (url.parse(directoryPath).protocol) + directory.path = directoryPath; + if (fs.isCaseInsensitive()) + directory.lowerCasePath = directoryPath.toLowerCase(); + directory # Public: Create a Directory that corresponds to the specified URI. # diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 7d67e87ab..aeeee279c 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -23,12 +23,12 @@ class WindowEventHandler if pathToOpen? and needsProjectPaths if fs.existsSync(pathToOpen) atom.project.addPath(pathToOpen) + else if fs.existsSync(path.dirname(pathToOpen)) + atom.project.addPath(path.dirname(pathToOpen)) else - dirToOpen = path.dirname(pathToOpen) - if fs.existsSync(dirToOpen) - atom.project.addPath(dirToOpen) + atom.project.addPath(pathToOpen) - unless fs.isDirectorySync(pathToOpen) + if fs.isFileSync(pathToOpen) atom.workspace?.open(pathToOpen, {initialLine, initialColumn}) return From 506dbfd098b7557c363a5bb01e50aba7e2dd8219 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 11:14:25 -0700 Subject: [PATCH 03/74] Remove the trailing semicolon --- src/default-directory-provider.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 0b3aef7c2..7c900ded6 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -25,9 +25,9 @@ class DefaultDirectoryProvider # TODO: Stop normalizing the path in pathwatcher's Directory. directory = new Directory(directoryPath) if (url.parse(directoryPath).protocol) - directory.path = directoryPath; + directory.path = directoryPath if (fs.isCaseInsensitive()) - directory.lowerCasePath = directoryPath.toLowerCase(); + directory.lowerCasePath = directoryPath.toLowerCase() directory # Public: Create a Directory that corresponds to the specified URI. From c3552c95bc7d699fa5d91412c4f235fa41d50b91 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 17:10:45 -0700 Subject: [PATCH 04/74] Address comments + add tests --- spec/default-directory-provider-spec.coffee | 6 ++++++ spec/window-spec.coffee | 11 +++++++++++ src/browser/atom-application.coffee | 3 +-- src/default-directory-provider.coffee | 4 ++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/spec/default-directory-provider-spec.coffee b/spec/default-directory-provider-spec.coffee index 69370a77b..357348c4a 100644 --- a/spec/default-directory-provider-spec.coffee +++ b/spec/default-directory-provider-spec.coffee @@ -31,6 +31,12 @@ describe "DefaultDirectoryProvider", -> directory = provider.directoryForURISync(file) expect(directory.getPath()).toEqual tmp + it "creates a Directory with a path as a uri when passed a uri", -> + provider = new DefaultDirectoryProvider() + uri = 'remote://server:6792/path/to/a/dir' + directory = provider.directoryForURISync(uri) + expect(directory.getPath()).toEqual uri + describe ".directoryForURI(uri)", -> it "returns a Promise that resolves to a Directory with a path that matches the uri", -> provider = new DefaultDirectoryProvider() diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 376a71ab3..94e605a36 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -293,3 +293,14 @@ describe "Window", -> pathToOpen = __dirname atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] expect(atom.workspace.open.callCount).toBe 0 + + describe "when the opened path is a uri", -> + it "adds it to the project's paths as is", -> + pathToOpen = 'remote://server:7644/some/dir/path' + atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] + + waitsFor -> + atom.project.getPaths().length is 1 + + runs -> + expect(atom.project.getPaths()[0]).toBe pathToOpen diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 91e423d15..aeab5bf07 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -522,9 +522,8 @@ class AtomApplication new AtomWindow({bootstrapScript, @resourcePath, exitWhenDone, isSpec, specDirectory, devMode}) locationForPathToOpen: (pathToOpen) -> - {protocol} = url.parse(pathToOpen) - return {pathToOpen} if protocol? return {pathToOpen} unless pathToOpen + return {pathToOpen} if url.parse(pathToOpen).protocol? return {pathToOpen} if fs.existsSync(pathToOpen) pathToOpen = pathToOpen.replace(/[:\s]+$/, '') diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 7c900ded6..96740f15a 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -24,9 +24,9 @@ class DefaultDirectoryProvider # TODO: Stop normalizing the path in pathwatcher's Directory. directory = new Directory(directoryPath) - if (url.parse(directoryPath).protocol) + if url.parse(directoryPath).protocol directory.path = directoryPath - if (fs.isCaseInsensitive()) + if fs.isCaseInsensitive() directory.lowerCasePath = directoryPath.toLowerCase() directory From 74ad38596a695a73e38419f916fc4ba79cf45ac3 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 17:38:06 -0700 Subject: [PATCH 05/74] Remove the normalization done by the default-directory-provider --- src/default-directory-provider.coffee | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 96740f15a..b29353ae2 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -15,16 +15,14 @@ class DefaultDirectoryProvider # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURISync: (uri) -> - projectPath = path.normalize(uri) - - directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) - path.dirname(projectPath) + directoryPath = if not fs.isDirectorySync(uri) and fs.isDirectorySync(path.dirname(uri)) + path.normalize(path.dirname(uri)) else - projectPath + uri # TODO: Stop normalizing the path in pathwatcher's Directory. directory = new Directory(directoryPath) - if url.parse(directoryPath).protocol + if url.parse(directoryPath).protocol? directory.path = directoryPath if fs.isCaseInsensitive() directory.lowerCasePath = directoryPath.toLowerCase() From 638d8cc13f60373d07f74e526a6831449eb1a5bd Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 17:39:34 -0700 Subject: [PATCH 06/74] trigger build --- src/default-directory-provider.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index b29353ae2..3257b9ac5 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -20,7 +20,7 @@ class DefaultDirectoryProvider else uri - # TODO: Stop normalizing the path in pathwatcher's Directory. + # TODO: Stop normalizing the path in pathwatcher Directory. directory = new Directory(directoryPath) if url.parse(directoryPath).protocol? directory.path = directoryPath From e7064bfc9d8e6663be076390ebd9d752e5bc3fb1 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 19:04:54 -0700 Subject: [PATCH 07/74] Fix tests + add integration test --- spec/integration/startup-spec.coffee | 10 ++++++++++ src/browser/main.coffee | 9 ++++++--- src/default-directory-provider.coffee | 14 +++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index 54817fedc..d2583ed27 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -227,3 +227,13 @@ describe "Starting Atom", -> [tempDirPath] [otherTempDirPath] ].sort() + + describe "opening a remote directory", -> + it "opens the parent directory and creates an empty text editor", -> + remoteDirectory = 'remote://server:3437/some/directory/path' + runAtom [remoteDirectory], {ATOM_HOME: atomHome}, (client) -> + client + .waitForWindowCount(1, 1000) + .waitForExist("atom-workspace", 5000) + .treeViewRootDirectories() + .then ({value}) -> expect(value).toEqual([remoteDirectory]) diff --git a/src/browser/main.coffee b/src/browser/main.coffee index 1af0526dd..a15a53f25 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -5,6 +5,7 @@ app = require 'app' fs = require 'fs-plus' path = require 'path' yargs = require 'yargs' +url = require 'url' nslog = require 'nslog' console.log = nslog @@ -45,9 +46,11 @@ start = -> cwd = args.executedFrom?.toString() or process.cwd() args.pathsToOpen = args.pathsToOpen.map (pathToOpen) -> - pathToOpen = fs.normalize(pathToOpen) - if cwd - path.resolve(cwd, pathToOpen) + normalizedPath = fs.normalize(pathToOpen) + if url.parse(pathToOpen || '').protocol? + pathToOpen + else if cwd + path.resolve(cwd, normalizedPath) else path.resolve(pathToOpen) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 3257b9ac5..01de244d8 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -15,14 +15,18 @@ class DefaultDirectoryProvider # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURISync: (uri) -> - directoryPath = if not fs.isDirectorySync(uri) and fs.isDirectorySync(path.dirname(uri)) - path.normalize(path.dirname(uri)) - else + normalizedPath = path.normalize(uri); + {protocol} = url.parse(uri || '') + directoryPath = if protocol? uri + else if not fs.isDirectorySync(normalizedPath) and fs.isDirectorySync(path.dirname(normalizedPath)) + path.dirname(normalizedPath) + else + normalizedPath - # TODO: Stop normalizing the path in pathwatcher Directory. + # TODO: Stop normalizing the path in pathwatcher's Directory. directory = new Directory(directoryPath) - if url.parse(directoryPath).protocol? + if protocol? directory.path = directoryPath if fs.isCaseInsensitive() directory.lowerCasePath = directoryPath.toLowerCase() From aab86b2e9de6d16ba44535f62e2deca40a594135 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 20:15:13 -0700 Subject: [PATCH 08/74] enforced test: code nits --- src/default-directory-provider.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index 01de244d8..da2d17593 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -15,8 +15,8 @@ class DefaultDirectoryProvider # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURISync: (uri) -> - normalizedPath = path.normalize(uri); - {protocol} = url.parse(uri || '') + normalizedPath = path.normalize(uri) + {protocol} = url.parse(uri) directoryPath = if protocol? uri else if not fs.isDirectorySync(normalizedPath) and fs.isDirectorySync(path.dirname(normalizedPath)) From d42a660f9be938988cf875013d8c1a19821d8bec Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 19 May 2015 22:01:26 -0700 Subject: [PATCH 09/74] enforced code nit 2 --- src/browser/main.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/main.coffee b/src/browser/main.coffee index a15a53f25..371dd71ea 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -47,7 +47,7 @@ start = -> cwd = args.executedFrom?.toString() or process.cwd() args.pathsToOpen = args.pathsToOpen.map (pathToOpen) -> normalizedPath = fs.normalize(pathToOpen) - if url.parse(pathToOpen || '').protocol? + if url.parse(pathToOpen).protocol? pathToOpen else if cwd path.resolve(cwd, normalizedPath) From 06217293418947cbc0acdf1fe4a1f7289bc22309 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 21 May 2015 17:57:26 -0700 Subject: [PATCH 10/74] :arrow_up: text-buffer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be07a083a..d4d40b58b 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "6.0.2", + "text-buffer": "6.1.0", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", From 186a9ee05aad42bcca1be1b5c17248f07c18ef96 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 21 May 2015 23:12:03 -0400 Subject: [PATCH 11/74] Lint for even more style errors --- coffeelint.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/coffeelint.json b/coffeelint.json index f3caf09cc..6de95f1d7 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -27,5 +27,17 @@ "braces_spacing": { "spaces": 0, "level": "error" + }, + "space_operators": { + "level": "error" + }, + "spacing_after_comma": { + "level": "error" + }, + "no_stand_alone_at": { + "level": "error" + }, + "newlines_after_classes": { + "level": "error" } } From 0b34de005cfbff82c972830aa3bbe3938c7bec4f Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Fri, 22 May 2015 06:00:10 +0200 Subject: [PATCH 12/74] Remove mention of incorrect keybind The dev mode keybind `cmd-shift-o` was changed a while ago. --- docs/contributing-to-packages.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/contributing-to-packages.md b/docs/contributing-to-packages.md index 42de6e37b..4576635ff 100644 --- a/docs/contributing-to-packages.md +++ b/docs/contributing-to-packages.md @@ -40,9 +40,8 @@ For this reason, you'll only want to load packages in **development mode** while you are working on them. You'll perform your editing in **stable mode**, only switching to development mode to test your changes. -To open a development mode window, use the "Application: Open Dev" command, -which is normally bound to `cmd-shift-o`. You can also run dev mode from the -command line with `atom --dev`. +To open a development mode window, use the "Application: Open Dev" command. +You can also run dev mode from the command line with `atom --dev`. To load your package in development mode, create a symlink to it in `~/.atom/dev/packages`. This occurs automatically when you clone the package From 5be251321c49f6132aa97e3286cb4ca5af610997 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 08:45:30 -0400 Subject: [PATCH 13/74] Skip linting fixtures --- .coffeelintignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .coffeelintignore diff --git a/.coffeelintignore b/.coffeelintignore new file mode 100644 index 000000000..1db51fed7 --- /dev/null +++ b/.coffeelintignore @@ -0,0 +1 @@ +spec/fixtures From 42d7a1b428b7f00a000b93dd3cf75e26267fae5c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 22 May 2015 08:28:14 -0700 Subject: [PATCH 14/74] :arrow_up: atom-keymap@5.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4d40b58b..fb1f099bb 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^5.1.2", + "atom-keymap": "^5.1.3", "atom-space-pen-views": "^2.0.4", "babel-core": "^5.1.11", "bootstrap": "^3.3.4", From 96f425c292dce0f45ec2e4c7950589af6a0d4f77 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 22 May 2015 08:54:08 -0700 Subject: [PATCH 15/74] :arrow_up: language-todo@0.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb1f099bb..ef72e421c 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "language-source": "0.9.0", "language-sql": "0.15.0", "language-text": "0.6.0", - "language-todo": "0.21.0", + "language-todo": "0.22.0", "language-toml": "0.16.0", "language-xml": "0.30.0", "language-yaml": "0.22.0" From 39e402d0c8a42270c5e05c98f0507516c733a76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Fri, 22 May 2015 14:18:30 -0400 Subject: [PATCH 16/74] :fire: Remove space_operators rule --- coffeelint.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/coffeelint.json b/coffeelint.json index 6de95f1d7..624d927ad 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -28,9 +28,6 @@ "spaces": 0, "level": "error" }, - "space_operators": { - "level": "error" - }, "spacing_after_comma": { "level": "error" }, From 6666a25da7ab3aa877748b5490b256014ea974a7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 22 May 2015 12:08:32 -0700 Subject: [PATCH 17/74] :arrow_up: text-buffer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef72e421c..f451e1bcd 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "6.1.0", + "text-buffer": "6.1.1", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", From b0dd7b974f60d3146b33a5581ee37a44f6d5e83d Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Fri, 22 May 2015 12:49:25 -0700 Subject: [PATCH 18/74] Fix integration tests --- src/window-event-handler.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index aeeee279c..0855b27a1 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -5,6 +5,7 @@ ipc = require 'ipc' shell = require 'shell' {Subscriber} = require 'emissary' fs = require 'fs-plus' +url = require 'url' # Handles low-level events related to the window. module.exports = @@ -28,7 +29,8 @@ class WindowEventHandler else atom.project.addPath(pathToOpen) - if fs.isFileSync(pathToOpen) + {protocol} = url.parse(pathToOpen) + unless fs.isDirectorySync(pathToOpen) or protocol? atom.workspace?.open(pathToOpen, {initialLine, initialColumn}) return From ffd3d7a61f0696ee2c0d2723738cb58c968948fd Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 16:07:07 -0400 Subject: [PATCH 19/74] Require 2 newlines after class definitions --- coffeelint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/coffeelint.json b/coffeelint.json index 624d927ad..9ee65d6e5 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -35,6 +35,7 @@ "level": "error" }, "newlines_after_classes": { + "value": 2, "level": "error" } } From d5bcc0433d1501b8b2cb343bf6c3a4257ca712ce Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 16:29:12 -0400 Subject: [PATCH 20/74] WIP: :shirt: Fix linter errors --- spec/display-buffer-spec.coffee | 6 +++--- spec/selection-spec.coffee | 12 ++++++------ spec/text-editor-element-spec.coffee | 2 +- spec/tokenized-buffer-spec.coffee | 20 ++++++++++---------- spec/workspace-spec.coffee | 2 +- src/browser/atom-application.coffee | 2 +- src/cursor.coffee | 6 +++--- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index be89db8ac..140ca2f9e 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -44,7 +44,7 @@ describe "DisplayBuffer", -> it "renders line numbers correctly", -> originalLineCount = displayBuffer.getLineCount() oneHundredLines = [0..100].join("\n") - buffer.insert([0,0], oneHundredLines) + buffer.insert([0, 0], oneHundredLines) expect(displayBuffer.getLineCount()).toBe 100 + originalLineCount it "reassigns the scrollTop if it exceeds the max possible value after lines are removed", -> @@ -382,10 +382,10 @@ describe "DisplayBuffer", -> describe "when creating a fold where one already exists", -> it "returns existing fold and does't create new fold", -> - fold = displayBuffer.createFold(0,10) + fold = displayBuffer.createFold(0, 10) expect(displayBuffer.findMarkers(class: 'fold').length).toBe 1 - newFold = displayBuffer.createFold(0,10) + newFold = displayBuffer.createFold(0, 10) expect(newFold).toBe fold expect(displayBuffer.findMarkers(class: 'fold').length).toBe 1 diff --git a/spec/selection-spec.coffee b/spec/selection-spec.coffee index 0e64b60fd..bdccb799d 100644 --- a/spec/selection-spec.coffee +++ b/spec/selection-spec.coffee @@ -14,18 +14,18 @@ describe "Selection", -> describe ".deleteSelectedText()", -> describe "when nothing is selected", -> it "deletes nothing", -> - selection.setBufferRange [[0,3], [0,3]] + selection.setBufferRange [[0, 3], [0, 3]] selection.deleteSelectedText() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" describe "when one line is selected", -> it "deletes selected text and clears the selection", -> - selection.setBufferRange [[0,4], [0,14]] + selection.setBufferRange [[0, 4], [0, 14]] selection.deleteSelectedText() expect(buffer.lineForRow(0)).toBe "var = function () {" endOfLine = buffer.lineForRow(0).length - selection.setBufferRange [[0,0], [0, endOfLine]] + selection.setBufferRange [[0, 0], [0, endOfLine]] selection.deleteSelectedText() expect(buffer.lineForRow(0)).toBe "" @@ -33,15 +33,15 @@ describe "Selection", -> describe "when multiple lines are selected", -> it "deletes selected text and clears the selection", -> - selection.setBufferRange [[0,1], [2,39]] + selection.setBufferRange [[0, 1], [2, 39]] selection.deleteSelectedText() expect(buffer.lineForRow(0)).toBe "v;" expect(selection.isEmpty()).toBeTruthy() describe "when the cursor precedes the tail", -> it "deletes selected text and clears the selection", -> - selection.cursor.setScreenPosition [0,13] - selection.selectToScreenPosition [0,4] + selection.cursor.setScreenPosition [0, 13] + selection.selectToScreenPosition [0, 4] selection.delete() expect(buffer.lineForRow(0)).toBe "var = function () {" diff --git a/spec/text-editor-element-spec.coffee b/spec/text-editor-element-spec.coffee index 435b3a4a5..ea5f55968 100644 --- a/spec/text-editor-element-spec.coffee +++ b/spec/text-editor-element-spec.coffee @@ -83,7 +83,7 @@ describe "TextEditorElement", -> editor = new TextEditor editor.setText('1\n2\n3') editor.addGutter({name: 'test-gutter'}) - marker = editor.markBufferRange([[0,0],[2,0]]) + marker = editor.markBufferRange([[0, 0], [2, 0]]) editor.decorateMarker(marker, {type: 'gutter', gutterName: 'test-gutter'}) element = atom.views.getView(editor) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 45cc03a44..9d94cb80a 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -287,7 +287,7 @@ describe "TokenizedBuffer", -> describe "when there is an insertion that is larger than the chunk size", -> it "tokenizes the initial chunk synchronously, then tokenizes the remaining lines in the background", -> commentBlock = _.multiplyString("// a comment\n", tokenizedBuffer.chunkSize + 2) - buffer.insert([0,0], commentBlock) + buffer.insert([0, 0], commentBlock) expect(tokenizedBuffer.tokenizedLineForRow(0).ruleStack?).toBeTruthy() expect(tokenizedBuffer.tokenizedLineForRow(4).ruleStack?).toBeTruthy() expect(tokenizedBuffer.tokenizedLineForRow(5).ruleStack?).toBeFalsy() @@ -541,7 +541,7 @@ describe "TokenizedBuffer", -> runs -> fullyTokenize(tokenizedBuffer) {tokens} = tokenizedBuffer.tokenizedLineForRow(0) - expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"] + expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby", "meta.tag.block.any.html", "punctuation.definition.tag.begin.html"] describe ".tokenForPosition(position)", -> afterEach -> @@ -552,9 +552,9 @@ describe "TokenizedBuffer", -> buffer = atom.project.bufferForPathSync('sample.js') tokenizedBuffer = new TokenizedBuffer({buffer}) fullyTokenize(tokenizedBuffer) - expect(tokenizedBuffer.tokenForPosition([1,0]).scopes).toEqual ["source.js"] - expect(tokenizedBuffer.tokenForPosition([1,1]).scopes).toEqual ["source.js"] - expect(tokenizedBuffer.tokenForPosition([1,2]).scopes).toEqual ["source.js", "storage.modifier.js"] + expect(tokenizedBuffer.tokenForPosition([1, 0]).scopes).toEqual ["source.js"] + expect(tokenizedBuffer.tokenForPosition([1, 1]).scopes).toEqual ["source.js"] + expect(tokenizedBuffer.tokenForPosition([1, 2]).scopes).toEqual ["source.js", "storage.modifier.js"] describe ".bufferRangeForScopeAtPosition(selector, position)", -> beforeEach -> @@ -580,20 +580,20 @@ describe "TokenizedBuffer", -> buffer.setText('\ttest') tokenizedBuffer = new TokenizedBuffer({buffer}) fullyTokenize(tokenizedBuffer) - expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' ' + expect(tokenizedBuffer.tokenForPosition([0, 0]).value).toBe ' ' atom.config.set('editor.tabLength', 6) - expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' ' + expect(tokenizedBuffer.tokenForPosition([0, 0]).value).toBe ' ' it "does not allow the tab length to be less than 1", -> buffer = atom.project.bufferForPathSync('sample.js') buffer.setText('\ttest') tokenizedBuffer = new TokenizedBuffer({buffer}) fullyTokenize(tokenizedBuffer) - expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' ' + expect(tokenizedBuffer.tokenForPosition([0, 0]).value).toBe ' ' atom.config.set('editor.tabLength', 1) - expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' ' + expect(tokenizedBuffer.tokenForPosition([0, 0]).value).toBe ' ' atom.config.set('editor.tabLength', 0) - expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' ' + expect(tokenizedBuffer.tokenForPosition([0, 0]).value).toBe ' ' describe "when the invisibles value changes", -> beforeEach -> diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 0b32ff31f..009f95a1c 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -1027,7 +1027,7 @@ describe "Workspace", -> atom.project.open('sample.js').then (o) -> editor = o runs -> - editor.buffer.setTextInRange([[0,0],[0,0]], 'omg') + editor.buffer.setTextInRange([[0, 0], [0, 0]], 'omg') expect(editor.isModified()).toBeTruthy() waitsForPromise -> diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index d81660a49..1b2aa2e86 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -174,7 +174,7 @@ class AtomApplication @on 'application:open-safe', -> @promptForPathToOpen('all', safeMode: true) @on 'application:open-api-preview', -> @promptForPathToOpen('all', apiPreviewMode: true) @on 'application:open-dev-api-preview', -> @promptForPathToOpen('all', {apiPreviewMode: true, devMode: true}) - @on 'application:inspect', ({x,y, atomWindow}) -> + @on 'application:inspect', ({x, y, atomWindow}) -> atomWindow ?= @focusedWindow() atomWindow?.browserWindow.inspectElement(x, y) diff --git a/src/cursor.coffee b/src/cursor.coffee index b54cc6bcd..0681e51ca 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -333,7 +333,7 @@ class Cursor extends Model # Public: Moves the cursor to the top of the buffer. moveToTop: -> - @setBufferPosition([0,0]) + @setBufferPosition([0, 0]) # Public: Moves the cursor to the bottom of the buffer. moveToBottom: -> @@ -673,9 +673,9 @@ class Cursor extends Model start = @getBufferPosition() {row, column} = start - scanRange = [[row-1, column], [0,0]] + scanRange = [[row-1, column], [0, 0]] position = new Point(0, 0) - zero = new Point(0,0) + zero = new Point(0, 0) @editor.backwardsScanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> unless range.start.isEqual(zero) position = range.start From 10d5229b806db975084048851d2c75cd7139616f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 22 May 2015 13:49:48 -0700 Subject: [PATCH 21/74] :arrow_up: language-css@0.30 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f451e1bcd..efffa073e 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "language-clojure": "0.15.0", "language-coffee-script": "0.40.0", "language-csharp": "0.5.0", - "language-css": "0.29.0", + "language-css": "0.30.0", "language-gfm": "0.76.0", "language-git": "0.10.0", "language-go": "0.26.0", From 52beb9a2413811cbd8cee63960f6be4940937498 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 22 May 2015 13:51:08 -0700 Subject: [PATCH 22/74] :arrow_up: wrap-guide@0.34 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efffa073e..9abb93abd 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "update-package-dependencies": "0.10.0", "welcome": "0.27.0", "whitespace": "0.29.0", - "wrap-guide": "0.33.0", + "wrap-guide": "0.34.0", "language-c": "0.44.0", "language-clojure": "0.15.0", "language-coffee-script": "0.40.0", From ec5b807056ae10a43d0853f21d9d0ae24417ac11 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 22 May 2015 13:55:58 -0700 Subject: [PATCH 23/74] :arrow_up: text-buffer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9abb93abd..b22bee26e 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "6.1.1", + "text-buffer": "6.1.2", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", From 82958d5aa09cc346ee26a430cf2c6f9526731d24 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 17:03:06 -0400 Subject: [PATCH 24/74] WIP: :shirt: Fix even more linter errors --- spec/language-mode-spec.coffee | 20 ++++++------ spec/text-editor-presenter-spec.coffee | 12 ++++---- spec/text-editor-spec.coffee | 42 +++++++++++++------------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index 47fa30bdf..9c4fc2c1e 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -134,23 +134,23 @@ describe "LanguageMode", -> it "will limit paragraph range to comments", -> range = languageMode.rowRangeForParagraphAtBufferRow(0) - expect(range).toEqual [[0,0], [0,29]] + expect(range).toEqual [[0, 0], [0, 29]] range = languageMode.rowRangeForParagraphAtBufferRow(10) - expect(range).toEqual [[10,0], [10,14]] + expect(range).toEqual [[10, 0], [10, 14]] range = languageMode.rowRangeForParagraphAtBufferRow(11) expect(range).toBeFalsy() range = languageMode.rowRangeForParagraphAtBufferRow(12) - expect(range).toEqual [[12,0], [13,10]] + expect(range).toEqual [[12, 0], [13, 10]] range = languageMode.rowRangeForParagraphAtBufferRow(14) - expect(range).toEqual [[14,0], [14,32]] + expect(range).toEqual [[14, 0], [14, 32]] range = languageMode.rowRangeForParagraphAtBufferRow(15) - expect(range).toEqual [[15,0], [15,26]] + expect(range).toEqual [[15, 0], [15, 26]] range = languageMode.rowRangeForParagraphAtBufferRow(18) - expect(range).toEqual [[17,0], [19,3]] + expect(range).toEqual [[17, 0], [19, 3]] describe "coffeescript", -> beforeEach -> @@ -305,9 +305,9 @@ describe "LanguageMode", -> atom.packages.unloadPackages() it "maintains cursor buffer position when a folding/unfolding", -> - editor.setCursorBufferPosition([5,5]) + editor.setCursorBufferPosition([5, 5]) languageMode.foldAll() - expect(editor.getCursorBufferPosition()).toEqual([5,5]) + expect(editor.getCursorBufferPosition()).toEqual([5, 5]) describe ".unfoldAll()", -> it "unfolds every folded line", -> @@ -359,7 +359,7 @@ describe "LanguageMode", -> describe "when the bufferRow is in a multi-line comment", -> it "searches upward and downward for surrounding comment lines and folds them as a single fold", -> - buffer.insert([1,0], " //this is a comment\n // and\n //more docs\n\n//second comment") + buffer.insert([1, 0], " //this is a comment\n // and\n //more docs\n\n//second comment") languageMode.foldBufferRow(1) fold = editor.tokenizedLineForScreenRow(1).fold expect(fold.getStartRow()).toBe 1 @@ -367,7 +367,7 @@ describe "LanguageMode", -> describe "when the bufferRow is a single-line comment", -> it "searches upward for the first row that begins a syntatic region containing the folded row (and folds it)", -> - buffer.insert([1,0], " //this is a single line comment\n") + buffer.insert([1, 0], " //this is a single line comment\n") languageMode.foldBufferRow(1) fold = editor.tokenizedLineForScreenRow(0).fold expect(fold.getStartRow()).toBe 0 diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index d15c4759d..1ad18da5a 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -2227,11 +2227,11 @@ describe "TextEditorPresenter", -> gutterName: 'test-gutter' class: 'test-class' item: decorationItem - marker1 = editor.markBufferRange([[0,0],[1,0]]) + marker1 = editor.markBufferRange([[0, 0], [1, 0]]) decoration1 = editor.decorateMarker(marker1, decorationParams) - marker2 = editor.markBufferRange([[9,0],[12,0]]) + marker2 = editor.markBufferRange([[9, 0], [12, 0]]) decoration2 = editor.decorateMarker(marker2, decorationParams) - marker3 = editor.markBufferRange([[13,0],[14,0]]) + marker3 = editor.markBufferRange([[13, 0], [14, 0]]) decoration3 = editor.decorateMarker(marker3, decorationParams) # Clear any batched state updates. @@ -2280,7 +2280,7 @@ describe "TextEditorPresenter", -> it "updates when the editor's content changes", -> # This update will add enough lines to push decoration2 out of view. - expectStateUpdate presenter, -> editor.setTextInBufferRange([[8,0],[9,0]],'\n\n\n\n\n') + expectStateUpdate presenter, -> editor.setTextInBufferRange([[8, 0], [9, 0]], '\n\n\n\n\n') decorationState = getContentForGutterWithName(presenter, 'test-gutter') expect(decorationState[decoration1.id].top).toBeDefined() @@ -2290,7 +2290,7 @@ describe "TextEditorPresenter", -> it "updates when a decoration's marker is modified", -> # This update will move decoration1 out of view. expectStateUpdate presenter, -> - newRange = new Range([13,0],[14,0]) + newRange = new Range([13, 0], [14, 0]) marker1.setBufferRange(newRange) decorationState = getContentForGutterWithName(presenter, 'test-gutter') @@ -2401,7 +2401,7 @@ describe "TextEditorPresenter", -> type: 'gutter' gutterName: 'test-gutter-2' class: 'test-class' - marker4 = editor.markBufferRange([[0,0],[1,0]]) + marker4 = editor.markBufferRange([[0, 0], [1, 0]]) decoration4 = editor.decorateMarker(marker4, decorationParams) expectStateUpdate presenter, -> editor.addGutter({name: 'test-gutter-2'}) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index a845619ba..bf675fdf9 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -227,7 +227,7 @@ describe "TextEditor", -> describe "when the cursor moves", -> it "clears a goal column established by vertical movement", -> editor.setText('b') - editor.setCursorBufferPosition([0,0]) + editor.setCursorBufferPosition([0, 0]) editor.insertNewline() editor.moveUp() editor.insertText('a') @@ -262,7 +262,7 @@ describe "TextEditor", -> expect(editor.getCursorScreenPosition().column).not.toBe 6 # clear the goal column by explicitly setting the cursor position - editor.setCursorScreenPosition([4,6]) + editor.setCursorScreenPosition([4, 6]) expect(editor.getCursorScreenPosition().column).toBe 6 editor.moveDown() @@ -317,7 +317,7 @@ describe "TextEditor", -> describe "when there is a selection", -> beforeEach -> - editor.setSelectedBufferRange([[4, 9],[5, 10]]) + editor.setSelectedBufferRange([[4, 9], [5, 10]]) it "moves above the selection", -> cursor = editor.getLastCursor() @@ -330,7 +330,7 @@ describe "TextEditor", -> editor.moveUp() expect(editor.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [0,0] + expect(cursor1.getBufferPosition()).toEqual [0, 0] describe "when the cursor was moved down from the beginning of an indented soft-wrapped line", -> it "moves to the beginning of the previous line", -> @@ -396,7 +396,7 @@ describe "TextEditor", -> describe "when there is a selection", -> beforeEach -> - editor.setSelectedBufferRange([[4, 9],[5, 10]]) + editor.setSelectedBufferRange([[4, 9], [5, 10]]) it "moves below the selection", -> cursor = editor.getLastCursor() @@ -410,7 +410,7 @@ describe "TextEditor", -> editor.moveDown() expect(editor.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [12,2] + expect(cursor1.getBufferPosition()).toEqual [12, 2] describe ".moveLeft()", -> it "moves the cursor by one column to the left", -> @@ -481,7 +481,7 @@ describe "TextEditor", -> describe "when there is a selection", -> beforeEach -> - editor.setSelectedBufferRange([[5, 22],[5, 27]]) + editor.setSelectedBufferRange([[5, 22], [5, 27]]) it "moves to the left of the selection", -> cursor = editor.getLastCursor() @@ -498,7 +498,7 @@ describe "TextEditor", -> [cursor1, cursor2] = editor.getCursors() editor.moveLeft() expect(editor.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [0,0] + expect(cursor1.getBufferPosition()).toEqual [0, 0] describe ".moveRight()", -> it "moves the cursor by one column to the right", -> @@ -578,15 +578,15 @@ describe "TextEditor", -> editor.addCursorAtScreenPosition [12,0] editor.moveToTop() expect(editor.getCursors().length).toBe 1 - expect(editor.getCursorBufferPosition()).toEqual [0,0] + expect(editor.getCursorBufferPosition()).toEqual [0, 0] describe ".moveToBottom()", -> it "moves the cusor to the bottom of the buffer", -> - editor.setCursorScreenPosition [0,0] - editor.addCursorAtScreenPosition [1,0] + editor.setCursorScreenPosition [0, 0] + editor.addCursorAtScreenPosition [1, 0] editor.moveToBottom() expect(editor.getCursors().length).toBe 1 - expect(editor.getCursorBufferPosition()).toEqual [12,2] + expect(editor.getCursorBufferPosition()).toEqual [12, 2] describe ".moveToBeginningOfScreenLine()", -> describe "when soft wrap is on", -> @@ -599,14 +599,14 @@ describe "TextEditor", -> expect(cursor.getScreenPosition()).toEqual [1, 0] describe "when soft wrap is off", -> - it "moves cursor to the beginning of then line", -> - editor.setCursorScreenPosition [0,5] - editor.addCursorAtScreenPosition [1,7] + it "moves cursor to the beginning of the line", -> + editor.setCursorScreenPosition [0, 5] + editor.addCursorAtScreenPosition [1, 7] editor.moveToBeginningOfScreenLine() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,0] + expect(cursor1.getBufferPosition()).toEqual [0, 0] + expect(cursor2.getBufferPosition()).toEqual [1, 0] describe ".moveToEndOfScreenLine()", -> describe "when soft wrap is on", -> @@ -620,13 +620,13 @@ describe "TextEditor", -> describe "when soft wrap is off", -> it "moves cursor to the end of line", -> - editor.setCursorScreenPosition [0,0] - editor.addCursorAtScreenPosition [1,0] + editor.setCursorScreenPosition [0, 0] + editor.addCursorAtScreenPosition [1, 0] editor.moveToEndOfScreenLine() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,29] - expect(cursor2.getBufferPosition()).toEqual [1,30] + expect(cursor1.getBufferPosition()).toEqual [0, 29] + expect(cursor2.getBufferPosition()).toEqual [1, 30] describe ".moveToBeginningOfLine()", -> it "moves cursor to the beginning of the buffer line", -> From 8ca1cf2c9821c7cdf6ae4ae7eb930c63908b566c Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 19:50:04 -0400 Subject: [PATCH 25/74] :shirt: Fix linter errors in text-editor-spec --- spec/text-editor-spec.coffee | 356 +++++++++++++++++------------------ 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index bf675fdf9..28dbaaff8 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -553,7 +553,7 @@ describe "TextEditor", -> describe "when there is a selection", -> beforeEach -> - editor.setSelectedBufferRange([[5, 22],[5, 27]]) + editor.setSelectedBufferRange([[5, 22], [5, 27]]) it "moves to the left of the selection", -> cursor = editor.getLastCursor() @@ -570,12 +570,12 @@ describe "TextEditor", -> editor.moveRight() expect(editor.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [12,2] + expect(cursor1.getBufferPosition()).toEqual [12, 2] describe ".moveToTop()", -> it "moves the cursor to the top of the buffer", -> - editor.setCursorScreenPosition [11,1] - editor.addCursorAtScreenPosition [12,0] + editor.setCursorScreenPosition [11, 1] + editor.addCursorAtScreenPosition [12, 0] editor.moveToTop() expect(editor.getCursors().length).toBe 1 expect(editor.getCursorBufferPosition()).toEqual [0, 0] @@ -651,58 +651,58 @@ describe "TextEditor", -> it "moves to the first character of the current screen line or the beginning of the screen line if it's already on the first character", -> editor.setSoftWrapped(true) editor.setEditorWidthInChars(10) - editor.setCursorScreenPosition [2,5] - editor.addCursorAtScreenPosition [8,7] + editor.setCursorScreenPosition [2, 5] + editor.addCursorAtScreenPosition [8, 7] editor.moveToFirstCharacterOfLine() [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getScreenPosition()).toEqual [2,0] - expect(cursor2.getScreenPosition()).toEqual [8,2] + expect(cursor1.getScreenPosition()).toEqual [2, 0] + expect(cursor2.getScreenPosition()).toEqual [8, 2] editor.moveToFirstCharacterOfLine() - expect(cursor1.getScreenPosition()).toEqual [2,0] - expect(cursor2.getScreenPosition()).toEqual [8,2] + expect(cursor1.getScreenPosition()).toEqual [2, 0] + expect(cursor2.getScreenPosition()).toEqual [8, 2] describe "when soft wrap is off", -> it "moves to the first character of the current line or the beginning of the line if it's already on the first character", -> - editor.setCursorScreenPosition [0,5] - editor.addCursorAtScreenPosition [1,7] + editor.setCursorScreenPosition [0, 5] + editor.addCursorAtScreenPosition [1, 7] editor.moveToFirstCharacterOfLine() [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,2] + expect(cursor1.getBufferPosition()).toEqual [0, 0] + expect(cursor2.getBufferPosition()).toEqual [1, 2] editor.moveToFirstCharacterOfLine() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,0] + expect(cursor1.getBufferPosition()).toEqual [0, 0] + expect(cursor2.getBufferPosition()).toEqual [1, 0] it "moves to the beginning of the line if it only contains whitespace ", -> editor.setText("first\n \nthird") - editor.setCursorScreenPosition [1,2] + editor.setCursorScreenPosition [1, 2] editor.moveToFirstCharacterOfLine() cursor = editor.getLastCursor() - expect(cursor.getBufferPosition()).toEqual [1,0] + expect(cursor.getBufferPosition()).toEqual [1, 0] describe "when invisible characters are enabled with soft tabs", -> it "moves to the first character of the current line without being confused by the invisible characters", -> atom.config.set('editor.showInvisibles', true) - editor.setCursorScreenPosition [1,7] + editor.setCursorScreenPosition [1, 7] editor.moveToFirstCharacterOfLine() - expect(editor.getCursorBufferPosition()).toEqual [1,2] + expect(editor.getCursorBufferPosition()).toEqual [1, 2] editor.moveToFirstCharacterOfLine() - expect(editor.getCursorBufferPosition()).toEqual [1,0] + expect(editor.getCursorBufferPosition()).toEqual [1, 0] describe "when invisible characters are enabled with hard tabs", -> it "moves to the first character of the current line without being confused by the invisible characters", -> atom.config.set('editor.showInvisibles', true) buffer.setTextInRange([[1, 0], [1, Infinity]], '\t\t\ta', normalizeLineEndings: false) - editor.setCursorScreenPosition [1,7] + editor.setCursorScreenPosition [1, 7] editor.moveToFirstCharacterOfLine() - expect(editor.getCursorBufferPosition()).toEqual [1,3] + expect(editor.getCursorBufferPosition()).toEqual [1, 3] editor.moveToFirstCharacterOfLine() - expect(editor.getCursorBufferPosition()).toEqual [1,0] + expect(editor.getCursorBufferPosition()).toEqual [1, 0] describe ".moveToBeginningOfWord()", -> it "moves the cursor to the beginning of the word", -> @@ -792,9 +792,9 @@ describe "TextEditor", -> describe ".moveToBeginningOfNextWord()", -> it "moves the cursor before the first character of the next word", -> - editor.setCursorBufferPosition [0,6] - editor.addCursorAtBufferPosition [1,11] - editor.addCursorAtBufferPosition [2,0] + editor.setCursorBufferPosition [0, 6] + editor.addCursorAtBufferPosition [1, 11] + editor.addCursorAtBufferPosition [2, 0] [cursor1, cursor2, cursor3] = editor.getCursors() editor.moveToBeginningOfNextWord() @@ -805,7 +805,7 @@ describe "TextEditor", -> # When the cursor is on whitespace editor.setText("ab cde- ") - editor.setCursorBufferPosition [0,2] + editor.setCursorBufferPosition [0, 2] cursor = editor.getLastCursor() editor.moveToBeginningOfNextWord() @@ -900,15 +900,15 @@ describe "TextEditor", -> describe "addCursorAtScreenPosition(screenPosition)", -> describe "when a cursor already exists at the position", -> it "returns the existing cursor", -> - cursor1 = editor.addCursorAtScreenPosition([0,2]) - cursor2 = editor.addCursorAtScreenPosition([0,2]) + cursor1 = editor.addCursorAtScreenPosition([0, 2]) + cursor2 = editor.addCursorAtScreenPosition([0, 2]) expect(cursor2.marker).toBe cursor1.marker describe "addCursorAtBufferPosition(bufferPosition)", -> describe "when a cursor already exists at the position", -> it "returns the existing cursor", -> - cursor1 = editor.addCursorAtBufferPosition([1,4]) - cursor2 = editor.addCursorAtBufferPosition([1,4]) + cursor1 = editor.addCursorAtBufferPosition([1, 4]) + cursor2 = editor.addCursorAtBufferPosition([1, 4]) expect(cursor2.marker).toBe cursor1.marker describe "autoscroll", -> @@ -1056,28 +1056,28 @@ describe "TextEditor", -> describe ".selectUp/Down/Left/Right()", -> it "expands each selection to its cursor's new location", -> - editor.setSelectedBufferRanges([[[0,9], [0,13]], [[3,16], [3,21]]]) + editor.setSelectedBufferRanges([[[0, 9], [0, 13]], [[3, 16], [3, 21]]]) [selection1, selection2] = editor.getSelections() editor.selectRight() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,14]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,22]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [0, 14]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [3, 22]] editor.selectLeft() editor.selectLeft() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [0, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [3, 20]] editor.selectDown() - expect(selection1.getBufferRange()).toEqual [[0,9], [1,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [4,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [1, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [4, 20]] editor.selectUp() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [0, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [3, 20]] it "merges selections when they intersect when moving down", -> - editor.setSelectedBufferRanges([[[0,9], [0,13]], [[1,10], [1,20]], [[2,15], [3,25]]]) + editor.setSelectedBufferRanges([[[0, 9], [0, 13]], [[1, 10], [1, 20]], [[2, 15], [3, 25]]]) [selection1, selection2, selection3] = editor.getSelections() editor.selectDown() @@ -1086,7 +1086,7 @@ describe "TextEditor", -> expect(selection1.isReversed()).toBeFalsy() it "merges selections when they intersect when moving up", -> - editor.setSelectedBufferRanges([[[0,9], [0,13]], [[1,10], [1,20]]], reversed: true) + editor.setSelectedBufferRanges([[[0, 9], [0, 13]], [[1, 10], [1, 20]]], reversed: true) [selection1, selection2] = editor.getSelections() editor.selectUp() @@ -1096,7 +1096,7 @@ describe "TextEditor", -> expect(selection1.isReversed()).toBeTruthy() it "merges selections when they intersect when moving left", -> - editor.setSelectedBufferRanges([[[0,9], [0,13]], [[0,13], [1,20]]], reversed: true) + editor.setSelectedBufferRanges([[[0, 9], [0, 13]], [[0, 13], [1, 20]]], reversed: true) [selection1, selection2] = editor.getSelections() editor.selectLeft() @@ -1105,7 +1105,7 @@ describe "TextEditor", -> expect(selection1.isReversed()).toBeTruthy() it "merges selections when they intersect when moving right", -> - editor.setSelectedBufferRanges([[[0,9], [0,14]], [[0,14], [1,20]]]) + editor.setSelectedBufferRanges([[[0, 9], [0, 14]], [[0, 14], [1, 20]]]) [selection1, selection2] = editor.getSelections() editor.selectRight() @@ -1115,24 +1115,24 @@ describe "TextEditor", -> describe "when counts are passed into the selection functions", -> it "expands each selection to its cursor's new location", -> - editor.setSelectedBufferRanges([[[0,9], [0,13]], [[3,16], [3,21]]]) + editor.setSelectedBufferRanges([[[0, 9], [0, 13]], [[3, 16], [3, 21]]]) [selection1, selection2] = editor.getSelections() editor.selectRight(2) - expect(selection1.getBufferRange()).toEqual [[0,9], [0,15]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,23]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [0, 15]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [3, 23]] editor.selectLeft(3) - expect(selection1.getBufferRange()).toEqual [[0,9], [0,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [0, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [3, 20]] editor.selectDown(3) - expect(selection1.getBufferRange()).toEqual [[0,9], [3,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [6,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [3, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [6, 20]] editor.selectUp(2) - expect(selection1.getBufferRange()).toEqual [[0,9], [1,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [4,20]] + expect(selection1.getBufferRange()).toEqual [[0, 9], [1, 12]] + expect(selection2.getBufferRange()).toEqual [[3, 16], [4, 20]] describe ".selectToBufferPosition(bufferPosition)", -> it "expands the last selection to the given position", -> @@ -1205,22 +1205,22 @@ describe "TextEditor", -> describe ".selectToTop()", -> it "selects text from cusor position to the top of the buffer", -> - editor.setCursorScreenPosition [11,2] - editor.addCursorAtScreenPosition [10,0] + editor.setCursorScreenPosition [11, 2] + editor.addCursorAtScreenPosition [10, 0] editor.selectToTop() expect(editor.getCursors().length).toBe 1 - expect(editor.getCursorBufferPosition()).toEqual [0,0] - expect(editor.getLastSelection().getBufferRange()).toEqual [[0,0], [11,2]] + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + expect(editor.getLastSelection().getBufferRange()).toEqual [[0, 0], [11, 2]] expect(editor.getLastSelection().isReversed()).toBeTruthy() describe ".selectToBottom()", -> it "selects text from cusor position to the bottom of the buffer", -> - editor.setCursorScreenPosition [10,0] - editor.addCursorAtScreenPosition [9,3] + editor.setCursorScreenPosition [10, 0] + editor.addCursorAtScreenPosition [9, 3] editor.selectToBottom() expect(editor.getCursors().length).toBe 1 - expect(editor.getCursorBufferPosition()).toEqual [12,2] - expect(editor.getLastSelection().getBufferRange()).toEqual [[9,3], [12,2]] + expect(editor.getCursorBufferPosition()).toEqual [12, 2] + expect(editor.getLastSelection().getBufferRange()).toEqual [[9, 3], [12, 2]] expect(editor.getLastSelection().isReversed()).toBeFalsy() describe ".selectAll()", -> @@ -1230,57 +1230,57 @@ describe "TextEditor", -> describe ".selectToBeginningOfLine()", -> it "selects text from cusor position to beginning of line", -> - editor.setCursorScreenPosition [12,2] - editor.addCursorAtScreenPosition [11,3] + editor.setCursorScreenPosition [12, 2] + editor.addCursorAtScreenPosition [11, 3] editor.selectToBeginningOfLine() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [12,0] - expect(cursor2.getBufferPosition()).toEqual [11,0] + expect(cursor1.getBufferPosition()).toEqual [12, 0] + expect(cursor2.getBufferPosition()).toEqual [11, 0] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[12,0], [12,2]] + expect(selection1.getBufferRange()).toEqual [[12, 0], [12, 2]] expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[11,0], [11,3]] + expect(selection2.getBufferRange()).toEqual [[11, 0], [11, 3]] expect(selection2.isReversed()).toBeTruthy() describe ".selectToEndOfLine()", -> it "selects text from cusor position to end of line", -> - editor.setCursorScreenPosition [12,0] - editor.addCursorAtScreenPosition [11,3] + editor.setCursorScreenPosition [12, 0] + editor.addCursorAtScreenPosition [11, 3] editor.selectToEndOfLine() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [12,2] - expect(cursor2.getBufferPosition()).toEqual [11,44] + expect(cursor1.getBufferPosition()).toEqual [12, 2] + expect(cursor2.getBufferPosition()).toEqual [11, 44] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[12,0], [12,2]] + expect(selection1.getBufferRange()).toEqual [[12, 0], [12, 2]] expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[11,3], [11,44]] + expect(selection2.getBufferRange()).toEqual [[11, 3], [11, 44]] expect(selection2.isReversed()).toBeFalsy() describe ".selectLinesContainingCursors()", -> it "selects the entire line (including newlines) at given row", -> editor.setCursorScreenPosition([1, 2]) editor.selectLinesContainingCursors() - expect(editor.getSelectedBufferRange()).toEqual [[1,0], [2,0]] + expect(editor.getSelectedBufferRange()).toEqual [[1, 0], [2, 0]] expect(editor.getSelectedText()).toBe " var sort = function(items) {\n" editor.setCursorScreenPosition([12, 2]) editor.selectLinesContainingCursors() - expect(editor.getSelectedBufferRange()).toEqual [[12,0], [12,2]] + expect(editor.getSelectedBufferRange()).toEqual [[12, 0], [12, 2]] editor.setCursorBufferPosition([0, 2]) editor.selectLinesContainingCursors() editor.selectLinesContainingCursors() - expect(editor.getSelectedBufferRange()).toEqual [[0,0], [2,0]] + expect(editor.getSelectedBufferRange()).toEqual [[0, 0], [2, 0]] it "autoscrolls to the selection", -> editor.setLineHeightInPixels(10) @@ -1298,59 +1298,59 @@ describe "TextEditor", -> describe ".selectToBeginningOfWord()", -> it "selects text from cusor position to beginning of word", -> - editor.setCursorScreenPosition [0,13] - editor.addCursorAtScreenPosition [3,49] + editor.setCursorScreenPosition [0, 13] + editor.addCursorAtScreenPosition [3, 49] editor.selectToBeginningOfWord() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,4] - expect(cursor2.getBufferPosition()).toEqual [3,47] + expect(cursor1.getBufferPosition()).toEqual [0, 4] + expect(cursor2.getBufferPosition()).toEqual [3, 47] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,4], [0,13]] + expect(selection1.getBufferRange()).toEqual [[0, 4], [0, 13]] expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[3,47], [3,49]] + expect(selection2.getBufferRange()).toEqual [[3, 47], [3, 49]] expect(selection2.isReversed()).toBeTruthy() describe ".selectToEndOfWord()", -> it "selects text from cusor position to end of word", -> - editor.setCursorScreenPosition [0,4] - editor.addCursorAtScreenPosition [3,48] + editor.setCursorScreenPosition [0, 4] + editor.addCursorAtScreenPosition [3, 48] editor.selectToEndOfWord() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,13] - expect(cursor2.getBufferPosition()).toEqual [3,50] + expect(cursor1.getBufferPosition()).toEqual [0, 13] + expect(cursor2.getBufferPosition()).toEqual [3, 50] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,4], [0,13]] + expect(selection1.getBufferRange()).toEqual [[0, 4], [0, 13]] expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[3,48], [3,50]] + expect(selection2.getBufferRange()).toEqual [[3, 48], [3, 50]] expect(selection2.isReversed()).toBeFalsy() describe ".selectToBeginningOfNextWord()", -> it "selects text from cusor position to beginning of next word", -> - editor.setCursorScreenPosition [0,4] - editor.addCursorAtScreenPosition [3,48] + editor.setCursorScreenPosition [0, 4] + editor.addCursorAtScreenPosition [3, 48] editor.selectToBeginningOfNextWord() expect(editor.getCursors().length).toBe 2 [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,14] - expect(cursor2.getBufferPosition()).toEqual [3,51] + expect(cursor1.getBufferPosition()).toEqual [0, 14] + expect(cursor2.getBufferPosition()).toEqual [3, 51] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,4], [0,14]] + expect(selection1.getBufferRange()).toEqual [[0, 4], [0, 14]] expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[3,48], [3,51]] + expect(selection2.getBufferRange()).toEqual [[3, 48], [3, 51]] expect(selection2.isReversed()).toBeFalsy() describe ".selectToPreviousWordBoundary()", -> @@ -1364,13 +1364,13 @@ describe "TextEditor", -> expect(editor.getSelections().length).toBe 4 [selection1, selection2, selection3, selection4] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,8], [0,4]] + expect(selection1.getBufferRange()).toEqual [[0, 8], [0, 4]] expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[2,0], [1,30]] + expect(selection2.getBufferRange()).toEqual [[2, 0], [1, 30]] expect(selection2.isReversed()).toBeTruthy() - expect(selection3.getBufferRange()).toEqual [[3,4], [3,0]] + expect(selection3.getBufferRange()).toEqual [[3, 4], [3, 0]] expect(selection3.isReversed()).toBeTruthy() - expect(selection4.getBufferRange()).toEqual [[3,14], [3,13]] + expect(selection4.getBufferRange()).toEqual [[3, 14], [3, 13]] expect(selection4.isReversed()).toBeTruthy() describe ".selectToNextWordBoundary()", -> @@ -1384,13 +1384,13 @@ describe "TextEditor", -> expect(editor.getSelections().length).toBe 4 [selection1, selection2, selection3, selection4] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,8], [0,13]] + expect(selection1.getBufferRange()).toEqual [[0, 8], [0, 13]] expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[2,40], [3,0]] + expect(selection2.getBufferRange()).toEqual [[2, 40], [3, 0]] expect(selection2.isReversed()).toBeFalsy() - expect(selection3.getBufferRange()).toEqual [[4,0], [4,4]] + expect(selection3.getBufferRange()).toEqual [[4, 0], [4, 4]] expect(selection3.isReversed()).toBeFalsy() - expect(selection4.getBufferRange()).toEqual [[3,30], [3,31]] + expect(selection4.getBufferRange()).toEqual [[3, 30], [3, 31]] expect(selection4.isReversed()).toBeFalsy() describe ".selectWordsContainingCursors()", -> @@ -1452,27 +1452,27 @@ describe "TextEditor", -> describe ".selectToFirstCharacterOfLine()", -> it "moves to the first character of the current line or the beginning of the line if it's already on the first character", -> - editor.setCursorScreenPosition [0,5] - editor.addCursorAtScreenPosition [1,7] + editor.setCursorScreenPosition [0, 5] + editor.addCursorAtScreenPosition [1, 7] editor.selectToFirstCharacterOfLine() [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,2] + expect(cursor1.getBufferPosition()).toEqual [0, 0] + expect(cursor2.getBufferPosition()).toEqual [1, 2] expect(editor.getSelections().length).toBe 2 [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,0], [0,5]] + expect(selection1.getBufferRange()).toEqual [[0, 0], [0, 5]] expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[1,2], [1,7]] + expect(selection2.getBufferRange()).toEqual [[1, 2], [1, 7]] expect(selection2.isReversed()).toBeTruthy() editor.selectToFirstCharacterOfLine() [selection1, selection2] = editor.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,0], [0,5]] + expect(selection1.getBufferRange()).toEqual [[0, 0], [0, 5]] expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[1,0], [1,7]] + expect(selection2.getBufferRange()).toEqual [[1, 0], [1, 7]] expect(selection2.isReversed()).toBeTruthy() describe ".setSelectedBufferRanges(ranges)", -> @@ -1501,7 +1501,7 @@ describe "TextEditor", -> describe "when the 'preserveFolds' option is false (the default)", -> it "removes folds that contain the selections", -> - editor.setSelectedBufferRange([[0,0], [0,0]]) + editor.setSelectedBufferRange([[0, 0], [0, 0]]) editor.createFold(1, 4) editor.createFold(2, 3) editor.createFold(6, 8) @@ -1515,7 +1515,7 @@ describe "TextEditor", -> describe "when the 'preserveFolds' option is true", -> it "does not remove folds that contain the selections", -> - editor.setSelectedBufferRange([[0,0], [0,0]]) + editor.setSelectedBufferRange([[0, 0], [0, 0]]) editor.createFold(1, 4) editor.createFold(6, 8) editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[6, 0], [6, 1]]], preserveFolds: true) @@ -1965,7 +1965,7 @@ describe "TextEditor", -> describe "when there are multiple non-empty selections", -> describe "when the selections are on the same line", -> it "replaces each selection range with the inserted characters", -> - editor.setSelectedBufferRanges([[[0,4], [0,13]], [[0,22], [0,24]]]) + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[0, 22], [0, 24]]]) editor.insertText("x") [cursor1, cursor2] = editor.getCursors() @@ -1995,8 +1995,8 @@ describe "TextEditor", -> describe "when there is a selection that ends on a folded line", -> it "destroys the selection", -> - editor.createFold(2,4) - editor.setSelectedBufferRange([[1,0], [2,0]]) + editor.createFold(2, 4) + editor.setSelectedBufferRange([[1, 0], [2, 0]]) editor.insertText('holy cow') expect(editor.tokenizedLineForScreenRow(2).fold).toBeUndefined() @@ -2117,17 +2117,17 @@ describe "TextEditor", -> expect(editor.lineTextForBufferRow(9)).toBe " }" [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [4,0] - expect(cursor2.getBufferPosition()).toEqual [8,0] + expect(cursor1.getBufferPosition()).toEqual [4, 0] + expect(cursor2.getBufferPosition()).toEqual [8, 0] describe ".insertNewlineBelow()", -> describe "when the operation is undone", -> it "places the cursor back at the previous location", -> - editor.setCursorBufferPosition([0,2]) + editor.setCursorBufferPosition([0, 2]) editor.insertNewlineBelow() - expect(editor.getCursorBufferPosition()).toEqual [1,0] + expect(editor.getCursorBufferPosition()).toEqual [1, 0] editor.undo() - expect(editor.getCursorBufferPosition()).toEqual [0,2] + expect(editor.getCursorBufferPosition()).toEqual [0, 2] it "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", -> atom.config.set("editor.autoIndent", true) @@ -2141,48 +2141,48 @@ describe "TextEditor", -> it "inserts a newline on the first line and moves the cursor to the first line", -> editor.setCursorBufferPosition([0]) editor.insertNewlineAbove() - expect(editor.getCursorBufferPosition()).toEqual [0,0] + expect(editor.getCursorBufferPosition()).toEqual [0, 0] expect(editor.lineTextForBufferRow(0)).toBe '' expect(editor.lineTextForBufferRow(1)).toBe 'var quicksort = function () {' expect(editor.buffer.getLineCount()).toBe 14 describe "when the cursor is not on the first line", -> it "inserts a newline above the current line and moves the cursor to the inserted line", -> - editor.setCursorBufferPosition([3,4]) + editor.setCursorBufferPosition([3, 4]) editor.insertNewlineAbove() - expect(editor.getCursorBufferPosition()).toEqual [3,0] + expect(editor.getCursorBufferPosition()).toEqual [3, 0] expect(editor.lineTextForBufferRow(3)).toBe '' expect(editor.lineTextForBufferRow(4)).toBe ' var pivot = items.shift(), current, left = [], right = [];' expect(editor.buffer.getLineCount()).toBe 14 editor.undo() - expect(editor.getCursorBufferPosition()).toEqual [3,4] + expect(editor.getCursorBufferPosition()).toEqual [3, 4] it "indents the new line to the correct level when editor.autoIndent is true", -> atom.config.set('editor.autoIndent', true) editor.setText(' var test') - editor.setCursorBufferPosition([0,2]) + editor.setCursorBufferPosition([0, 2]) editor.insertNewlineAbove() - expect(editor.getCursorBufferPosition()).toEqual [0,2] + expect(editor.getCursorBufferPosition()).toEqual [0, 2] expect(editor.lineTextForBufferRow(0)).toBe ' ' expect(editor.lineTextForBufferRow(1)).toBe ' var test' editor.setText('\n var test') - editor.setCursorBufferPosition([1,2]) + editor.setCursorBufferPosition([1, 2]) editor.insertNewlineAbove() - expect(editor.getCursorBufferPosition()).toEqual [1,2] + expect(editor.getCursorBufferPosition()).toEqual [1, 2] expect(editor.lineTextForBufferRow(0)).toBe '' expect(editor.lineTextForBufferRow(1)).toBe ' ' expect(editor.lineTextForBufferRow(2)).toBe ' var test' editor.setText('function() {\n}') - editor.setCursorBufferPosition([1,1]) + editor.setCursorBufferPosition([1, 1]) editor.insertNewlineAbove() - expect(editor.getCursorBufferPosition()).toEqual [1,2] + expect(editor.getCursorBufferPosition()).toEqual [1, 2] expect(editor.lineTextForBufferRow(0)).toBe 'function() {' expect(editor.lineTextForBufferRow(1)).toBe ' ' expect(editor.lineTextForBufferRow(2)).toBe '}' @@ -2190,7 +2190,7 @@ describe "TextEditor", -> describe "when a new line is appended before a closing tag (e.g. by pressing enter before a selection)", -> it "moves the line down and keeps the indentation level the same when editor.autoIndent is true", -> atom.config.set('editor.autoIndent', true) - editor.setCursorBufferPosition([9,2]) + editor.setCursorBufferPosition([9, 2]) editor.insertNewline() expect(editor.lineTextForBufferRow(10)).toBe ' };' @@ -2240,9 +2240,9 @@ describe "TextEditor", -> describe "when the cursor is on the first column of a line below a fold", -> it "deletes the folded lines", -> - editor.setCursorScreenPosition([4,0]) + editor.setCursorScreenPosition([4, 0]) editor.foldCurrentRow() - editor.setCursorScreenPosition([5,0]) + editor.setCursorScreenPosition([5, 0]) editor.backspace() expect(buffer.lineForRow(4)).toBe " return sort(left).concat(pivot).concat(sort(right));" @@ -2250,9 +2250,9 @@ describe "TextEditor", -> describe "when the cursor is in the middle of a line below a fold", -> it "backspaces as normal", -> - editor.setCursorScreenPosition([4,0]) + editor.setCursorScreenPosition([4, 0]) editor.foldCurrentRow() - editor.setCursorScreenPosition([5,5]) + editor.setCursorScreenPosition([5, 5]) editor.backspace() expect(buffer.lineForRow(7)).toBe " }" @@ -2317,18 +2317,18 @@ describe "TextEditor", -> expect(editor.lineTextForBufferRow(5)).toBe " }" [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [2,40] - expect(cursor2.getBufferPosition()).toEqual [4,30] + expect(cursor1.getBufferPosition()).toEqual [2, 40] + expect(cursor2.getBufferPosition()).toEqual [4, 30] describe "when there is a single selection", -> it "deletes the selection, but not the character before it", -> - editor.setSelectedBufferRange([[0,5], [0,9]]) + editor.setSelectedBufferRange([[0, 5], [0, 9]]) editor.backspace() expect(editor.buffer.lineForRow(0)).toBe 'var qsort = function () {' describe "when the selection ends on a folded line", -> it "preserves the fold", -> - editor.setSelectedBufferRange([[3,0], [4,0]]) + editor.setSelectedBufferRange([[3, 0], [4, 0]]) editor.foldBufferRow(4) editor.backspace() @@ -2337,7 +2337,7 @@ describe "TextEditor", -> describe "when there are multiple selections", -> it "removes all selected text", -> - editor.setSelectedBufferRanges([[[0,4], [0,13]], [[0,16], [0,24]]]) + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[0, 16], [0, 24]]]) editor.backspace() expect(editor.lineTextForBufferRow(0)).toBe 'var = () {' @@ -2533,8 +2533,8 @@ describe "TextEditor", -> describe "when the cursor is on a folded line", -> it "removes the lines contained by the fold", -> editor.setSelectedBufferRange([[2, 0], [2, 0]]) - editor.createFold(2,4) - editor.createFold(2,6) + editor.createFold(2, 4) + editor.createFold(2, 6) oldLine7 = buffer.lineForRow(7) oldLine8 = buffer.lineForRow(8) @@ -2589,8 +2589,8 @@ describe "TextEditor", -> expect(editor.lineTextForBufferRow(0)).toBe "var quicksort = function () { var sort = function(items) { if (items.length <= 1) return items;" [cursor1, cursor2] = editor.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,29] - expect(cursor2.getBufferPosition()).toEqual [0,59] + expect(cursor1.getBufferPosition()).toEqual [0, 29] + expect(cursor2.getBufferPosition()).toEqual [0, 59] describe "when there is a single selection", -> it "deletes the selection, but not the character following it", -> @@ -2603,7 +2603,7 @@ describe "TextEditor", -> describe "when there are multiple selections", -> describe "when selections are on the same line", -> it "removes all selected text", -> - editor.setSelectedBufferRanges([[[0,4], [0,13]], [[0,16], [0,24]]]) + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[0, 16], [0, 24]]]) editor.delete() expect(editor.lineTextForBufferRow(0)).toBe 'var = () {' @@ -2781,9 +2781,9 @@ describe "TextEditor", -> describe "when many selections get added in shuffle order", -> it "cuts them in order", -> editor.setSelectedBufferRanges([ - [[2,8], [2, 13]] - [[0,4], [0,13]], - [[1,6], [1, 10]], + [[2, 8], [2, 13]] + [[0, 4], [0, 13]], + [[1, 6], [1, 10]], ]) editor.cutSelectedText() expect(atom.clipboard.read()).toEqual """ @@ -2813,7 +2813,7 @@ describe "TextEditor", -> describe "when text is selected", -> it "only cuts the selected text, not to the end of the line", -> - editor.setSelectedBufferRanges([[[2,20], [2, 30]], [[3, 20], [3, 20]]]) + editor.setSelectedBufferRanges([[[2, 20], [2, 30]], [[3, 20], [3, 20]]]) editor.cutToEndOfLine() @@ -2823,7 +2823,7 @@ describe "TextEditor", -> describe ".copySelectedText()", -> it "copies selected text onto the clipboard", -> - editor.setSelectedBufferRanges([[[0,4], [0,13]], [[1,6], [1, 10]], [[2,8], [2, 13]]]) + editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]], [[2, 8], [2, 13]]]) editor.copySelectedText() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" @@ -2857,9 +2857,9 @@ describe "TextEditor", -> describe "when many selections get added in shuffle order", -> it "copies them in order", -> editor.setSelectedBufferRanges([ - [[2,8], [2, 13]] - [[0,4], [0,13]], - [[1,6], [1, 10]], + [[2, 8], [2, 13]] + [[0, 4], [0, 13]], + [[1, 6], [1, 10]], ]) editor.copySelectedText() expect(atom.clipboard.read()).toEqual """ @@ -2876,7 +2876,7 @@ describe "TextEditor", -> textEditor.insertText(text) numberOfNewlines = text.match(/\n/g)?.length endColumn = text.match(/[^\n]*$/)[0]?.length - textEditor.getLastSelection().setBufferRange([[0,startColumn], [numberOfNewlines,endColumn]]) + textEditor.getLastSelection().setBufferRange([[0, startColumn], [numberOfNewlines, endColumn]]) textEditor.cutSelectedText() it "pastes text into the buffer", -> @@ -3020,7 +3020,7 @@ describe "TextEditor", -> describe "when nothing is selected", -> describe "when softTabs is enabled", -> it "indents line and retains selection", -> - editor.setSelectedBufferRange([[0,3], [0,3]]) + editor.setSelectedBufferRange([[0, 3], [0, 3]]) editor.indentSelectedRows() expect(buffer.lineForRow(0)).toBe " var quicksort = function () {" expect(editor.getSelectedBufferRange()).toEqual [[0, 3 + editor.getTabLength()], [0, 3 + editor.getTabLength()]] @@ -3029,7 +3029,7 @@ describe "TextEditor", -> it "indents line and retains selection", -> convertToHardTabs(buffer) editor.setSoftTabs(false) - editor.setSelectedBufferRange([[0,3], [0,3]]) + editor.setSelectedBufferRange([[0, 3], [0, 3]]) editor.indentSelectedRows() expect(buffer.lineForRow(0)).toBe "\tvar quicksort = function () {" expect(editor.getSelectedBufferRange()).toEqual [[0, 3 + 1], [0, 3 + 1]] @@ -3037,7 +3037,7 @@ describe "TextEditor", -> describe "when one line is selected", -> describe "when softTabs is enabled", -> it "indents line and retains selection", -> - editor.setSelectedBufferRange([[0,4], [0,14]]) + editor.setSelectedBufferRange([[0, 4], [0, 14]]) editor.indentSelectedRows() expect(buffer.lineForRow(0)).toBe "#{editor.getTabText()}var quicksort = function () {" expect(editor.getSelectedBufferRange()).toEqual [[0, 4 + editor.getTabLength()], [0, 14 + editor.getTabLength()]] @@ -3046,7 +3046,7 @@ describe "TextEditor", -> it "indents line and retains selection", -> convertToHardTabs(buffer) editor.setSoftTabs(false) - editor.setSelectedBufferRange([[0,4], [0,14]]) + editor.setSelectedBufferRange([[0, 4], [0, 14]]) editor.indentSelectedRows() expect(buffer.lineForRow(0)).toBe "\tvar quicksort = function () {" expect(editor.getSelectedBufferRange()).toEqual [[0, 4 + 1], [0, 14 + 1]] @@ -3054,7 +3054,7 @@ describe "TextEditor", -> describe "when multiple lines are selected", -> describe "when softTabs is enabled", -> it "indents selected lines (that are not empty) and retains selection", -> - editor.setSelectedBufferRange([[9,1], [11,15]]) + editor.setSelectedBufferRange([[9, 1], [11, 15]]) editor.indentSelectedRows() expect(buffer.lineForRow(9)).toBe " };" expect(buffer.lineForRow(10)).toBe "" @@ -3062,7 +3062,7 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRange()).toEqual [[9, 1 + editor.getTabLength()], [11, 15 + editor.getTabLength()]] it "does not indent the last row if the selection ends at column 0", -> - editor.setSelectedBufferRange([[9,1], [11,0]]) + editor.setSelectedBufferRange([[9, 1], [11, 0]]) editor.indentSelectedRows() expect(buffer.lineForRow(9)).toBe " };" expect(buffer.lineForRow(10)).toBe "" @@ -3073,7 +3073,7 @@ describe "TextEditor", -> it "indents selected lines (that are not empty) and retains selection", -> convertToHardTabs(buffer) editor.setSoftTabs(false) - editor.setSelectedBufferRange([[9,1], [11,15]]) + editor.setSelectedBufferRange([[9, 1], [11, 15]]) editor.indentSelectedRows() expect(buffer.lineForRow(9)).toBe "\t\t};" expect(buffer.lineForRow(10)).toBe "" @@ -3083,7 +3083,7 @@ describe "TextEditor", -> describe ".outdentSelectedRows()", -> describe "when nothing is selected", -> it "outdents line and retains selection", -> - editor.setSelectedBufferRange([[1,3], [1,3]]) + editor.setSelectedBufferRange([[1, 3], [1, 3]]) editor.outdentSelectedRows() expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" expect(editor.getSelectedBufferRange()).toEqual [[1, 3 - editor.getTabLength()], [1, 3 - editor.getTabLength()]] @@ -3120,14 +3120,14 @@ describe "TextEditor", -> describe "when one line is selected", -> it "outdents line and retains editor", -> - editor.setSelectedBufferRange([[1,4], [1,14]]) + editor.setSelectedBufferRange([[1, 4], [1, 14]]) editor.outdentSelectedRows() expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" expect(editor.getSelectedBufferRange()).toEqual [[1, 4 - editor.getTabLength()], [1, 14 - editor.getTabLength()]] describe "when multiple lines are selected", -> it "outdents selected lines and retains editor", -> - editor.setSelectedBufferRange([[0,1], [3,15]]) + editor.setSelectedBufferRange([[0, 1], [3, 15]]) editor.outdentSelectedRows() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" @@ -3136,7 +3136,7 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRange()).toEqual [[0, 1], [3, 15 - editor.getTabLength()]] it "does not outdent the last line of the selection if it ends at column 0", -> - editor.setSelectedBufferRange([[0,1], [3,0]]) + editor.setSelectedBufferRange([[0, 1], [3, 0]]) editor.outdentSelectedRows() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" @@ -3149,7 +3149,7 @@ describe "TextEditor", -> it "auto-indents the selection", -> editor.setCursorBufferPosition([2, 0]) editor.insertText("function() {\ninside=true\n}\n i=1\n") - editor.getLastSelection().setBufferRange([[2,0], [6,0]]) + editor.getLastSelection().setBufferRange([[2, 0], [6, 0]]) editor.autoIndentSelectedRows() expect(editor.lineTextForBufferRow(2)).toBe " function() {" @@ -3385,8 +3385,8 @@ describe "TextEditor", -> expect(editor.getCursors().length).toBe 2 expect(editor.getCursors()).toEqual [cursor1, cursor3] - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor3.getBufferPosition()).toEqual [1,2] + expect(cursor1.getBufferPosition()).toEqual [0, 0] + expect(cursor3.getBufferPosition()).toEqual [1, 2] describe 'reading text', -> it '.lineTextForScreenRow(row)', -> @@ -3544,7 +3544,7 @@ describe "TextEditor", -> describe "when there is a selection", -> it "upper cases the current selection", -> editor.buffer.setText("abc") - editor.setSelectedBufferRange([[0,0], [0,2]]) + editor.setSelectedBufferRange([[0, 0], [0, 2]]) editor.upperCase() expect(editor.lineTextForBufferRow(0)).toBe 'ABc' expect(editor.getSelectedBufferRange()).toEqual [[0, 0], [0, 2]] @@ -3561,7 +3561,7 @@ describe "TextEditor", -> describe "when there is a selection", -> it "lower cases the current selection", -> editor.buffer.setText("ABC") - editor.setSelectedBufferRange([[0,0], [0,2]]) + editor.setSelectedBufferRange([[0, 0], [0, 2]]) editor.lowerCase() expect(editor.lineTextForBufferRow(0)).toBe 'abC' expect(editor.getSelectedBufferRange()).toEqual [[0, 0], [0, 2]] @@ -3652,7 +3652,7 @@ describe "TextEditor", -> it "preserves the current cursor position", -> editor.setCursorScreenPosition([0, 1]) editor.buffer.reload() - expect(editor.getCursorScreenPosition()).toEqual [0,1] + expect(editor.getCursorScreenPosition()).toEqual [0, 1] describe "when a better-matched grammar is added to syntax", -> it "switches to the better-matched grammar and re-tokenizes the buffer", -> @@ -4235,28 +4235,28 @@ describe "TextEditor", -> editor.selectPageDown() expect(editor.getScrollTop()).toBe 30 - expect(editor.getSelectedBufferRanges()).toEqual [[[0,0], [5,0]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [5, 0]]] editor.selectPageDown() expect(editor.getScrollTop()).toBe 80 - expect(editor.getSelectedBufferRanges()).toEqual [[[0,0], [10,0]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [10, 0]]] editor.selectPageDown() expect(editor.getScrollTop()).toBe 80 - expect(editor.getSelectedBufferRanges()).toEqual [[[0,0], [12,2]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [12, 2]]] editor.moveToBottom() editor.selectPageUp() expect(editor.getScrollTop()).toBe 50 - expect(editor.getSelectedBufferRanges()).toEqual [[[7,0], [12,2]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[7, 0], [12, 2]]] editor.selectPageUp() expect(editor.getScrollTop()).toBe 0 - expect(editor.getSelectedBufferRanges()).toEqual [[[2,0], [12,2]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[2, 0], [12, 2]]] editor.selectPageUp() expect(editor.getScrollTop()).toBe 0 - expect(editor.getSelectedBufferRanges()).toEqual [[[0,0], [12,2]]] + expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [12, 2]]] describe '.get/setPlaceholderText()', -> it 'can be created with placeholderText', -> From 544d650d227c846650b3cfb5f6618a1072fa096c Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 19:57:41 -0400 Subject: [PATCH 26/74] :shirt: Fix linter errors in text-editor-view --- src/text-editor-view.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/text-editor-view.coffee b/src/text-editor-view.coffee index b86367ef4..7f17ddaad 100644 --- a/src/text-editor-view.coffee +++ b/src/text-editor-view.coffee @@ -120,14 +120,14 @@ class TextEditorView extends View getEditor: -> @model - Object.defineProperty @::, 'lineHeight', get: -> @model.getLineHeightInPixels() - Object.defineProperty @::, 'charWidth', get: -> @model.getDefaultCharWidth() - Object.defineProperty @::, 'firstRenderedScreenRow', get: -> @component.getRenderedRowRange()[0] - Object.defineProperty @::, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1] - Object.defineProperty @::, 'active', get: -> @is(@getPaneView()?.activeView) - Object.defineProperty @::, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.hiddenInputComponent?.getDomNode() - Object.defineProperty @::, 'mini', get: -> @model?.isMini() - Object.defineProperty @::, 'component', get: -> @element?.component + Object.defineProperty @prototype, 'lineHeight', get: -> @model.getLineHeightInPixels() + Object.defineProperty @prototype, 'charWidth', get: -> @model.getDefaultCharWidth() + Object.defineProperty @prototype, 'firstRenderedScreenRow', get: -> @component.getRenderedRowRange()[0] + Object.defineProperty @prototype, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1] + Object.defineProperty @prototype, 'active', get: -> @is(@getPaneView()?.activeView) + Object.defineProperty @prototype, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.hiddenInputComponent?.getDomNode() + Object.defineProperty @prototype, 'mini', get: -> @model?.isMini() + Object.defineProperty @prototype, 'component', get: -> @element?.component afterAttach: (onDom) -> return unless onDom From 4a8fa01e2c812a3290d137a3191e43c7dc7fba33 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 20:08:29 -0400 Subject: [PATCH 27/74] :fire: Remove newlines_after_classes rule This rule, although it would be nice, is a bit too buggy for use right now - see https://github.com/clutchski/coffeelint/issues/245 --- coffeelint.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/coffeelint.json b/coffeelint.json index 9ee65d6e5..a5dd715e3 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -33,9 +33,5 @@ }, "no_stand_alone_at": { "level": "error" - }, - "newlines_after_classes": { - "value": 2, - "level": "error" } } From 04400be946e54691725193b518c10a2d3caeea3b Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 20:20:35 -0400 Subject: [PATCH 28/74] :memo: Update CONTRIBUTING with latest style guidelines --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe9a742b4..333eb0913 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,6 +100,9 @@ For more information on how to work with Atom's official packages, see * Set parameter defaults without spaces around the equal sign * `clear = (count=1) ->` instead of `clear = (count = 1) ->` +* Use spaces around operators + * `count + 1` instead of `count+1` +* Use spaces after commas (unless separated by newlines) * Use parentheses if it improves code clarity. * Prefer alphabetic keywords to symbolic keywords: * `a is b` instead of `a == b` @@ -113,6 +116,8 @@ For more information on how to work with Atom's official packages, see * Use `slice()` to copy an array * Add an explicit `return` when your function ends with a `for`/`while` loop and you don't want it to return a collected array. +* Use `this` instead of a standalone `@` + * `return this` instead of `return @` ## Specs Styleguide From 8fa1614d694b6da15fc58edbbb55eb387adbf057 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 20:28:15 -0400 Subject: [PATCH 29/74] :shirt: Fix linter error in build/tasks/install-task --- build/tasks/install-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/install-task.coffee b/build/tasks/install-task.coffee index 5131f512c..71d3c4ae8 100644 --- a/build/tasks/install-task.coffee +++ b/build/tasks/install-task.coffee @@ -31,7 +31,7 @@ module.exports = (grunt) -> binDir = path.join(installDir, 'bin') shareDir = path.join(installDir, 'share', 'atom') - iconName = path.join(shareDir,'resources', 'app', 'resources', 'atom.png') + iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png') mkdir binDir cp 'atom.sh', path.join(binDir, 'atom') From c5a8c8ad34bd318a57660f3002183af06c8d4d26 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Fri, 22 May 2015 22:05:04 -0400 Subject: [PATCH 30/74] :bug: Fix application:open-license command --- src/workspace.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 0e6fb7e40..0285cf99d 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -377,7 +377,7 @@ class Workspace extends Model # Open Atom's license in the active pane. openLicense: -> - @open(join(atom.getLoadSettings().resourcePath, 'LICENSE.md')) + @open(path.join(process.resourcesPath, 'LICENSE.md')) # Synchronously open the given URI in the active pane. **Only use this method # in specs. Calling this in production code will block the UI thread and From 08c4e8e0075725abbecb9042cab72c22f264c0a1 Mon Sep 17 00:00:00 2001 From: simurai Date: Sun, 24 May 2015 16:37:36 +0900 Subject: [PATCH 31/74] Unstyle that got intruduced in latest Boostrap upgrade. Fixes #6923 --- static/bootstrap-overrides.less | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/bootstrap-overrides.less b/static/bootstrap-overrides.less index df61c0171..115f672f2 100644 --- a/static/bootstrap-overrides.less +++ b/static/bootstrap-overrides.less @@ -32,3 +32,10 @@ body { font-family: @font-family; font-size: @font-size; } + +// disable some styling, will be styled in themes +kbd { + color: inherit; + background-color: none; + box-shadow: none; +} From 4bbfe37448bcf955fcaa8c208869d17994e82d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Mon, 25 May 2015 13:52:11 +0200 Subject: [PATCH 32/74] :arrow_up: status-bar@0.73.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b22bee26e..e67d918df 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "settings-view": "0.205.0", "snippets": "0.90.0", "spell-check": "0.58.0", - "status-bar": "0.72.0", + "status-bar": "0.73.0", "styleguide": "0.44.0", "symbols-view": "0.97.0", "tabs": "0.68.0", From 513fc70154118ff1ae2915c3d842ddcb2503f52a Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 25 May 2015 11:50:20 -0400 Subject: [PATCH 33/74] :memo: Add docs about passing a function to a tooltip title --- src/tooltip-manager.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tooltip-manager.coffee b/src/tooltip-manager.coffee index ee2054b5a..3c9777123 100644 --- a/src/tooltip-manager.coffee +++ b/src/tooltip-manager.coffee @@ -57,9 +57,10 @@ class TooltipManager # Essential: Add a tooltip to the given element. # # * `target` An `HTMLElement` - # * `options` See http://getbootstrap.com/javascript/#tooltips for a full list - # of options. You can also supply the following additional options: - # * `title` {String} Text in the tip. + # * `options` See http://getbootstrap.com/javascript/#tooltips-options for a + # full list of options. You can also supply the following additional options: + # * `title` A {String} or {Function} to use for the text in the tip. If + # given a function, `this` will be set to the `target` element. # * `keyBindingCommand` A {String} containing a command name. If you specify # this option and a key binding exists that matches the command, it will # be appended to the title or rendered alone if no title is specified. From e9077beb411e9d8439b34b134f1c2bd5b4c17d22 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 25 May 2015 12:14:12 -0400 Subject: [PATCH 34/74] Document build flags --- docs/build-instructions/freebsd.md | 14 ++++++++++++++ docs/build-instructions/os-x.md | 5 +++++ docs/build-instructions/windows.md | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/docs/build-instructions/freebsd.md b/docs/build-instructions/freebsd.md index 147c9da23..8029aa5f2 100644 --- a/docs/build-instructions/freebsd.md +++ b/docs/build-instructions/freebsd.md @@ -19,4 +19,18 @@ FreeBSD -RELEASE 64-bit is the recommended platform. sudo script/grunt install # Installs command to /usr/local/bin/atom ``` +## Advanced Options + +### Custom install directory + +```sh +sudo script/grunt install --install-dir /install/atom/here +``` + +### Custom build directory + +```sh +script/build --build-dir /build/atom/here +``` + ## Troubleshooting diff --git a/docs/build-instructions/os-x.md b/docs/build-instructions/os-x.md index d8685cff8..334a33653 100644 --- a/docs/build-instructions/os-x.md +++ b/docs/build-instructions/os-x.md @@ -14,6 +14,11 @@ script/build # Creates application at /Applications/Atom.app ``` +### `script/build` Options + * `--install-dir` - Creates the final built application in this directory. + * `--build-dir` - Build the application in this directory. + * `--verbose` - Verbose mode. A lot more information output. + ## Troubleshooting ### OSX build error reports in atom/atom diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index 8cfe74e72..a5d0757cb 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -33,6 +33,11 @@ cd atom script/build # Creates application in the `Program Files` directory ``` +### `script/build` Options + * `--install-dir` - Creates the final built application in this directory. + * `--build-dir` - Build the application in this directory. + * `--verbose` - Verbose mode. A lot more information output. + ## Why do I have to use GitHub for Windows? You don't. You can use your existing Git! GitHub for Windows's Git Shell is just From ae5590446576b5fbc160d24f2bdeae42ed01381d Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 25 May 2015 12:52:03 -0400 Subject: [PATCH 35/74] :memo: Update --install-dir docs for OS X --- docs/build-instructions/os-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/os-x.md b/docs/build-instructions/os-x.md index 334a33653..2ffde8ec0 100644 --- a/docs/build-instructions/os-x.md +++ b/docs/build-instructions/os-x.md @@ -15,7 +15,7 @@ ``` ### `script/build` Options - * `--install-dir` - Creates the final built application in this directory. + * `--install-dir` - The full path to the final built application (must include `.app` in the path), e.g. `script/build --install-dir full/path/to/Atom.app` * `--build-dir` - Build the application in this directory. * `--verbose` - Verbose mode. A lot more information output. From 2e8bb9e41fccbbf00d3eae080c76e9631333af96 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 25 May 2015 13:14:00 -0400 Subject: [PATCH 36/74] :memo: Update example path --- docs/build-instructions/os-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/os-x.md b/docs/build-instructions/os-x.md index 2ffde8ec0..7201676b1 100644 --- a/docs/build-instructions/os-x.md +++ b/docs/build-instructions/os-x.md @@ -15,7 +15,7 @@ ``` ### `script/build` Options - * `--install-dir` - The full path to the final built application (must include `.app` in the path), e.g. `script/build --install-dir full/path/to/Atom.app` + * `--install-dir` - The full path to the final built application (must include `.app` in the path), e.g. `script/build --install-dir /Users/username/full/path/to/Atom.app` * `--build-dir` - Build the application in this directory. * `--verbose` - Verbose mode. A lot more information output. From a62525ffd5653bdb5c72ad575bcbee7e7d793739 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 May 2015 09:08:08 -0700 Subject: [PATCH 37/74] :arrow_up: background-tips@0.25 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e67d918df..5ec1e705d 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "autocomplete-snippets": "1.6.1", "autoflow": "0.24.0", "autosave": "0.20.0", - "background-tips": "0.24.0", + "background-tips": "0.25.0", "bookmarks": "0.35.0", "bracket-matcher": "0.74.0", "command-palette": "0.36.0", From bd16d25ea25a040ac420bb859acb4d3efd6b28cb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 May 2015 09:12:21 -0700 Subject: [PATCH 38/74] :arrow_up: language-ruby@0.55 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ec1e705d..dde0064bf 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "language-php": "0.24.0", "language-property-list": "0.8.0", "language-python": "0.35.0", - "language-ruby": "0.54.0", + "language-ruby": "0.55.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.38.0", "language-shellscript": "0.15.0", From 1090c8611387c1cda68712828249154dff920c1b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 13:25:52 -0700 Subject: [PATCH 39/74] :arrow_up: find-and-replace@0.168.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dde0064bf..223c53650 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "dev-live-reload": "0.46.0", "encoding-selector": "0.20.0", "exception-reporting": "0.24.0", - "find-and-replace": "0.167.0", + "find-and-replace": "0.168.0", "fuzzy-finder": "0.87.0", "git-diff": "0.55.0", "go-to-line": "0.30.0", From fc9a8c7f713efdbd0155cc3d46278cfaaef97d30 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 13:36:37 -0700 Subject: [PATCH 40/74] Add descriptions to softwrap settings. Closes #6920 --- src/config-schema.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 548b35fa8..426bbee50 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -139,12 +139,14 @@ module.exports = softWrap: type: 'boolean' default: false + description: 'Wraps lines that exceeed the width of the window. When `Soft Wrap At Preferred Line Length` is set, it will wrap to the number characters defined by the `Preferred Line Length` setting.' softTabs: type: 'boolean' default: true softWrapAtPreferredLineLength: type: 'boolean' default: false + description: 'Will wrap to the number characters defined by the `Preferred Line Length` setting. This will only take effect when soft wrap is enabled globally or for the current language.' softWrapHangingIndent: type: 'integer' default: 0 From 1a3904aad1437f2f4f0aeac8c6607a2b0c2c58fb Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 14:15:00 -0700 Subject: [PATCH 41/74] Add `of` Thanks @50Wliu --- src/config-schema.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 426bbee50..8f974d2f4 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -139,14 +139,14 @@ module.exports = softWrap: type: 'boolean' default: false - description: 'Wraps lines that exceeed the width of the window. When `Soft Wrap At Preferred Line Length` is set, it will wrap to the number characters defined by the `Preferred Line Length` setting.' + description: 'Wraps lines that exceeed the width of the window. When `Soft Wrap At Preferred Line Length` is set, it will wrap to the number of characters defined by the `Preferred Line Length` setting.' softTabs: type: 'boolean' default: true softWrapAtPreferredLineLength: type: 'boolean' default: false - description: 'Will wrap to the number characters defined by the `Preferred Line Length` setting. This will only take effect when soft wrap is enabled globally or for the current language.' + description: 'Will wrap to the number of characters defined by the `Preferred Line Length` setting. This will only take effect when soft wrap is enabled globally or for the current language.' softWrapHangingIndent: type: 'integer' default: 0 From 2953d67660adb67599b0130baf63b781b72c2025 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 26 May 2015 23:20:30 +0200 Subject: [PATCH 42/74] :arrow_up: atom-keymap --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 223c53650..2ffb2ab3c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^5.1.3", + "atom-keymap": "^5.1.4", "atom-space-pen-views": "^2.0.4", "babel-core": "^5.1.11", "bootstrap": "^3.3.4", From 290c5c76e5b07eb8c92198c00a4b5064d4b3c750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Tue, 26 May 2015 19:31:16 -0400 Subject: [PATCH 43/74] Add coffeelint config files to ignored build paths --- build/tasks/build-task.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index 343960f61..6c2c4f309 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -103,6 +103,8 @@ module.exports = (grunt) -> '.lintignore' '.eslintrc' '.jshintignore' + 'coffeelint.json' + '.coffeelintignore' '.gitattributes' '.gitkeep' ] From 9068f217cba8a85f838f02a497f12a4dc0d97da2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 26 May 2015 16:50:43 -0700 Subject: [PATCH 44/74] :arrow_up: text-buffer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ffb2ab3c..0a6c83037 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "6.1.2", + "text-buffer": "6.1.3", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", From 49d9f349a408b79c1ea8d8cc9f2f819099939e25 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 26 May 2015 16:54:17 -0700 Subject: [PATCH 45/74] :arrow_up: language-ruby@0.56 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a6c83037..2b0674268 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "language-php": "0.24.0", "language-property-list": "0.8.0", "language-python": "0.35.0", - "language-ruby": "0.55.0", + "language-ruby": "0.56.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.38.0", "language-shellscript": "0.15.0", From c1e80610a83d3caa691becb1ed83ef7430a3541b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 17:01:44 -0700 Subject: [PATCH 46/74] Speling --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 8f974d2f4..b814e21de 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -139,7 +139,7 @@ module.exports = softWrap: type: 'boolean' default: false - description: 'Wraps lines that exceeed the width of the window. When `Soft Wrap At Preferred Line Length` is set, it will wrap to the number of characters defined by the `Preferred Line Length` setting.' + description: 'Wraps lines that exceed the width of the window. When `Soft Wrap At Preferred Line Length` is set, it will wrap to the number of characters defined by the `Preferred Line Length` setting.' softTabs: type: 'boolean' default: true From 9e3c2d093b9b9ca3178d44a510625f367fa64083 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 26 May 2015 17:09:59 -0700 Subject: [PATCH 47/74] Avoid double transaction when typing --- src/text-editor-component.coffee | 3 +-- src/text-editor.coffee | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index eb01e0f23..431966910 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -309,8 +309,7 @@ class TextEditorComponent selectedLength = inputNode.selectionEnd - inputNode.selectionStart @editor.selectLeft() if selectedLength is 1 - insertedRange = @editor.transact atom.config.get('editor.undoGroupingInterval'), => - @editor.insertText(event.data) + insertedRange = @editor.insertText(event.data, groupUndo: true) inputNode.value = event.data if insertedRange onVerticalScroll: (scrollTop) => diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 4489d82af..6d979fdf7 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -761,15 +761,23 @@ class TextEditor extends Model @emit('will-insert-text', willInsertEvent) if includeDeprecatedAPIs @emitter.emit 'will-insert-text', willInsertEvent + groupingInterval = if options.groupUndo + atom.config.get('editor.undoGroupingInterval') + else + 0 + if willInsert options.autoIndentNewline ?= @shouldAutoIndent() options.autoDecreaseIndent ?= @shouldAutoIndent() - @mutateSelectedText (selection) => - range = selection.insertText(text, options) - didInsertEvent = {text, range} - @emit('did-insert-text', didInsertEvent) if includeDeprecatedAPIs - @emitter.emit 'did-insert-text', didInsertEvent - range + @mutateSelectedText( + (selection) => + range = selection.insertText(text, options) + didInsertEvent = {text, range} + @emit('did-insert-text', didInsertEvent) if includeDeprecatedAPIs + @emitter.emit 'did-insert-text', didInsertEvent + range + , groupingInterval + ) else false @@ -795,9 +803,9 @@ class TextEditor extends Model # * `fn` A {Function} that will be called once for each {Selection}. The first # argument will be a {Selection} and the second argument will be the # {Number} index of that selection. - mutateSelectedText: (fn) -> + mutateSelectedText: (fn, groupingInterval=0) -> @mergeIntersectingSelections => - @transact => + @transact groupingInterval, => fn(selection, index) for selection, index in @getSelectionsOrderedByBufferPosition() # Move lines intersection the most recent selection up by one row in screen From 8b73c44d6f036240613e9728f39e474673aefa7f Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 18:11:45 -0700 Subject: [PATCH 48/74] :arrow_up: autocomplete-snippets --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b0674268..a5711ce51 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "autocomplete-css": "0.7.2", "autocomplete-html": "0.7.2", "autocomplete-plus": "2.17.1", - "autocomplete-snippets": "1.6.1", + "autocomplete-snippets": "1.6.2", "autoflow": "0.24.0", "autosave": "0.20.0", "background-tips": "0.25.0", From 60fbb1d3745514ad39ce0ca64a44bda8530a2a39 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 26 May 2015 18:16:50 -0700 Subject: [PATCH 49/74] :arrow_up: autocomplete-snippets --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5711ce51..ce4b16fc0 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "autocomplete-css": "0.7.2", "autocomplete-html": "0.7.2", "autocomplete-plus": "2.17.1", - "autocomplete-snippets": "1.6.2", + "autocomplete-snippets": "1.6.3", "autoflow": "0.24.0", "autosave": "0.20.0", "background-tips": "0.25.0", From 71b0a365dc7b160dd42d0ffe0ad7460243ea041d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Tue, 26 May 2015 21:26:31 -0400 Subject: [PATCH 50/74] :arrow_up: status-bar@0.74.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce4b16fc0..b0800ab91 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "settings-view": "0.205.0", "snippets": "0.90.0", "spell-check": "0.58.0", - "status-bar": "0.73.0", + "status-bar": "0.74.0", "styleguide": "0.44.0", "symbols-view": "0.97.0", "tabs": "0.68.0", From 1c06f9eb26639ed8a796413216a5cb7416020fb6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 27 May 2015 08:45:04 -0700 Subject: [PATCH 51/74] :arrow_up: markdown-preview@0.150 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce4b16fc0..16ce7cd06 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.33.0", "link": "0.30.0", - "markdown-preview": "0.149.0", + "markdown-preview": "0.150.0", "metrics": "0.51.0", "notifications": "0.50.0", "open-on-github": "0.37.0", From bdce576ab9c7e7a1a9cd0736999db5c38eac2a94 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 27 May 2015 09:05:59 -0700 Subject: [PATCH 52/74] :arrow_up: packages to remove bang from status bar --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 16ce7cd06..19df574b0 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "bookmarks": "0.35.0", "bracket-matcher": "0.74.0", "command-palette": "0.36.0", - "deprecation-cop": "0.51.0", + "deprecation-cop": "0.52.0", "dev-live-reload": "0.46.0", "encoding-selector": "0.20.0", "exception-reporting": "0.24.0", @@ -114,7 +114,7 @@ "open-on-github": "0.37.0", "package-generator": "0.39.0", "release-notes": "0.52.0", - "settings-view": "0.205.0", + "settings-view": "0.206.0", "snippets": "0.90.0", "spell-check": "0.58.0", "status-bar": "0.73.0", From 0dcdfa1e89f06f7fd78f645d4981e2df9debbff8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 27 May 2015 10:26:59 -0700 Subject: [PATCH 53/74] Revert "Initial paths shouldn't be normalized on save and restore (could contain uris)" --- spec/default-directory-provider-spec.coffee | 6 ------ spec/integration/startup-spec.coffee | 10 --------- spec/window-spec.coffee | 11 ---------- src/browser/atom-application.coffee | 8 +------ src/browser/main.coffee | 9 +++----- src/default-directory-provider.coffee | 23 +++++++-------------- src/window-event-handler.coffee | 10 ++++----- 7 files changed, 15 insertions(+), 62 deletions(-) diff --git a/spec/default-directory-provider-spec.coffee b/spec/default-directory-provider-spec.coffee index 357348c4a..69370a77b 100644 --- a/spec/default-directory-provider-spec.coffee +++ b/spec/default-directory-provider-spec.coffee @@ -31,12 +31,6 @@ describe "DefaultDirectoryProvider", -> directory = provider.directoryForURISync(file) expect(directory.getPath()).toEqual tmp - it "creates a Directory with a path as a uri when passed a uri", -> - provider = new DefaultDirectoryProvider() - uri = 'remote://server:6792/path/to/a/dir' - directory = provider.directoryForURISync(uri) - expect(directory.getPath()).toEqual uri - describe ".directoryForURI(uri)", -> it "returns a Promise that resolves to a Directory with a path that matches the uri", -> provider = new DefaultDirectoryProvider() diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index d2583ed27..54817fedc 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -227,13 +227,3 @@ describe "Starting Atom", -> [tempDirPath] [otherTempDirPath] ].sort() - - describe "opening a remote directory", -> - it "opens the parent directory and creates an empty text editor", -> - remoteDirectory = 'remote://server:3437/some/directory/path' - runAtom [remoteDirectory], {ATOM_HOME: atomHome}, (client) -> - client - .waitForWindowCount(1, 1000) - .waitForExist("atom-workspace", 5000) - .treeViewRootDirectories() - .then ({value}) -> expect(value).toEqual([remoteDirectory]) diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 94e605a36..376a71ab3 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -293,14 +293,3 @@ describe "Window", -> pathToOpen = __dirname atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] expect(atom.workspace.open.callCount).toBe 0 - - describe "when the opened path is a uri", -> - it "adds it to the project's paths as is", -> - pathToOpen = 'remote://server:7644/some/dir/path' - atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] - - waitsFor -> - atom.project.getPaths().length is 1 - - runs -> - expect(atom.project.getPaths()[0]).toBe pathToOpen diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 5bd6be73e..1b2aa2e86 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -369,12 +369,7 @@ class AtomApplication # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, windowDimensions, profileStartup, window}={}) -> - pathsToOpen = pathsToOpen.map (pathToOpen) -> - if fs.existsSync(pathToOpen) - fs.normalize(pathToOpen) - else - pathToOpen - + pathsToOpen = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen) locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen) unless pidToKillWhenClosed or newWindow @@ -523,7 +518,6 @@ class AtomApplication locationForPathToOpen: (pathToOpen) -> return {pathToOpen} unless pathToOpen - return {pathToOpen} if url.parse(pathToOpen).protocol? return {pathToOpen} if fs.existsSync(pathToOpen) pathToOpen = pathToOpen.replace(/[:\s]+$/, '') diff --git a/src/browser/main.coffee b/src/browser/main.coffee index 371dd71ea..1af0526dd 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -5,7 +5,6 @@ app = require 'app' fs = require 'fs-plus' path = require 'path' yargs = require 'yargs' -url = require 'url' nslog = require 'nslog' console.log = nslog @@ -46,11 +45,9 @@ start = -> cwd = args.executedFrom?.toString() or process.cwd() args.pathsToOpen = args.pathsToOpen.map (pathToOpen) -> - normalizedPath = fs.normalize(pathToOpen) - if url.parse(pathToOpen).protocol? - pathToOpen - else if cwd - path.resolve(cwd, normalizedPath) + pathToOpen = fs.normalize(pathToOpen) + if cwd + path.resolve(cwd, pathToOpen) else path.resolve(pathToOpen) diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index da2d17593..9e25e097b 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -1,7 +1,6 @@ {Directory} = require 'pathwatcher' fs = require 'fs-plus' path = require 'path' -url = require 'url' module.exports = class DefaultDirectoryProvider @@ -15,22 +14,14 @@ class DefaultDirectoryProvider # * {Directory} if the given URI is compatible with this provider. # * `null` if the given URI is not compatibile with this provider. directoryForURISync: (uri) -> - normalizedPath = path.normalize(uri) - {protocol} = url.parse(uri) - directoryPath = if protocol? - uri - else if not fs.isDirectorySync(normalizedPath) and fs.isDirectorySync(path.dirname(normalizedPath)) - path.dirname(normalizedPath) - else - normalizedPath + projectPath = path.normalize(uri) - # TODO: Stop normalizing the path in pathwatcher's Directory. - directory = new Directory(directoryPath) - if protocol? - directory.path = directoryPath - if fs.isCaseInsensitive() - directory.lowerCasePath = directoryPath.toLowerCase() - directory + directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) + path.dirname(projectPath) + else + projectPath + + new Directory(directoryPath) # Public: Create a Directory that corresponds to the specified URI. # diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 0855b27a1..7d67e87ab 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -5,7 +5,6 @@ ipc = require 'ipc' shell = require 'shell' {Subscriber} = require 'emissary' fs = require 'fs-plus' -url = require 'url' # Handles low-level events related to the window. module.exports = @@ -24,13 +23,12 @@ class WindowEventHandler if pathToOpen? and needsProjectPaths if fs.existsSync(pathToOpen) atom.project.addPath(pathToOpen) - else if fs.existsSync(path.dirname(pathToOpen)) - atom.project.addPath(path.dirname(pathToOpen)) else - atom.project.addPath(pathToOpen) + dirToOpen = path.dirname(pathToOpen) + if fs.existsSync(dirToOpen) + atom.project.addPath(dirToOpen) - {protocol} = url.parse(pathToOpen) - unless fs.isDirectorySync(pathToOpen) or protocol? + unless fs.isDirectorySync(pathToOpen) atom.workspace?.open(pathToOpen, {initialLine, initialColumn}) return From abd4c26eb978552d2054e905019470ac2fc616ad Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 27 May 2015 10:48:25 -0700 Subject: [PATCH 54/74] :arrow_up: language-javascript@0.78 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 01a8f9663..0753eb772 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "language-html": "0.37.0", "language-hyperlink": "0.13.0", "language-java": "0.15.0", - "language-javascript": "0.77.0", + "language-javascript": "0.78.0", "language-json": "0.14.0", "language-less": "0.27.0", "language-make": "0.14.0", From e052a102734f80f83b904821a9c84f8c2dd7477c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 27 May 2015 10:49:49 -0700 Subject: [PATCH 55/74] :arrow_up: language-c@0.45 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0753eb772..ee5566f69 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "welcome": "0.27.0", "whitespace": "0.29.0", "wrap-guide": "0.34.0", - "language-c": "0.44.0", + "language-c": "0.45.0", "language-clojure": "0.15.0", "language-coffee-script": "0.40.0", "language-csharp": "0.5.0", From c84dc541845623c3a80661e11f568695fed0edd3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 27 May 2015 11:00:30 -0700 Subject: [PATCH 56/74] :arrow_up: tabs@0.69 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee5566f69..0fc08f37e 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "status-bar": "0.74.0", "styleguide": "0.44.0", "symbols-view": "0.97.0", - "tabs": "0.68.0", + "tabs": "0.69.0", "timecop": "0.31.0", "tree-view": "0.171.0", "update-package-dependencies": "0.10.0", From 7573cd250dde92d081305cd34195e5a3b8d18edc Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 27 May 2015 11:23:18 -0700 Subject: [PATCH 57/74] :arrow_up: snippets and lang-html to fix html rendering --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0fc08f37e..86f615d0d 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "package-generator": "0.39.0", "release-notes": "0.52.0", "settings-view": "0.206.0", - "snippets": "0.90.0", + "snippets": "0.91.0", "spell-check": "0.58.0", "status-bar": "0.74.0", "styleguide": "0.44.0", @@ -135,7 +135,7 @@ "language-gfm": "0.76.0", "language-git": "0.10.0", "language-go": "0.26.0", - "language-html": "0.37.0", + "language-html": "0.38.0", "language-hyperlink": "0.13.0", "language-java": "0.15.0", "language-javascript": "0.78.0", From a89e67a3f506c6db3bd805182a8a830274ace92e Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 27 May 2015 20:49:23 +0200 Subject: [PATCH 58/74] :arrow_up: wrap-guide --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 86f615d0d..fdee7f9be 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "update-package-dependencies": "0.10.0", "welcome": "0.27.0", "whitespace": "0.29.0", - "wrap-guide": "0.34.0", + "wrap-guide": "0.35.0", "language-c": "0.45.0", "language-clojure": "0.15.0", "language-coffee-script": "0.40.0", From ccd76f6876417dea6ba01e65b770f01569bb7b69 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 27 May 2015 12:44:33 -0700 Subject: [PATCH 59/74] :arrow_up: autocomplete-plus@2.17.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdee7f9be..dc07331d6 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "autocomplete-atom-api": "0.9.0", "autocomplete-css": "0.7.2", "autocomplete-html": "0.7.2", - "autocomplete-plus": "2.17.1", + "autocomplete-plus": "2.17.2", "autocomplete-snippets": "1.6.3", "autoflow": "0.24.0", "autosave": "0.20.0", From 6dad5615d9eaf299ed08127f4b9b7638032fb741 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 27 May 2015 12:56:32 -0700 Subject: [PATCH 60/74] :arrow_up: autocomplete-plus@2.17.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dc07331d6..5bbeb7879 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "autocomplete-atom-api": "0.9.0", "autocomplete-css": "0.7.2", "autocomplete-html": "0.7.2", - "autocomplete-plus": "2.17.2", + "autocomplete-plus": "2.17.3", "autocomplete-snippets": "1.6.3", "autoflow": "0.24.0", "autosave": "0.20.0", From b7b5ceca2ddeac1721ba906bd7ae289d6e6ef3ef Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 27 May 2015 12:59:06 -0700 Subject: [PATCH 61/74] Save window state when quitting if windows are open --- src/browser/atom-application.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 1b2aa2e86..ae56fb1d4 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -99,12 +99,12 @@ class AtomApplication # Public: Removes the {AtomWindow} from the global window list. removeWindow: (window) -> - @windows.splice @windows.indexOf(window), 1 - if @windows.length is 0 + if @windows.length is 1 @applicationMenu?.enableWindowSpecificItems(false) if process.platform in ['win32', 'linux'] app.quit() return + @windows.splice(@windows.indexOf(window), 1) @saveState() unless window.isSpec or @quitting # Public: Adds the {AtomWindow} to the global window list. @@ -210,6 +210,7 @@ class AtomApplication @openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md')) app.on 'before-quit', => + @saveState() if @hasEditorWindows() @quitting = true app.on 'will-quit', => @@ -217,7 +218,7 @@ class AtomApplication @deleteSocketFile() app.on 'will-exit', => - @saveState() unless @windows.every (window) -> window.isSpec + @saveState() if @hasEditorWindows() @killAllProcesses() @deleteSocketFile() @@ -435,6 +436,9 @@ class AtomApplication states.push(initialPaths: loadSettings.initialPaths) @storageFolder.store('application.json', states) + hasEditorWindows: -> + @windows.some (window) -> not window.isSpec + loadState: -> if (states = @storageFolder.load('application.json'))?.length > 0 for state in states From 78fae88bed50dadaa449c6274f39bb8d6bab3ea3 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 27 May 2015 15:04:37 -0700 Subject: [PATCH 62/74] :arrow_up: find-and-replace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bbeb7879..e3cb86382 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "dev-live-reload": "0.46.0", "encoding-selector": "0.20.0", "exception-reporting": "0.24.0", - "find-and-replace": "0.168.0", + "find-and-replace": "0.169.0", "fuzzy-finder": "0.87.0", "git-diff": "0.55.0", "go-to-line": "0.30.0", From c17287437395f158b76636ce752a7deee4e59f99 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 27 May 2015 14:50:41 -0700 Subject: [PATCH 63/74] Prepare 0.203 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e3cb86382..4fe81884d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.202.0", + "version": "0.203.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 7fe8abe494d09a39c8dd33c5d96bb69fbfbceb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Thu, 28 May 2015 09:22:23 +0200 Subject: [PATCH 64/74] :arrow_up: language-todo@0.23.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fe81884d..d0c445d5c 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "language-source": "0.9.0", "language-sql": "0.15.0", "language-text": "0.6.0", - "language-todo": "0.22.0", + "language-todo": "0.23.0", "language-toml": "0.16.0", "language-xml": "0.30.0", "language-yaml": "0.22.0" From 31cf19a205f953cc9f800afa52d72e9f319d1d7a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 28 May 2015 10:38:20 +0200 Subject: [PATCH 65/74] Use previous definition of scope selector match to fix API breakage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I switched to first-mate Selector because I didn’t want to replicate the poorly-defined Token::matchesScopeSelector method now that tokens are not stored on lines. However, the first-mate semantics are stricter and that broke the API. Perhaps using selector-kit here would be better, but I just wanted to put back exactly to how it was for now. /cc @ypresto --- spec/tokenized-buffer-spec.coffee | 2 +- src/tokenized-buffer.coffee | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 9d94cb80a..dc57d3fee 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -572,7 +572,7 @@ describe "TokenizedBuffer", -> describe "when the selector matches a run of multiple tokens at the position", -> it "returns the range covered by all contigous tokens (within a single line)", -> - expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.meta.function', [1, 18])).toEqual [[1, 6], [1, 28]] + expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.function', [1, 18])).toEqual [[1, 6], [1, 28]] describe "when the editor.tabLength config value changes", -> it "updates the tab length of the tokenized lines", -> diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 60ebe16f0..55d2e7e37 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -426,7 +426,6 @@ class TokenizedBuffer extends Model new Point(row, column) bufferRangeForScopeAtPosition: (selector, position) -> - selector = new ScopeSelector(selector.replace(/^\./, '')) position = Point.fromObject(position) {openScopes, tags} = @tokenizedLines[position.row] @@ -446,7 +445,8 @@ class TokenizedBuffer extends Model else startColumn = endColumn - return unless selector.matches(scopes) + + return unless selectorMatchesAnyScope(selector, scopes) startScopes = scopes.slice() for startTokenIndex in [(tokenIndex - 1)..0] by -1 @@ -457,7 +457,7 @@ class TokenizedBuffer extends Model else startScopes.push(atom.grammars.scopeForId(tag)) else - break unless selector.matches(startScopes) + break unless selectorMatchesAnyScope(selector, startScopes) startColumn -= tag endScopes = scopes.slice() @@ -469,7 +469,7 @@ class TokenizedBuffer extends Model else endScopes.pop() else - break unless selector.matches(endScopes) + break unless selectorMatchesAnyScope(selector, endScopes) endColumn += tag new Range(new Point(position.row, startColumn), new Point(position.row, endColumn)) @@ -504,3 +504,9 @@ if Grim.includeDeprecatedAPIs Grim.deprecate("TokenizedBuffer::on is deprecated. Use event subscription methods instead.") EmitterMixin::on.apply(this, arguments) + +selectorMatchesAnyScope = (selector, scopes) -> + targetClasses = selector.replace(/^\./, '').split('.') + _.any scopes, (scope) -> + scopeClasses = scope.split('.') + _.isSubset(targetClasses, scopeClasses) From 2031e3dfde4a91d881894887135764da2b701574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Thu, 28 May 2015 09:12:49 -0400 Subject: [PATCH 66/74] Use lsb virtual package instead of hard require --- 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 3bc37e83a..2bd89cb9a 100644 --- a/resources/linux/redhat/atom.spec.in +++ b/resources/linux/redhat/atom.spec.in @@ -7,7 +7,7 @@ URL: https://atom.io/ AutoReqProv: no # Avoid libchromiumcontent.so missing dependency Prefix: <%= installDir %> -Requires: redhat-lsb-core +Requires: lsb %description <%= description %> From 7298d141a63854ac1c109e2382bb8be2c236819a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 May 2015 08:47:15 -0700 Subject: [PATCH 67/74] Prepare 0.204 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d0c445d5c..1602fa446 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.203.0", + "version": "0.204.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 67f9d502264fb63c284d233c86cf0977c552b478 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 May 2015 09:06:56 -0700 Subject: [PATCH 68/74] :arrow_up: atom-keymap@5.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1602fa446..100bc6a71 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^5.1.4", + "atom-keymap": "^5.1.5", "atom-space-pen-views": "^2.0.4", "babel-core": "^5.1.11", "bootstrap": "^3.3.4", From 99d4d90d85cf41446029405f115f46fe13b985d2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 May 2015 09:23:21 -0700 Subject: [PATCH 69/74] Prepare 0.205 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 100bc6a71..e93cbb160 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.204.0", + "version": "0.205.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 60633de701d730994d742a587d09249018da37c7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 28 May 2015 12:24:35 -0700 Subject: [PATCH 70/74] :arrow_up: find-and-replace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e93cbb160..5165c61eb 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "dev-live-reload": "0.46.0", "encoding-selector": "0.20.0", "exception-reporting": "0.24.0", - "find-and-replace": "0.169.0", + "find-and-replace": "0.170.0", "fuzzy-finder": "0.87.0", "git-diff": "0.55.0", "go-to-line": "0.30.0", From 7034846d4ff665a87470408cbfb9630c255bdd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Thu, 28 May 2015 15:26:54 -0400 Subject: [PATCH 71/74] Skip linting for benchmark fixtures --- .coffeelintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.coffeelintignore b/.coffeelintignore index 1db51fed7..5c4e30278 100644 --- a/.coffeelintignore +++ b/.coffeelintignore @@ -1 +1,2 @@ spec/fixtures +benchmark/fixtures From 447dfd8bec6df7841df255edae73a8c43f854074 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 28 May 2015 22:58:29 +0200 Subject: [PATCH 72/74] =?UTF-8?q?If=20a=20keystroke=20is=20bound=20to=20?= =?UTF-8?q?=E2=80=98unset!=E2=80=99,=20omit=20it=20in=20the=20application?= =?UTF-8?q?=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes atom/atom-keymap#79 This is more general than I would like. If the keystroke is unset in any context, we err on the side of caution and don’t add it to the application menu for any command. Since our application menu isn’t context aware, this should be good enough for now and solve the 80% case. Someday we should make the application menu update / gray out options when the focused element changes. --- spec/menu-manager-spec.coffee | 30 ++++++++++++++++++++++++++++++ src/menu-manager.coffee | 12 +++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/spec/menu-manager-spec.coffee b/spec/menu-manager-spec.coffee index d92c921c4..f86b6e1a0 100644 --- a/spec/menu-manager-spec.coffee +++ b/spec/menu-manager-spec.coffee @@ -1,3 +1,4 @@ +path = require 'path' MenuManager = require '../src/menu-manager' describe "MenuManager", -> @@ -46,3 +47,32 @@ describe "MenuManager", -> menu.add [{label: "A", submenu: [{label: "B", command: "b"}]}] menu.add [{label: "A", submenu: [{label: "B", command: "b"}]}] expect(menu.template[originalItemCount]).toEqual {label: "A", submenu: [{label: "B", command: "b"}]} + + describe "::update()", -> + it "sends the current menu template and associated key bindings to the browser process", -> + spyOn(menu, 'sendToBrowserProcess') + menu.add [{label: "A", submenu: [{label: "B", command: "b"}]}] + atom.keymap.add 'test', 'atom-workspace': 'ctrl-b': 'b' + menu.update() + + waits 1 + + runs -> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toEqual ['ctrl-b'] + + it "omits key bindings that are mapped to unset! in any context", -> + # it would be nice to be smarter about omitting, but that would require a much + # more dynamic interaction between the currently focused element and the menu + spyOn(menu, 'sendToBrowserProcess') + menu.add [{label: "A", submenu: [{label: "B", command: "b"}]}] + atom.keymap.add 'test', 'atom-workspace': 'ctrl-b': 'b' + atom.keymap.add 'test', 'atom-text-editor': 'ctrl-b': 'unset!' + + waits 1 + + runs -> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toBeUndefined() + + it "updates the application menu when a keymap is reloaded", -> + spyOn(menu, 'update') + keymapPath = path.join(__dirname, 'fixtures', 'packages', 'package-with-keymaps', 'keymaps', 'keymap-1.cson') + atom.keymaps.reloadKeymap(keymapPath) + expect(menu.update).toHaveBeenCalled() diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index b5c9a80e3..b138f2da2 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -63,6 +63,7 @@ class MenuManager @pendingUpdateOperation = null @template = [] atom.keymaps.onDidLoadBundledKeymaps => @loadPlatformItems() + atom.keymaps.onDidReloadKeymap => @update() atom.packages.onDidActivateInitialPackages => @sortPackagesMenu() # Public: Adds the given items to the application menu. @@ -139,10 +140,19 @@ class MenuManager update: -> clearImmediate(@pendingUpdateOperation) if @pendingUpdateOperation? @pendingUpdateOperation = setImmediate => - keystrokesByCommand = {} + includedBindings = [] + unsetKeystrokes = new Set + for binding in atom.keymaps.getKeyBindings() when @includeSelector(binding.selector) + includedBindings.push(binding) + if binding.command is 'unset!' + unsetKeystrokes.add(binding.keystrokes) + + keystrokesByCommand = {} + for binding in includedBindings when not unsetKeystrokes.has(binding.keystrokes) keystrokesByCommand[binding.command] ?= [] keystrokesByCommand[binding.command].unshift binding.keystrokes + @sendToBrowserProcess(@template, keystrokesByCommand) loadPlatformItems: -> From ba9c0c65c1e61d4b38d9d9f41d5754bd7f0bc124 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 29 May 2015 15:12:34 +0900 Subject: [PATCH 73/74] :arrow_up: one-dark/light-syntax@0.7.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5165c61eb..5bb2738bc 100644 --- a/package.json +++ b/package.json @@ -78,8 +78,8 @@ "base16-tomorrow-dark-theme": "0.26.0", "base16-tomorrow-light-theme": "0.9.0", "one-dark-ui": "0.8.2", - "one-dark-syntax": "0.5.0", - "one-light-syntax": "0.6.0", + "one-dark-syntax": "0.7.0", + "one-light-syntax": "0.7.0", "one-light-ui": "0.8.2", "solarized-dark-syntax": "0.35.0", "solarized-light-syntax": "0.21.0", From 7c968542faccb5d09d501475c3761c0b65582950 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 29 May 2015 15:13:50 +0900 Subject: [PATCH 74/74] :arrow_up: one-dark/light-ui@0.9.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5bb2738bc..54ef562b4 100644 --- a/package.json +++ b/package.json @@ -77,10 +77,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.26.0", "base16-tomorrow-light-theme": "0.9.0", - "one-dark-ui": "0.8.2", + "one-dark-ui": "0.9.0", "one-dark-syntax": "0.7.0", "one-light-syntax": "0.7.0", - "one-light-ui": "0.8.2", + "one-light-ui": "0.9.0", "solarized-dark-syntax": "0.35.0", "solarized-light-syntax": "0.21.0", "archive-view": "0.57.0",