From 83955397747efc953cf6ffafbc60a6e956385023 Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Tue, 24 Sep 2013 15:36:49 -0700 Subject: [PATCH 01/57] Update settings-view for theme filtering --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b93a3564a..f695903b7 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "markdown-preview": "0.3.0", "metrics": "0.1.1", "package-generator": "0.8.0", - "settings-view": "0.22.0", + "settings-view": "0.23.0", "snippets": "0.5.0", "spell-check": "0.5.0", "status-bar": "0.7.0", From 9f697996bcfa6c11cbdde5a6e37589888f8aefe3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 17:05:13 -0700 Subject: [PATCH 02/57] Remove patrick from dependencies --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index f695903b7..2a7c6b03c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "oniguruma": "0.20.0", "optimist": "0.4.0", "pathwatcher": "0.5.0", - "patrick": "0.4.0", "pegjs": "0.7.0", "plist": "git://github.com/nathansobo/node-plist.git", "rimraf": "2.1.4", From 64a619fc96e9dcd981987802037c5a4df7724501 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 17:05:34 -0700 Subject: [PATCH 03/57] Upgrade to collaboration@0.14.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a7c6b03c..809df5245 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "autoflow": "0.2.0", "bookmarks": "0.3.0", "bracket-matcher": "0.4.0", - "collaboration": "0.11.0", + "collaboration": "0.14.0", "command-logger": "0.3.0", "command-palette": "0.3.0", "editor-stats": "0.2.0", From e6f7ed9862ed6a88f657b316c4eda7324260f2a0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 20:34:36 -0700 Subject: [PATCH 04/57] Run script/test from npm test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 809df5245..0e3f366ea 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,6 @@ "private": true, "scripts": { "preinstall": "true", - "test": "grunt test" + "test": "script/test" } } From 31c03258e9d9f2dadf2970237c83616270b736a3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 20:48:51 -0700 Subject: [PATCH 05/57] Log app start time similarly to window start time --- src/main.coffee | 3 +++ src/window-bootstrap.coffee | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.coffee b/src/main.coffee index fda609044..edcfa1f89 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -1,3 +1,5 @@ +startTime = new Date().getTime() + autoUpdater = require 'auto-updater' crashReporter = require 'crash-reporter' delegate = require 'atom-delegate' @@ -53,6 +55,7 @@ delegate.browserMainParts.preMainMessageLoopRun = -> AtomApplication = require 'atom-application' AtomApplication.open(args) + console.log("App load time #{new Date().getTime() - startTime}ms") global.devResourcePath = path.join(app.getHomeDir(), 'github', 'atom') diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee index cf7cbdaa6..bccf2ee92 100644 --- a/src/window-bootstrap.coffee +++ b/src/window-bootstrap.coffee @@ -1,8 +1,9 @@ # Like sands through the hourglass, so are the days of our lives. -date = new Date().getTime() +startTime = new Date().getTime() + require './atom' require './window' window.setUpEnvironment('editor') window.startEditorWindow() -console.log "Load time: #{new Date().getTime() - date}" +console.log "Window load time: #{new Date().getTime() - startTime}ms" From 01a02d168df8455e90f8e537090df6305ac5314c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 20:57:29 -0700 Subject: [PATCH 06/57] Remove unused require --- src/main.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.coffee b/src/main.coffee index edcfa1f89..49dc08042 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -9,7 +9,6 @@ path = require 'path' optimist = require 'optimist' nslog = require 'nslog' dialog = require 'dialog' -_ = require 'underscore' console.log = (args...) -> nslog(args.map((arg) -> JSON.stringify(arg)).join(" ")) From b65c735666d9bb31ac12c8e273a6bcff1a571d0a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 20:58:49 -0700 Subject: [PATCH 07/57] :lipstick: Move require to top --- src/main.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.coffee b/src/main.coffee index 49dc08042..449730ca9 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -5,6 +5,7 @@ crashReporter = require 'crash-reporter' delegate = require 'atom-delegate' app = require 'app' fs = require 'fs' +module = require 'module' path = require 'path' optimist = require 'optimist' nslog = require 'nslog' @@ -46,10 +47,10 @@ delegate.browserMainParts.preMainMessageLoopRun = -> require('coffee-script') if args.devMode require(path.join(args.resourcePath, 'src', 'coffee-cache')) - require('module').globalPaths.push(path.join(args.resourcePath, 'src')) + module.globalPaths.push(path.join(args.resourcePath, 'src')) else appSrcPath = path.resolve(process.argv[0], "../../Resources/app/src") - require('module').globalPaths.push(appSrcPath) + module.globalPaths.push(appSrcPath) AtomApplication = require 'atom-application' From 04e7bd86d77e0dda37c4304269c647b68a259201 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 21:03:21 -0700 Subject: [PATCH 08/57] :lipstick: Consistently format time log messages --- src/main.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.coffee b/src/main.coffee index 449730ca9..2e42f9888 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -55,7 +55,7 @@ delegate.browserMainParts.preMainMessageLoopRun = -> AtomApplication = require 'atom-application' AtomApplication.open(args) - console.log("App load time #{new Date().getTime() - startTime}ms") + console.log("App load time: #{new Date().getTime() - startTime}ms") global.devResourcePath = path.join(app.getHomeDir(), 'github', 'atom') From ef48da9f2e57a152bcfb37533c8eff99f4bb12f3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 21:20:11 -0700 Subject: [PATCH 09/57] Upgrade to timecop@0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e3f366ea..0233908f4 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "symbols-view": "0.5.0", "tabs": "0.4.0", "terminal": "0.9.0", - "timecop": "0.2.0", + "timecop": "0.3.0", "to-the-hubs": "0.3.0", "toml": "0.2.0", "tree-view": "0.6.0", From 9222f158b59743f54754c4f3a2dd0e4ff71e9a60 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 21:31:48 -0700 Subject: [PATCH 10/57] Measure load/activate time in package classes --- src/atom-package.coffee | 54 +++++++++++++++++++----------------- src/atom.coffee | 4 --- src/package.coffee | 6 ++++ src/text-mate-package.coffee | 20 +++++++------ 4 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/atom-package.coffee b/src/atom-package.coffee index ced29a9df..80363c886 100644 --- a/src/atom-package.coffee +++ b/src/atom-package.coffee @@ -28,37 +28,39 @@ class AtomPackage extends Package getType: -> 'atom' load: -> - try - @metadata = Package.loadMetadata(@path) - if @isTheme() - @stylesheets = [] - @keymaps = [] - @menus = [] - @grammars = [] - @scopedProperties = [] - else - @loadKeymaps() - @loadMenus() - @loadStylesheets() - @loadGrammars() - @loadScopedProperties() - - if @metadata.activationEvents? - @registerDeferredDeserializers() + @measure 'loadTime', => + try + @metadata = Package.loadMetadata(@path) + if @isTheme() + @stylesheets = [] + @keymaps = [] + @menus = [] + @grammars = [] + @scopedProperties = [] else - @requireMainModule() + @loadKeymaps() + @loadMenus() + @loadStylesheets() + @loadGrammars() + @loadScopedProperties() - catch e - console.warn "Failed to load package named '#{@name}'", e.stack ? e + if @metadata.activationEvents? + @registerDeferredDeserializers() + else + @requireMainModule() + + catch e + console.warn "Failed to load package named '#{@name}'", e.stack ? e this activate: ({immediate}={}) -> - @loadStylesheets() if @isTheme() - @activateResources() - if @metadata.activationEvents? and not immediate - @subscribeToActivationEvents() - else - @activateNow() + @measure 'activateTime', => + @loadStylesheets() if @isTheme() + @activateResources() + if @metadata.activationEvents? and not immediate + @subscribeToActivationEvents() + else + @activateNow() activateNow: -> try diff --git a/src/atom.coffee b/src/atom.coffee index 63d395284..a2545d33a 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -34,9 +34,7 @@ window.atom = activatePackage: (name, options) -> if pack = @loadPackage(name, options) @activePackages[pack.name] = pack - startTime = new Date().getTime() pack.activate(options) - pack.activateTime = new Date().getTime() - startTime pack deactivatePackages: -> @@ -73,9 +71,7 @@ window.atom = if packagePath = @resolvePackagePath(name) return pack if pack = @getLoadedPackage(name) - startTime = new Date().getTime() pack = Package.load(packagePath, options) - pack.loadTime = new Date().getTime() - startTime if pack.metadata.theme @themes.register(pack) else diff --git a/src/package.coffee b/src/package.coffee index 81cc45fed..4a1a2571f 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -39,3 +39,9 @@ class Package isTheme: -> !!@metadata?.theme + + # Private: + measure: (key, fn) -> + startTime = new Date().getTime() + fn() + @[key] = new Date().getTime() - startTime diff --git a/src/text-mate-package.coffee b/src/text-mate-package.coffee index b3cc97843..1cfb9d5ba 100644 --- a/src/text-mate-package.coffee +++ b/src/text-mate-package.coffee @@ -29,18 +29,20 @@ class TextMatePackage extends Package getType: -> 'textmate' load: ({sync}={}) -> - @metadata = Package.loadMetadata(@path, true) + @measure 'loadTime', => + @metadata = Package.loadMetadata(@path, true) - if sync - @loadGrammarsSync() - @loadScopedPropertiesSync() - else - TextMatePackage.getLoadQueue().push(this) + if sync + @loadGrammarsSync() + @loadScopedPropertiesSync() + else + TextMatePackage.getLoadQueue().push(this) activate: -> - syntax.addGrammar(grammar) for grammar in @grammars - for { selector, properties } in @scopedProperties - syntax.addProperties(@path, selector, properties) + @measure 'activateTime', => + syntax.addGrammar(grammar) for grammar in @grammars + for { selector, properties } in @scopedProperties + syntax.addProperties(@path, selector, properties) activateConfig: -> # noop From ea54fd78b8552587557b08032172606ae5ca5913 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 21:44:42 -0700 Subject: [PATCH 11/57] Add getter for loaded themes --- src/theme-manager.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 66ed646c5..8fbbea4e3 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -29,6 +29,10 @@ class ThemeManager getActiveThemes: -> _.clone(@activeThemes) + # Internal-only: + getLoadedThemes: -> + _.clone(@loadedThemes) + # Internal-only: unload: -> removeStylesheet(@userStylesheetPath) if @userStylesheetPath? From 06029836405af63cf476e069291fc0f12ccaf3f8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 21:54:24 -0700 Subject: [PATCH 12/57] Upgrade to timecop@0.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0233908f4..697bb5cec 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "symbols-view": "0.5.0", "tabs": "0.4.0", "terminal": "0.9.0", - "timecop": "0.3.0", + "timecop": "0.4.0", "to-the-hubs": "0.3.0", "toml": "0.2.0", "tree-view": "0.6.0", From 774aba3c7db92f727de61d6f1dccd297034947fc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Sep 2013 17:30:58 +0800 Subject: [PATCH 13/57] Update atom-shell to v0.5.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 697bb5cec..af706ee0b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "bugs": { "url": "https://github.com/atom/atom/issues" }, - "atomShellVersion": "0.4.9", + "atomShellVersion": "0.5.0", "dependencies": { "async": "0.2.6", "bootstrap": "git://github.com/twbs/bootstrap.git#v3.0.0", From 685ec46fbbc19cf9ba846f2c010268fb4dfd80b6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 10:15:32 -0700 Subject: [PATCH 14/57] Upgrade to metrics@0.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af706ee0b..7c06dc601 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "image-view": "0.5.0", "link": "0.2.0", "markdown-preview": "0.3.0", - "metrics": "0.1.1", + "metrics": "0.2.0", "package-generator": "0.8.0", "settings-view": "0.23.0", "snippets": "0.5.0", From 00c0baecebfcef6276ec478d2a36604032309395 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 10:22:26 -0700 Subject: [PATCH 15/57] Upgrade to metrics@0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c06dc601..b0273a496 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "image-view": "0.5.0", "link": "0.2.0", "markdown-preview": "0.3.0", - "metrics": "0.2.0", + "metrics": "0.3.0", "package-generator": "0.8.0", "settings-view": "0.23.0", "snippets": "0.5.0", From d4047c80cbb1deae77f5135df0fe440f0f51a4a2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Sep 2013 20:24:33 -0700 Subject: [PATCH 16/57] Load package stylesheets right before activation Previously this was done eagerly for packages using activation events. --- src/atom-package.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/atom-package.coffee b/src/atom-package.coffee index 80363c886..1074eca48 100644 --- a/src/atom-package.coffee +++ b/src/atom-package.coffee @@ -65,6 +65,7 @@ class AtomPackage extends Package activateNow: -> try @activateConfig() + @activateStylesheets() if @requireMainModule() @mainModule.activate(atom.getPackageState(@name) ? {}) @mainActivated = true @@ -80,11 +81,13 @@ class AtomPackage extends Package @mainModule.activateConfig?() @configActivated = true + activateStylesheets: -> + type = if @metadata.theme then 'theme' else 'bundled' + applyStylesheet(stylesheetPath, content, type) for [stylesheetPath, content] in @stylesheets + activateResources: -> keymap.add(keymapPath, map) for [keymapPath, map] in @keymaps atom.contextMenu.add(menuPath, map['context-menu']) for [menuPath, map] in @menus - type = if @metadata.theme then 'theme' else 'bundled' - applyStylesheet(stylesheetPath, content, type) for [stylesheetPath, content] in @stylesheets syntax.addGrammar(grammar) for grammar in @grammars for [scopedPropertiesPath, selector, properties] in @scopedProperties syntax.addProperties(scopedPropertiesPath, selector, properties) From 8dc6d57901b6a53155cd69054e8010251b2769a3 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 16 Sep 2013 15:54:14 -0700 Subject: [PATCH 17/57] Ignore test --- spec/project-spec.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 0918c755f..34f26846d 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -349,7 +349,8 @@ describe "Project", -> expect(paths[0]).toBe filePath expect(matches.length).toBe 1 - it "excludes values in core.ignoredNames", -> + xit "excludes values in core.ignoredNames", -> + # FIXME: this test doesnt make any sense. Why should it ignore the whole project dir? projectPath = '/tmp/atom-tests/folder-with-dot-git/.git' filePath = path.join(projectPath, 'test.txt') fs.writeSync(filePath, 'match this') From d8fdbcf1b19502aa0aae6bd36a807578243674c5 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 16 Sep 2013 16:11:01 -0700 Subject: [PATCH 18/57] Use the -G param in project::scan to search within directories --- spec/project-spec.coffee | 18 ++++++++++++++++++ src/project.coffee | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 34f26846d..017bb6a13 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -332,6 +332,24 @@ describe "Project", -> expect(paths.length).toBe 0 expect(matches.length).toBe 0 + it "includes only files when a directory filter is specified", -> + projectPath = fsUtils.resolveOnLoadPath('fixtures/dir') + project.setPath(projectPath) + + filePath = path.join(projectPath, 'a-dir', 'oh-git') + + paths = [] + matches = [] + waitsForPromise -> + project.scan /aaa/, paths: ['a-dir/'], (result) -> + paths.push(result.path) + matches.push(result.match) + + runs -> + expect(paths.length).toBe 1 + expect(paths[0]).toBe filePath + expect(matches.length).toBe 1 + it "includes files and folders that begin with a '.'", -> projectPath = '/tmp/atom-tests/folder-with-dot-file' filePath = path.join(projectPath, '.text') diff --git a/src/project.coffee b/src/project.coffee index fe0cc0b8c..ca3c16e68 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -278,9 +278,15 @@ class Project # # * regex: # A RegExp to search with + # * options: + # - paths: an {Array} of path names to search within # * iterator: # A Function callback on each file found - scan: (regex, iterator) -> + scan: (regex, options={}, iterator) -> + if _.isFunction(options) + iterator = options + options = {} + bufferedData = "" state = 'readingPath' filePath = null @@ -333,6 +339,7 @@ class Project command = require.resolve('.bin/nak') args = ['--hidden', '--ackmate', regex.source, @getPath()] ignoredNames = config.get('core.ignoredNames') ? [] + args.unshift('-G', options.paths.join(',')) if options.paths and options.paths.length > 0 args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 args.unshift('--ignoreCase') if regex.ignoreCase args.unshift('--addVCSIgnores') if config.get('core.excludeVcsIgnoredPaths') From cf88868bf0d2fb011831c3e8159923dcff3e2e95 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 16 Sep 2013 16:14:51 -0700 Subject: [PATCH 19/57] Use the full name of the -G option --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index ca3c16e68..2477e819e 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -339,7 +339,7 @@ class Project command = require.resolve('.bin/nak') args = ['--hidden', '--ackmate', regex.source, @getPath()] ignoredNames = config.get('core.ignoredNames') ? [] - args.unshift('-G', options.paths.join(',')) if options.paths and options.paths.length > 0 + args.unshift('--pathInclude', options.paths.join(',')) if options.paths and options.paths.length > 0 args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 args.unshift('--ignoreCase') if regex.ignoreCase args.unshift('--addVCSIgnores') if config.get('core.excludeVcsIgnoredPaths') From 6dd08f85d34609ff668a387f93291dd0542b5fb9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 16 Sep 2013 17:13:33 -0700 Subject: [PATCH 20/57] Return the lineText from project.scan Also change up match -> matchText for consistency. --- spec/project-spec.coffee | 25 +++++++++++++++---------- src/project.coffee | 4 ++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 017bb6a13..5067dd02c 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -240,12 +240,14 @@ describe "Project", -> runs -> expect(matches[0]).toEqual path: project.resolve('a') - match: 'aaa' + matchText: 'aaa' + lineText: 'aaa bbb' range: [[0, 0], [0, 3]] expect(matches[1]).toEqual path: project.resolve('a') - match: 'aa' + matchText: 'aa' + lineText: 'cc aa cc' range: [[1, 3], [1, 5]] it "works with with escaped literals (like $ and ^)", -> @@ -258,7 +260,8 @@ describe "Project", -> expect(matches[0]).toEqual path: project.resolve('a') - match: '$bill' + matchText: '$bill' + lineText: 'dollar$bill' range: [[2, 6], [2, 11]] it "works on evil filenames", -> @@ -268,7 +271,7 @@ describe "Project", -> waitsForPromise -> project.scan /evil/, (result) -> paths.push(result.path) - matches.push(result.match) + matches.push(result.matchText) runs -> expect(paths.length).toBe 5 @@ -299,12 +302,14 @@ describe "Project", -> expect(iterator.argsForCall[0][0]).toEqual path: project.resolve('a') - match: 'aaa' + matchText: 'aaa' + lineText: 'aaa bbb' range: [[0, 0], [0, 3]] expect(iterator.argsForCall[1][0]).toEqual path: project.resolve('a') - match: 'aa' + matchText: 'aa' + lineText: 'cc aa cc' range: [[1, 3], [1, 5]] describe "when the core.excludeVcsIgnoredPaths config is truthy", -> @@ -326,7 +331,7 @@ describe "Project", -> waitsForPromise -> project.scan /match/, (result) -> paths.push(result.path) - matches.push(result.match) + matches.push(result.matchText) runs -> expect(paths.length).toBe 0 @@ -343,7 +348,7 @@ describe "Project", -> waitsForPromise -> project.scan /aaa/, paths: ['a-dir/'], (result) -> paths.push(result.path) - matches.push(result.match) + matches.push(result.matchText) runs -> expect(paths.length).toBe 1 @@ -360,7 +365,7 @@ describe "Project", -> waitsForPromise -> project.scan /match this/, (result) -> paths.push(result.path) - matches.push(result.match) + matches.push(result.matchText) runs -> expect(paths.length).toBe 1 @@ -378,7 +383,7 @@ describe "Project", -> waitsForPromise -> project.scan /match/, (result) -> paths.push(result.path) - matches.push(result.match) + matches.push(result.matchText) runs -> expect(paths.length).toBe 0 diff --git a/src/project.coffee b/src/project.coffee index 2477e819e..16d42b948 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -316,8 +316,8 @@ class Project for [column, length] in matchPositions range = new Range([row, column], [row, column + length]) - match = lineText.substr(column, length) - iterator({path: filePath, range, match}) + matchText = lineText.substr(column, length) + iterator({path: filePath, range, matchText, lineText}) deferred = $.Deferred() errors = [] From 861adf669230a3f16a14909fd63c31ac67218164 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 23 Sep 2013 15:46:57 -0700 Subject: [PATCH 21/57] Start using `scandal` and make the specs pass --- package.json | 3 +- spec/fixtures/git/working-dir/.gitignore | 3 +- spec/fixtures/git/working-dir/git.git/HEAD | 1 + spec/fixtures/git/working-dir/git.git/config | 6 ++ spec/fixtures/git/working-dir/git.git/index | Bin 0 -> 137 bytes .../65/a457425a679cbe9adf0d2741785d3ceabb44a7 | Bin 0 -> 50 bytes .../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | Bin 0 -> 15 bytes .../ef/046e9eecaa5255ea5e9817132d4001724d6ae1 | Bin 0 -> 132 bytes .../git/working-dir/git.git/refs/heads/master | 1 + spec/git-spec.coffee | 1 + spec/project-spec.coffee | 94 ++++++++---------- src/project.coffee | 73 +++----------- 12 files changed, 70 insertions(+), 112 deletions(-) create mode 100644 spec/fixtures/git/working-dir/git.git/HEAD create mode 100644 spec/fixtures/git/working-dir/git.git/config create mode 100644 spec/fixtures/git/working-dir/git.git/index create mode 100644 spec/fixtures/git/working-dir/git.git/objects/65/a457425a679cbe9adf0d2741785d3ceabb44a7 create mode 100644 spec/fixtures/git/working-dir/git.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 create mode 100644 spec/fixtures/git/working-dir/git.git/objects/ef/046e9eecaa5255ea5e9817132d4001724d6ae1 create mode 100644 spec/fixtures/git/working-dir/git.git/refs/heads/master diff --git a/package.json b/package.json index b0273a496..93a0f4d51 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "mkdirp": "0.3.5", "less": "git://github.com/nathansobo/less.js.git", "less-cache": "0.8.0", - "nak": "0.2.18", "nslog": "0.1.0", "oniguruma": "0.20.0", "optimist": "0.4.0", @@ -30,6 +29,7 @@ "pegjs": "0.7.0", "plist": "git://github.com/nathansobo/node-plist.git", "rimraf": "2.1.4", + "scandal": "0.1.0", "season": "0.13.0", "semver": "1.1.4", "space-pen": "1.2.0", @@ -117,6 +117,7 @@ }, "devDependencies": { "biscotto": "0.0.17", + "fstream": "0.1.24", "grunt": "~0.4.1", "grunt-cli": "~0.1.9", "grunt-coffeelint": "0.0.6", diff --git a/spec/fixtures/git/working-dir/.gitignore b/spec/fixtures/git/working-dir/.gitignore index 09f5ff762..23238eafc 100644 --- a/spec/fixtures/git/working-dir/.gitignore +++ b/spec/fixtures/git/working-dir/.gitignore @@ -1 +1,2 @@ -ignored.txt \ No newline at end of file +poop +ignored.txt diff --git a/spec/fixtures/git/working-dir/git.git/HEAD b/spec/fixtures/git/working-dir/git.git/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/spec/fixtures/git/working-dir/git.git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/spec/fixtures/git/working-dir/git.git/config b/spec/fixtures/git/working-dir/git.git/config new file mode 100644 index 000000000..af107929f --- /dev/null +++ b/spec/fixtures/git/working-dir/git.git/config @@ -0,0 +1,6 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true diff --git a/spec/fixtures/git/working-dir/git.git/index b/spec/fixtures/git/working-dir/git.git/index new file mode 100644 index 0000000000000000000000000000000000000000..bf35b18cd334b5611b86f4a8dc91bf08542daf34 GIT binary patch literal 137 zcmZ?q402{*U|<4b#(>UEnLwHWMl&)nurS0#rZX@!E&)n^1xks46HxQkR4~MWxT#H|svHx?@GG&8yum a%eN^dzV?cL@sl}bFS|j92$yAM$22rPLQ6n?I4({XK>N literal 0 HcmV?d00001 diff --git a/spec/fixtures/git/working-dir/git.git/refs/heads/master b/spec/fixtures/git/working-dir/git.git/refs/heads/master new file mode 100644 index 000000000..6134b5707 --- /dev/null +++ b/spec/fixtures/git/working-dir/git.git/refs/heads/master @@ -0,0 +1 @@ +ef046e9eecaa5255ea5e9817132d4001724d6ae1 diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index 2a972c4ca..26966b2a5 100644 --- a/spec/git-spec.coffee +++ b/spec/git-spec.coffee @@ -1,3 +1,4 @@ +temp = require 'temp' Git = require '../src/git' {fs} = require 'atom' path = require 'path' diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 5067dd02c..63f5463f3 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -1,3 +1,5 @@ +temp = require 'temp' +fstream = require 'fstream' Project = require '../src/project' {_, fs} = require 'atom' path = require 'path' @@ -238,17 +240,13 @@ describe "Project", -> project.scan /(a)+/, (match) -> matches.push(match) runs -> - expect(matches[0]).toEqual - path: project.resolve('a') - matchText: 'aaa' - lineText: 'aaa bbb' - range: [[0, 0], [0, 3]] - - expect(matches[1]).toEqual - path: project.resolve('a') - matchText: 'aa' - lineText: 'cc aa cc' - range: [[1, 3], [1, 5]] + expect(matches).toHaveLength(3) + expect(matches[0].path).toBe project.resolve('a') + expect(matches[0].matches).toHaveLength(3) + expect(matches[0].matches[0]).toEqual + matchText: 'aaa' + lineText: 'aaa bbb' + range: [[0, 0], [0, 3]] it "works with with escaped literals (like $ and ^)", -> matches = [] @@ -258,8 +256,10 @@ describe "Project", -> runs -> expect(matches.length).toBe 1 + {path: resultPath, matches} = matches[0] + expect(resultPath).toBe project.resolve('a') + expect(matches).toHaveLength 1 expect(matches[0]).toEqual - path: project.resolve('a') matchText: '$bill' lineText: 'dollar$bill' range: [[2, 6], [2, 11]] @@ -271,11 +271,11 @@ describe "Project", -> waitsForPromise -> project.scan /evil/, (result) -> paths.push(result.path) - matches.push(result.matchText) + matches = matches.concat(result.matches) runs -> expect(paths.length).toBe 5 - matches.forEach (match) -> expect(match).toEqual 'evil' + matches.forEach (match) -> expect(match.matchText).toEqual 'evil' expect(paths[0]).toMatch /a_file_with_utf8.txt$/ expect(paths[1]).toMatch /file with spaces.txt$/ expect(paths[2]).toMatch /goddam\nnewlines$/m @@ -283,62 +283,49 @@ describe "Project", -> expect(path.basename(paths[4])).toBe "utfa\u0306.md" it "ignores case if the regex includes the `i` flag", -> - matches = [] + results = [] waitsForPromise -> - project.scan /DOLLAR/i, (match) -> matches.push(match) + project.scan /DOLLAR/i, (result) -> results.push(result) runs -> - expect(matches).toHaveLength 1 - - it "handles breaks in the search subprocess's output following the filename", -> - spyOn(BufferedProcess.prototype, 'bufferStream') - - iterator = jasmine.createSpy('iterator') - project.scan /a+/, iterator - - stdout = BufferedProcess.prototype.bufferStream.argsForCall[0][1] - stdout ":#{path.join(__dirname, 'fixtures', 'dir', 'a')}\n" - stdout "1;0 3:aaa bbb\n2;3 2:cc aa cc\n" - - expect(iterator.argsForCall[0][0]).toEqual - path: project.resolve('a') - matchText: 'aaa' - lineText: 'aaa bbb' - range: [[0, 0], [0, 3]] - - expect(iterator.argsForCall[1][0]).toEqual - path: project.resolve('a') - matchText: 'aa' - lineText: 'cc aa cc' - range: [[1, 3], [1, 5]] + expect(results).toHaveLength 1 describe "when the core.excludeVcsIgnoredPaths config is truthy", -> [projectPath, ignoredPath] = [] beforeEach -> - projectPath = path.join(__dirname, 'fixtures', 'git', 'working-dir') - ignoredPath = path.join(projectPath, 'ignored.txt') - fs.writeSync(ignoredPath, 'this match should not be included') + sourceProjectPath = path.join(__dirname, 'fixtures', 'git', 'working-dir') + projectPath = path.join(temp.mkdirSync("atom")) + + writerStream = fstream.Writer(projectPath) + fstream.Reader(sourceProjectPath).pipe(writerStream) + + waitsFor (done) -> + writerStream.on 'close', done + writerStream.on 'error', done + + runs -> + fs.rename(path.join(projectPath, 'git.git'), path.join(projectPath, '.git')) + ignoredPath = path.join(projectPath, 'ignored.txt') + fs.writeSync(ignoredPath, 'this match should not be included') afterEach -> - fs.remove(ignoredPath) if fs.exists(ignoredPath) + fs.remove(projectPath) if fs.exists(projectPath) it "excludes ignored files", -> project.setPath(projectPath) config.set('core.excludeVcsIgnoredPaths', true) - paths = [] - matches = [] + resultHandler = jasmine.createSpy("result found") waitsForPromise -> - project.scan /match/, (result) -> - paths.push(result.path) - matches.push(result.matchText) + project.scan /match/, (results) -> + console.log results + resultHandler() runs -> - expect(paths.length).toBe 0 - expect(matches.length).toBe 0 + expect(resultHandler).not.toHaveBeenCalled() it "includes only files when a directory filter is specified", -> - projectPath = fsUtils.resolveOnLoadPath('fixtures/dir') + projectPath = path.join(path.join(__dirname, 'fixtures', 'dir')) project.setPath(projectPath) filePath = path.join(projectPath, 'a-dir', 'oh-git') @@ -348,7 +335,8 @@ describe "Project", -> waitsForPromise -> project.scan /aaa/, paths: ['a-dir/'], (result) -> paths.push(result.path) - matches.push(result.matchText) + console.log result + matches = matches.concat(result.matches) runs -> expect(paths.length).toBe 1 @@ -365,7 +353,7 @@ describe "Project", -> waitsForPromise -> project.scan /match this/, (result) -> paths.push(result.path) - matches.push(result.matchText) + matches = matches.concat(result.matches) runs -> expect(paths.length).toBe 1 diff --git a/src/project.coffee b/src/project.coffee index 16d42b948..de2f1eb6c 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -1,6 +1,7 @@ fsUtils = require './fs-utils' path = require 'path' url = require 'url' +{PathSearcher, PathScanner, search} = require 'scandal' _ = require './underscore-extensions' $ = require './jquery-extensions' @@ -10,7 +11,6 @@ TextBuffer = require './text-buffer' EditSession = require './edit-session' EventEmitter = require './event-emitter' Directory = require './directory' -BufferedNodeProcess = require './buffered-node-process' Git = require './git' # Public: Represents a project that's opened in Atom. @@ -279,7 +279,7 @@ class Project # * regex: # A RegExp to search with # * options: - # - paths: an {Array} of path names to search within + # - paths: an {Array} of glob patterns to search within # * iterator: # A Function callback on each file found scan: (regex, options={}, iterator) -> @@ -287,63 +287,22 @@ class Project iterator = options options = {} - bufferedData = "" - state = 'readingPath' - filePath = null - - readPath = (line) -> - if /^[0-9,; ]+:/.test(line) - state = 'readingLines' - else if /^:/.test line - filePath = line.substr(1) - else - filePath += ('\n' + line) - - readLine = (line) -> - if line.length == 0 - state = 'readingPath' - filePath = null - else - colonIndex = line.indexOf(':') - matchInfo = line.substring(0, colonIndex) - lineText = line.substring(colonIndex + 1) - readMatches(matchInfo, lineText) - - readMatches = (matchInfo, lineText) -> - [lineNumber, matchPositionsText] = matchInfo.match(/(\d+);(.+)/)[1..] - row = parseInt(lineNumber) - 1 - matchPositions = matchPositionsText.split(',').map (positionText) -> positionText.split(' ').map (pos) -> parseInt(pos) - - for [column, length] in matchPositions - range = new Range([row, column], [row, column + length]) - matchText = lineText.substr(column, length) - iterator({path: filePath, range, matchText, lineText}) - deferred = $.Deferred() - errors = [] - stderr = (data) -> - errors.push(data) - stdout = (data) -> - lines = data.split('\n') - lines.pop() # the last segment is a spurious '' because data always ends in \n due to bufferLines: true - for line in lines - readPath(line) if state is 'readingPath' - readLine(line) if state is 'readingLines' - exit = (code) -> - if code is 0 - deferred.resolve() - else - console.error("Project scan failed: #{code}", errors.join('\n')) - deferred.reject({command, code}) + searchOptions = + inclusions: options.paths + includeHidden: true + excludeVcsIgnores: config.get('core.excludeVcsIgnoredPaths') + # args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 + + searcher = new PathSearcher() + scanner = new PathScanner(@getPath(), searchOptions) + + searcher.on 'results-found', (result) -> + iterator(result) + + search regex, scanner, searcher, -> + deferred.resolve() - command = require.resolve('.bin/nak') - args = ['--hidden', '--ackmate', regex.source, @getPath()] - ignoredNames = config.get('core.ignoredNames') ? [] - args.unshift('--pathInclude', options.paths.join(',')) if options.paths and options.paths.length > 0 - args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 - args.unshift('--ignoreCase') if regex.ignoreCase - args.unshift('--addVCSIgnores') if config.get('core.excludeVcsIgnoredPaths') - new BufferedNodeProcess({command, args, stdout, stderr, exit}) deferred # Private: From e26d7a032068f0d163754441cff5271ed01bcc9f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 11:43:58 -0700 Subject: [PATCH 22/57] wip --- src/project.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/project.coffee b/src/project.coffee index de2f1eb6c..f454f074b 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -300,7 +300,9 @@ class Project searcher.on 'results-found', (result) -> iterator(result) + console.time("search") search regex, scanner, searcher, -> + console.timeEnd("search") deferred.resolve() deferred From cd554a4f7bf2d60c42cbe955ba2dacf5679a68f2 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 13:21:12 -0700 Subject: [PATCH 23/57] Project::scan uses a task to do its work --- src/project.coffee | 17 +++++++---------- src/scan-handler.coffee | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 src/scan-handler.coffee diff --git a/src/project.coffee b/src/project.coffee index f454f074b..a059b2020 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -1,7 +1,6 @@ fsUtils = require './fs-utils' path = require 'path' url = require 'url' -{PathSearcher, PathScanner, search} = require 'scandal' _ = require './underscore-extensions' $ = require './jquery-extensions' @@ -11,6 +10,7 @@ TextBuffer = require './text-buffer' EditSession = require './edit-session' EventEmitter = require './event-emitter' Directory = require './directory' +Task = require './task' Git = require './git' # Public: Represents a project that's opened in Atom. @@ -288,23 +288,20 @@ class Project options = {} deferred = $.Deferred() + searchOptions = + ignoreCase: regex.ignoreCase inclusions: options.paths includeHidden: true excludeVcsIgnores: config.get('core.excludeVcsIgnoredPaths') # args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 - searcher = new PathSearcher() - scanner = new PathScanner(@getPath(), searchOptions) - - searcher.on 'results-found', (result) -> - iterator(result) - - console.time("search") - search regex, scanner, searcher, -> - console.timeEnd("search") + task = Task.once require.resolve('./scan-handler'), @getPath(), regex.source, searchOptions, -> deferred.resolve() + task.on 'scan:result-found', (result) => + iterator(result) + deferred # Private: diff --git a/src/scan-handler.coffee b/src/scan-handler.coffee new file mode 100644 index 000000000..b284a7911 --- /dev/null +++ b/src/scan-handler.coffee @@ -0,0 +1,15 @@ +{PathSearcher, PathScanner, search} = require 'scandal' + +module.exports = (rootPath, regexSource, options) -> + callback = @async() + + searcher = new PathSearcher() + scanner = new PathScanner(rootPath, rootPath) + + searcher.on 'results-found', (result) -> + emit('scan:result-found', result) + + flags = "g" + flags += "i" if options.ignoreCase + regex = new RegExp(regexSource, flags) + search regex, scanner, searcher, callback From ba80ba458cdac9a506fcd2e9f421c5f8f3648305 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 13:22:25 -0700 Subject: [PATCH 24/57] Remove console.logs --- spec/project-spec.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 63f5463f3..8a4c01daf 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -318,7 +318,6 @@ describe "Project", -> resultHandler = jasmine.createSpy("result found") waitsForPromise -> project.scan /match/, (results) -> - console.log results resultHandler() runs -> @@ -335,7 +334,6 @@ describe "Project", -> waitsForPromise -> project.scan /aaa/, paths: ['a-dir/'], (result) -> paths.push(result.path) - console.log result matches = matches.concat(result.matches) runs -> From 7856a8ce62769f1382a137d9b58a39491303c0fd Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 13:36:00 -0700 Subject: [PATCH 25/57] Make the scan task actually work --- src/scan-handler.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scan-handler.coffee b/src/scan-handler.coffee index b284a7911..735fc2f00 100644 --- a/src/scan-handler.coffee +++ b/src/scan-handler.coffee @@ -4,7 +4,7 @@ module.exports = (rootPath, regexSource, options) -> callback = @async() searcher = new PathSearcher() - scanner = new PathScanner(rootPath, rootPath) + scanner = new PathScanner(rootPath, options) searcher.on 'results-found', (result) -> emit('scan:result-found', result) From f467746cba986d612e4f3bf619c2f843626f7122 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 13:36:52 -0700 Subject: [PATCH 26/57] Project::scan uses core.ignoredNames --- spec/project-spec.coffee | 24 +++++++++++------------- src/project.coffee | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 8a4c01daf..0da5aeeef 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -358,19 +358,17 @@ describe "Project", -> expect(paths[0]).toBe filePath expect(matches.length).toBe 1 - xit "excludes values in core.ignoredNames", -> - # FIXME: this test doesnt make any sense. Why should it ignore the whole project dir? - projectPath = '/tmp/atom-tests/folder-with-dot-git/.git' - filePath = path.join(projectPath, 'test.txt') - fs.writeSync(filePath, 'match this') - project.setPath(projectPath) - paths = [] - matches = [] + it "excludes values in core.ignoredNames", -> + projectPath = path.join(__dirname, 'fixtures', 'git', 'working-dir') + ignoredNames = config.get("core.ignoredNames") + ignoredNames.push("a") + config.set("core.ignoredNames", ignoredNames) + + resultHandler = jasmine.createSpy("result found") waitsForPromise -> - project.scan /match/, (result) -> - paths.push(result.path) - matches.push(result.matchText) + project.scan /dollar/, (results) -> + console.log results + resultHandler() runs -> - expect(paths.length).toBe 0 - expect(matches.length).toBe 0 + expect(resultHandler).not.toHaveBeenCalled() diff --git a/src/project.coffee b/src/project.coffee index a059b2020..7ee3ac00a 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -294,7 +294,7 @@ class Project inclusions: options.paths includeHidden: true excludeVcsIgnores: config.get('core.excludeVcsIgnoredPaths') - # args.unshift('--ignore', ignoredNames.join(',')) if ignoredNames.length > 0 + exclusions: config.get('core.ignoredNames') task = Task.once require.resolve('./scan-handler'), @getPath(), regex.source, searchOptions, -> deferred.resolve() From cb11e2010097167923db0dce631eb6054759d5d5 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 24 Sep 2013 14:20:59 -0700 Subject: [PATCH 27/57] Upgrade to scandal 0.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93a0f4d51..cb2910c09 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "pegjs": "0.7.0", "plist": "git://github.com/nathansobo/node-plist.git", "rimraf": "2.1.4", - "scandal": "0.1.0", + "scandal": "0.2.0", "season": "0.13.0", "semver": "1.1.4", "space-pen": "1.2.0", From 9c4d239696d2b8e0039e8f65029c0b1eb8e36d81 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 24 Sep 2013 16:37:01 -0700 Subject: [PATCH 28/57] Fix Project::scan specs --- spec/project-spec.coffee | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 0da5aeeef..88d39fba2 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -234,34 +234,37 @@ describe "Project", -> describe ".scan(options, callback)", -> describe "when called with a regex", -> - it "calls the callback with all regex matches in all files in the project", -> - matches = [] + it "calls the callback with all regex results in all files in the project", -> + results = [] waitsForPromise -> - project.scan /(a)+/, (match) -> matches.push(match) + project.scan /(a)+/, (result) -> + results.push(result) runs -> - expect(matches).toHaveLength(3) - expect(matches[0].path).toBe project.resolve('a') - expect(matches[0].matches).toHaveLength(3) - expect(matches[0].matches[0]).toEqual + expect(results).toHaveLength(3) + expect(results[0].filePath).toBe project.resolve('a') + expect(results[0].matches).toHaveLength(3) + expect(results[0].matches[0]).toEqual matchText: 'aaa' lineText: 'aaa bbb' + lineTextOffset: 0 range: [[0, 0], [0, 3]] it "works with with escaped literals (like $ and ^)", -> - matches = [] + results = [] waitsForPromise -> - project.scan /\$\w+/, (match) -> matches.push(match) + project.scan /\$\w+/, (result) -> results.push(result) runs -> - expect(matches.length).toBe 1 + expect(results.length).toBe 1 - {path: resultPath, matches} = matches[0] - expect(resultPath).toBe project.resolve('a') + {filePath, matches} = results[0] + expect(filePath).toBe project.resolve('a') expect(matches).toHaveLength 1 expect(matches[0]).toEqual matchText: '$bill' lineText: 'dollar$bill' + lineTextOffset: 0 range: [[2, 6], [2, 11]] it "works on evil filenames", -> @@ -270,7 +273,7 @@ describe "Project", -> matches = [] waitsForPromise -> project.scan /evil/, (result) -> - paths.push(result.path) + paths.push(result.filePath) matches = matches.concat(result.matches) runs -> @@ -333,7 +336,7 @@ describe "Project", -> matches = [] waitsForPromise -> project.scan /aaa/, paths: ['a-dir/'], (result) -> - paths.push(result.path) + paths.push(result.filePath) matches = matches.concat(result.matches) runs -> @@ -350,7 +353,7 @@ describe "Project", -> matches = [] waitsForPromise -> project.scan /match this/, (result) -> - paths.push(result.path) + paths.push(result.filePath) matches = matches.concat(result.matches) runs -> From 00cdb3e31705709017024dae5d92f67d89ede112 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 24 Sep 2013 16:00:23 -0700 Subject: [PATCH 29/57] Add lineText and lineTextOffset to buffer.scan --- spec/text-buffer-spec.coffee | 11 +++++++++++ src/text-buffer.coffee | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/text-buffer-spec.coffee b/spec/text-buffer-spec.coffee index bb715a467..ec6efb63f 100644 --- a/spec/text-buffer-spec.coffee +++ b/spec/text-buffer-spec.coffee @@ -602,6 +602,17 @@ describe 'TextBuffer', -> it "clips the range to the end of the buffer", -> expect(buffer.getTextInRange([[12], [13, Infinity]])).toBe buffer.lineForRow(12) + describe ".scan(regex, fn)", -> + it "retunrns lineText and lineTextOffset", -> + matches = [] + buffer.scan /current/, (match) -> + matches.push(match) + expect(matches.length).toBe 1 + + expect(matches[0].matchText).toEqual 'current' + expect(matches[0].lineText).toEqual ' var pivot = items.shift(), current, left = [], right = [];' + expect(matches[0].lineTextOffset).toBe 0 + describe ".scanInRange(range, regex, fn)", -> describe "when given a regex with a ignore case flag", -> it "does a case-insensitive search", -> diff --git a/src/text-buffer.coffee b/src/text-buffer.coffee index cfad306c0..0b1431061 100644 --- a/src/text-buffer.coffee +++ b/src/text-buffer.coffee @@ -6,6 +6,7 @@ File = require './file' EventEmitter = require './event-emitter' Subscriber = require './subscriber' guid = require 'guid' +{P} = require 'scandal' # Private: Represents the contents of a file. # @@ -501,7 +502,10 @@ class TextBuffer # regex - A {RegExp} representing the text to find # iterator - A {Function} that's called on each match scan: (regex, iterator) -> - @scanInRange(regex, @getRange(), iterator) + @scanInRange regex, @getRange(), (result) => + result.lineText = @lineForRow(result.range.start.row) + result.lineTextOffset = 0 + iterator(result) # Scans for text in a given range, calling a function on each match. # @@ -538,7 +542,8 @@ class TextBuffer range = new Range(startPosition, endPosition) keepLooping = true replacementText = null - iterator({match, range, stop, replace }) + matchText = match[0] + iterator({ match, matchText, range, stop, replace }) if replacementText? @change(range, replacementText) From 238939e738a88783e411db7e5f7315bb641956e3 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 11:01:15 -0700 Subject: [PATCH 30/57] Bubble contents-modified from buffer through editSession --- src/edit-session.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/edit-session.coffee b/src/edit-session.coffee index 7490f7ca3..d2bac5ac0 100644 --- a/src/edit-session.coffee +++ b/src/edit-session.coffee @@ -117,6 +117,7 @@ class EditSession project.setPath(path.dirname(@getPath())) unless project.getPath()? @trigger "title-changed" @trigger "path-changed" + @subscribe @buffer, "contents-modified", => @trigger "contents-modified" @subscribe @buffer, "contents-conflicted", => @trigger "contents-conflicted" @subscribe @buffer, "modified-status-changed", => @trigger "modified-status-changed" @preserveCursorPositionOnBufferReload() From 04f0bf02445d6274fb20c7957f26b085b36d8e45 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 11:02:29 -0700 Subject: [PATCH 31/57] Provide scan() delegation in editSession --- src/edit-session.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/edit-session.coffee b/src/edit-session.coffee index d2bac5ac0..558d926d4 100644 --- a/src/edit-session.coffee +++ b/src/edit-session.coffee @@ -377,6 +377,9 @@ class EditSession # {Delegates to: TextBuffer.lineLengthForRow} lineLengthForBufferRow: (row) -> @buffer.lineLengthForRow(row) + # {Delegates to: TextBuffer.scan} + scan: (args...) -> @buffer.scan(args...) + # {Delegates to: TextBuffer.scanInRange} scanInBufferRange: (args...) -> @buffer.scanInRange(args...) From 76d283c51c52c4aabd4ebba447c8287878470a96 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 12:00:23 -0700 Subject: [PATCH 32/57] Upgrade to collaboration@0.15.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0273a496..d9a569a4a 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "autoflow": "0.2.0", "bookmarks": "0.3.0", "bracket-matcher": "0.4.0", - "collaboration": "0.14.0", + "collaboration": "0.15.0", "command-logger": "0.3.0", "command-palette": "0.3.0", "editor-stats": "0.2.0", From 33a7c86646a82d1202ef3c731b761ad5e24a7d79 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 25 Sep 2013 12:20:44 -0600 Subject: [PATCH 33/57] Upgrade telepath to v0.5.1 This version of telepath provides telepath.Model, document-based property resolution, and relational operators. --- package.json | 2 +- src/atom.coffee | 28 +++++++++++----------------- src/event-emitter.coffee | 5 ++++- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index d9a569a4a..687f2bffd 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "semver": "1.1.4", "space-pen": "1.2.0", "tantamount": "0.3.0", - "telepath": "0.4.0", + "telepath": "0.5.1", "temp": "0.5.0", "underscore": "1.4.4", diff --git a/src/atom.coffee b/src/atom.coffee index a2545d33a..12e9924fe 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -8,7 +8,7 @@ crypto = require 'crypto' path = require 'path' dialog = remote.require 'dialog' app = remote.require 'app' -telepath = require 'telepath' +{Document} = require 'telepath' ThemeManager = require './theme-manager' ContextMenuManager = require './context-menu-manager' @@ -245,34 +245,28 @@ window.atom = if windowStatePath = @getWindowStatePath() if fsUtils.exists(windowStatePath) try - windowStateJson = fsUtils.read(windowStatePath) + documentStateJson = fsUtils.read(windowStatePath) catch error console.warn "Error reading window state: #{windowStatePath}", error.stack, error else - windowStateJson = @getLoadSettings().windowState + documentStateJson = @getLoadSettings().windowState try - windowState = JSON.parse(windowStateJson or '{}') + documentState = JSON.parse(documentStateJson) if documentStateJson? catch error console.warn "Error parsing window state: #{windowStatePath}", error.stack, error - {site, document} = windowState ? {} - if site? and document? - window.site = telepath.Site.deserialize(site) - window.site.deserializeDocument(document) ? window.site.createDocument({}) - else - window.site = new telepath.Site(1) - window.site.createDocument({}) + doc = Document.deserialize(state: documentState) if documentState? + doc ?= Document.create() + window.site = doc.site # TODO: Remove this when everything is using telepath models + doc saveWindowState: -> - windowState = - site: site.serialize() - document: @getWindowState().serialize() - windowStateJson = JSON.stringify(windowState) + windowState = @getWindowState() if windowStatePath = @getWindowStatePath() - fsUtils.writeSync(windowStatePath, "#{windowStateJson}\n") + windowState.saveSync(path: windowStatePath) else - @getLoadSettings().windowState = windowStateJson + @getLoadSettings().windowState = JSON.stringify(windowState.serialize()) getWindowState: (keyPath) -> @windowState ?= @loadWindowState() diff --git a/src/event-emitter.coffee b/src/event-emitter.coffee index 83eb6da95..0b6224707 100644 --- a/src/event-emitter.coffee +++ b/src/event-emitter.coffee @@ -105,8 +105,11 @@ module.exports = # Identifies how many events are registered. # # Returns a {Number}. - subscriptionCount: -> + getSubscriptionCount: -> count = 0 for name, handlers of @eventHandlersByEventName count += handlers.length count + + # Deprecated + subscriptionCount: -> @getSubscriptionCount() From 745af71fa18e507c8e024b5013f77fc3ca71b9c8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 25 Sep 2013 13:27:15 -0600 Subject: [PATCH 34/57] Update collaboration hoping to avoid "address in use" errors in specs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 687f2bffd..1963d6559 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "autoflow": "0.2.0", "bookmarks": "0.3.0", "bracket-matcher": "0.4.0", - "collaboration": "0.15.0", + "collaboration": "0.16.0", "command-logger": "0.3.0", "command-palette": "0.3.0", "editor-stats": "0.2.0", From 935ac5c1a0191914bcf3945c3ba882de2bccbeb7 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 25 Sep 2013 14:03:43 -0600 Subject: [PATCH 35/57] Upgrade to telepath v0.6.0 for Site::deserializeDocument --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1963d6559..10c2f22d2 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "semver": "1.1.4", "space-pen": "1.2.0", "tantamount": "0.3.0", - "telepath": "0.5.1", + "telepath": "0.6.0", "temp": "0.5.0", "underscore": "1.4.4", From 9006ab95fca2a3b41d6f82a583cc022102bc1c6c Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 25 Sep 2013 13:44:50 -0700 Subject: [PATCH 36/57] :lipstick: --- src/root-view.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/root-view.coffee b/src/root-view.coffee index 599e9b94c..a4b2a202f 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -173,8 +173,10 @@ class RootView extends View initialLine = options.initialLine path = project.relativize(path) if activePane = @getActivePane() - editSession = activePane.itemForUri(path) if path - editSession ?= project.open(path, {initialLine}) + if path + editSession = activePane.itemForUri(path) ? project.open(path, {initialLine}) + else + editSession = project.open() activePane.showItem(editSession) else editSession = project.open(path, {initialLine}) From 1e88caac50d1354a468411ea26272622eeaf9d5e Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 25 Sep 2013 13:57:45 -0700 Subject: [PATCH 37/57] Make cut/copy/paste menu items work Previously menu item commands were being triggered on `window` they now are triggered on `document.activeElement`. --- src/window-event-handler.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 332425abc..33b6f2cd5 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -14,7 +14,7 @@ class WindowEventHandler @reloadRequested = false @subscribe ipc, 'command', (command, args...) -> - $(window).trigger(command, args...) + $(document.activeElement).trigger(command, args...) @subscribe ipc, 'context-command', (command, args...) -> $(atom.contextMenu.activeElement).trigger(command, args...) From 865591a3da7e45250234e7bd5b1b3f6dd63c58ca Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 15:03:50 -0700 Subject: [PATCH 38/57] Fix indentation --- spec/project-spec.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 88d39fba2..5b37a9766 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -245,10 +245,10 @@ describe "Project", -> expect(results[0].filePath).toBe project.resolve('a') expect(results[0].matches).toHaveLength(3) expect(results[0].matches[0]).toEqual - matchText: 'aaa' - lineText: 'aaa bbb' - lineTextOffset: 0 - range: [[0, 0], [0, 3]] + matchText: 'aaa' + lineText: 'aaa bbb' + lineTextOffset: 0 + range: [[0, 0], [0, 3]] it "works with with escaped literals (like $ and ^)", -> results = [] From da6aff222b7516583abc6c263698de959a083d52 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 15:09:00 -0700 Subject: [PATCH 39/57] upgrade themes for loading spinners --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cb2910c09..639e983bb 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,9 @@ "temp": "0.5.0", "underscore": "1.4.4", - "atom-light-ui": "0.2.1", + "atom-light-ui": "0.3.0", "atom-light-syntax": "0.2.0", - "atom-dark-ui": "0.2.0", + "atom-dark-ui": "0.3.0", "atom-dark-syntax": "0.2.0", "base16-tomorrow-dark-theme": "0.1.0", "solarized-dark-syntax": "0.1.0", From 824049e17a595cff6dd6e0849212ae6fb20dd49a Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 15:59:10 -0700 Subject: [PATCH 40/57] Add escapeAttribute to underscore-extensions --- src/underscore-extensions.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/underscore-extensions.coffee b/src/underscore-extensions.coffee index 46ab466e4..fdfc0b845 100644 --- a/src/underscore-extensions.coffee +++ b/src/underscore-extensions.coffee @@ -28,6 +28,9 @@ _.mixin escapeRegExp: (string) -> string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + escapeAttribute: (string) -> + string.replace(/"/g, '"').replace(/\n/g, '') + humanizeEventName: (eventName, eventDoc) -> [namespace, event] = eventName.split(':') return _.undasherize(namespace) unless event? From 84efe44a5a4d0126bd1037b1a0fce5a53776fb28 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 11:53:14 -0700 Subject: [PATCH 41/57] Always keep hidden input position in visible area Previously the input could be offscreen depend on the scroll position of the editor and this would cause a scroll event to occur when the input gained focused causing the editor rendering to go out of sync. --- src/editor.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 6f5a505ee..73dd9db41 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -630,6 +630,7 @@ class Editor extends View handleEvents: -> @on 'focus', => + @updateHiddenInputOffset() @hiddenInput.focus() false @@ -693,10 +694,15 @@ class Editor extends View else @gutter.addClass('drop-shadow') + updateHiddenInputOffset: -> + cursorView = @getCursorView() + if cursorView?.is(':visible') + offset = cursorView.offset() + offset.top = Math.min(@height(), offset.top) + @hiddenInput.offset(offset) + handleInputEvents: -> - @on 'cursor:moved', => - cursorView = @getCursorView() - @hiddenInput.offset(cursorView.offset()) if cursorView.is(':visible') + @on 'cursor:moved', => @updateHiddenInputOffset() selectedText = null @hiddenInput.on 'compositionstart', => From 8199147fcac304d7a9380b545416b0a6d71e5830 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 14:41:47 -0700 Subject: [PATCH 42/57] Put input in top corner on blur This allows it to not scroll on the next focus but still be reset to the right location on the next cursor moved event --- src/editor.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 73dd9db41..5076b9853 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -630,7 +630,6 @@ class Editor extends View handleEvents: -> @on 'focus', => - @updateHiddenInputOffset() @hiddenInput.focus() false @@ -638,6 +637,9 @@ class Editor extends View @isFocused = true @addClass 'is-focused' + @hiddenInput.on 'blur', => + @hiddenInput.offset(top: 0, left: 0) + @hiddenInput.on 'focusout', => @isFocused = false @removeClass 'is-focused' @@ -696,10 +698,7 @@ class Editor extends View updateHiddenInputOffset: -> cursorView = @getCursorView() - if cursorView?.is(':visible') - offset = cursorView.offset() - offset.top = Math.min(@height(), offset.top) - @hiddenInput.offset(offset) + @hiddenInput.offset(cursorView.offset()) if cursorView?.is(':visible') handleInputEvents: -> @on 'cursor:moved', => @updateHiddenInputOffset() From bc3aec584bfe764e3f45063d7b36fe0b1d0207da Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 14:42:36 -0700 Subject: [PATCH 43/57] Inline hidden input offset updating --- src/editor.coffee | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 5076b9853..2614d10af 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -696,12 +696,10 @@ class Editor extends View else @gutter.addClass('drop-shadow') - updateHiddenInputOffset: -> - cursorView = @getCursorView() - @hiddenInput.offset(cursorView.offset()) if cursorView?.is(':visible') - handleInputEvents: -> - @on 'cursor:moved', => @updateHiddenInputOffset() + @on 'cursor:moved', => + cursorView = @getCursorView() + @hiddenInput.offset(cursorView.offset()) if cursorView.is(':visible') selectedText = null @hiddenInput.on 'compositionstart', => From 6581eb4db6e73252004e1e7b62fedeeb67a28396 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 16:14:13 -0700 Subject: [PATCH 44/57] Update offset in existing focusout handler --- src/editor.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/editor.coffee b/src/editor.coffee index 2614d10af..028655cfd 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -637,12 +637,10 @@ class Editor extends View @isFocused = true @addClass 'is-focused' - @hiddenInput.on 'blur', => - @hiddenInput.offset(top: 0, left: 0) - @hiddenInput.on 'focusout', => @isFocused = false @removeClass 'is-focused' + @hiddenInput.offset(top: 0, left: 0) @underlayer.on 'mousedown', (e) => @renderedLines.trigger(e) From 93940c03ef2eafdac40a7ba4e253cb71b8dacfb5 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 25 Sep 2013 16:16:45 -0700 Subject: [PATCH 45/57] :lipstick: --- src/atom-window.coffee | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/atom-window.coffee b/src/atom-window.coffee index 3da832046..5da1d3b2e 100644 --- a/src/atom-window.coffee +++ b/src/atom-window.coffee @@ -42,10 +42,7 @@ class AtomWindow @openPath(pathToOpen, initialLine) setupNodePath: (resourcePath) -> - paths = [ - 'exports' - 'node_modules' - ] + paths = ['exports', 'node_modules'] paths = paths.map (relativePath) -> path.resolve(resourcePath, relativePath) process.env['NODE_PATH'] = paths.join path.delimiter From 2a2750862acc23e845784db22b313dcbd76394fb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 16:24:51 -0700 Subject: [PATCH 46/57] Add failing spec --- spec/editor-spec.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 797f63d62..3890f1448 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -63,6 +63,15 @@ describe "Editor", -> expect(editor).not.toMatchSelector ':focus' expect(editor.hiddenInput).toMatchSelector ':focus' + it "does not scroll the editor (regression)", -> + editor.attachToDom(heightInLines: 2) + editor.selectAll() + editor.hiddenInput.blur() + editor.focus() + + expect(editor.hiddenInput).toMatchSelector ':focus' + expect($(editor[0]).scrollTop()).toBe 0 + describe "when the hidden input is focused / unfocused", -> it "assigns the isFocused flag on the editor and also adds/removes the .focused css class", -> editor.attachToDom() From 123c44c4b29db4d24077500628dc31d6e28dd22f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 25 Sep 2013 16:27:28 -0700 Subject: [PATCH 47/57] Make the --dev flag work when opening a another atom window from the command line --- src/atom-application.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/atom-application.coffee b/src/atom-application.coffee index 9603c36f4..690c21332 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -93,8 +93,8 @@ class AtomApplication fs.unlinkSync socketPath if fs.existsSync(socketPath) server = net.createServer (connection) => connection.on 'data', (data) => - {pathsToOpen, pidToKillWhenClosed, newWindow} = JSON.parse(data) - @openPaths({pathsToOpen, pidToKillWhenClosed, newWindow}) + options = JSON.parse(data) + @openPaths(options) server.listen socketPath server.on 'error', (error) -> console.error 'Application server failed', error From b3fd4733047369daa5cca3f493dc73667689f3a0 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 16:30:36 -0700 Subject: [PATCH 48/57] UPgrade to FNR v0.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 639e983bb..311f8e76f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.11.0", + "find-and-replace": "0.12.0", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From 614ca3cb5f534f0a735806782bc1542a001b05a3 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 16:40:55 -0700 Subject: [PATCH 49/57] Update to FNR v0.13.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 311f8e76f..49a366d60 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.12.0", + "find-and-replace": "0.13.0", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From 18c4d54612c4cc32c73c7a7344a9a879d9413b0e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 17:06:49 -0700 Subject: [PATCH 50/57] Upgrade to find-and-replace@0.14.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2249e8048..6b2c6d1a4 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.13.0", + "find-and-replace": "0.14.0", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From 153e400137ea83002b2c3234dc9e5f9602a35297 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 17:10:01 -0700 Subject: [PATCH 51/57] Add -9 flag to pkill command When I ssh'ed into one of the CI boxes it had over 500 Atom processes still hanging around. --- Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index b8d215040..f0acb96b8 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -151,7 +151,7 @@ module.exports = (grunt) -> shell: 'kill-atom': - command: 'pkill Atom' + command: 'pkill -9 Atom' options: stdout: false stderr: false From 512f45c61e22ff60a64c565dece85248531446c9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 17:11:11 -0700 Subject: [PATCH 52/57] Upgrade to find-and-replace@0.14.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b2c6d1a4..488101c53 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.14.0", + "find-and-replace": "0.14.1", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From 5cecd533ef9f46df0657bcb9b813ada1608a16c3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 17:35:52 -0700 Subject: [PATCH 53/57] Add back durations to spec reporter --- spec/atom-reporter.coffee | 2 +- spec/time-reporter.coffee | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 7c2203c51..099a78f1f 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -92,7 +92,7 @@ class AtomReporter extends View clearTimeout @timeoutId if @timeoutId? @specPopup.show() - spec = _.find(window.timedSpecs, (spec) -> description is spec.name) + spec = _.find(window.timedSpecs, ({fullName}) -> description is fullName) description = "#{description} #{spec.time}ms" if spec @specPopup.text description {left, top} = element.offset() diff --git a/spec/time-reporter.coffee b/spec/time-reporter.coffee index 49ef984c0..f5555f392 100644 --- a/spec/time-reporter.coffee +++ b/spec/time-reporter.coffee @@ -53,6 +53,7 @@ class TimeReporter extends jasmine.Reporter window.timedSpecs.push description: @description time: duration + fullName: spec.getFullName() if timedSuites[@suite] window.timedSuites[@suite] += duration From 025cee96c2f4f83e3c352dae37216da376921241 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Sep 2013 17:50:47 -0700 Subject: [PATCH 54/57] Update find and replace + themes to have coloring for the find matches --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 488101c53..cd598f5a4 100644 --- a/package.json +++ b/package.json @@ -39,11 +39,11 @@ "underscore": "1.4.4", "atom-light-ui": "0.3.0", - "atom-light-syntax": "0.2.0", + "atom-light-syntax": "0.3.0", "atom-dark-ui": "0.3.0", - "atom-dark-syntax": "0.2.0", + "atom-dark-syntax": "0.3.0", "base16-tomorrow-dark-theme": "0.1.0", - "solarized-dark-syntax": "0.1.0", + "solarized-dark-syntax": "0.2.0", "archive-view": "0.7.0", "autocomplete": "0.5.0", @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.14.1", + "find-and-replace": "0.15.0", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From c938c1c064302942244301276dc5e65eddd509df Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 18:43:00 -0700 Subject: [PATCH 55/57] Only schedule atom.setFullScreen() when set in state --- src/root-view.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/root-view.coffee b/src/root-view.coffee index a4b2a202f..28fd64b6b 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -126,7 +126,8 @@ class RootView extends View @command 'pane:reopen-closed-item', => @panes.reopenItem() - _.nextTick => atom.setFullScreen(@state.get('fullScreen')) + if @state.get('fullScreen') + _.nextTick => atom.setFullScreen(true) # Private: serialize: -> From fbb778b96cb9abc6a00bb7192640b7d61e5a080e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Sep 2013 18:56:02 -0700 Subject: [PATCH 56/57] Upgrade to find-and-replace@0.16.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd598f5a4..2d2f5e210 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "command-palette": "0.3.0", "editor-stats": "0.2.0", "exception-reporting": "0.1.0", - "find-and-replace": "0.15.0", + "find-and-replace": "0.16.0", "fuzzy-finder": "0.5.0", "gfm": "0.4.0", "git-diff": "0.3.0", From 554b85153c5b8e89311647995a437a9e626d7d0c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 26 Sep 2013 11:50:48 +0800 Subject: [PATCH 57/57] Update to atom-shell v0.5.1. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d2f5e210..b1c29e43f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "bugs": { "url": "https://github.com/atom/atom/issues" }, - "atomShellVersion": "0.5.0", + "atomShellVersion": "0.5.1", "dependencies": { "async": "0.2.6", "bootstrap": "git://github.com/twbs/bootstrap.git#v3.0.0",