From fec8ea42729278e66f1b212bce38f5a7848275d0 Mon Sep 17 00:00:00 2001 From: vegar Date: Tue, 17 Mar 2015 20:09:37 +0100 Subject: [PATCH 01/32] Documentation: workspace.open( ) with no URI I just learned that [calling open on workspace](https://discuss.atom.io/t/how-can-we-help-you-write-packages/4268/67) without specifying an uri is the way to go for getting a new tab with a new document. I can't find anything about this in either the docs or the [api documentation.](https://atom.io/docs/api/v0.187.0/Workspace#instance-open) Should `uri` be marked optional, like the `options` params? And should it be added a line stating that no uri opens a blank editor? (and there's an extra `a` in the title..) --- src/workspace.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 49f84f9b8..c8040f920 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,9 +371,11 @@ class Workspace extends Model Section: Opening ### - # Essential: Open a given a URI in Atom asynchronously. - # - # * `uri` A {String} containing a URI. + # Essential: Open a given URI in Atom asynchronously. + # If no URI is given, or URI does not resolve to an existing file, + # a new empty text edtior is created. + # + # * `uri` (optional) A {String} containing a URI. # * `options` (optional) {Object} # * `initialLine` A {Number} indicating which row to move the cursor to # initially. Defaults to `0`. From 4cf34cc1fa96d6ad57edffdd16e8d65cbc830783 Mon Sep 17 00:00:00 2001 From: Vegar Vikan Date: Wed, 1 Apr 2015 00:21:59 +0200 Subject: [PATCH 02/32] Documentation: workspace.open( ) refrasing --- src/workspace.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index c8040f920..6c60cf22a 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,8 +371,8 @@ class Workspace extends Model Section: Opening ### - # Essential: Open a given URI in Atom asynchronously. - # If no URI is given, or URI does not resolve to an existing file, + # Essential: Opens the given URI in Atom asynchronously, if it's not already open. + # If no URI is given, or the URI is the path of a file that does not exist, # a new empty text edtior is created. # # * `uri` (optional) A {String} containing a URI. From 639fde343cc81a4986246f71d2fa14eb355601bd Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Wed, 11 Feb 2015 10:47:36 -0500 Subject: [PATCH 03/32] Export File and Directory through require('atom') Conflicts: exports/atom.coffee --- exports/atom.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exports/atom.coffee b/exports/atom.coffee index 5afa04022..dab0b007f 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -1,5 +1,6 @@ TextBuffer = require 'text-buffer' {Point, Range} = TextBuffer +{File, Directory} = require 'pathwatcher' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' {deprecate} = require 'grim' @@ -11,6 +12,8 @@ module.exports = TextBuffer: TextBuffer Point: Point Range: Range + File: File + Directory: Directory Emitter: Emitter Disposable: Disposable CompositeDisposable: CompositeDisposable From 9b8d7d46fe8e72f7fe6e31b419de7407f50f6ca2 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 2 Apr 2015 23:03:29 -0400 Subject: [PATCH 04/32] Lint for more styleguide errors - Add more coffeelint rules to cover code style requirements from CONTRIBUTING.md --- coffeelint.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/coffeelint.json b/coffeelint.json index d8e19fc46..f3caf09cc 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -13,5 +13,19 @@ }, "no_debugger": { "level": "error" + }, + "prefer_english_operator": { + "level": "error" + }, + "colon_assignment_spacing": { + "spacing": { + "left": 0, + "right": 1 + }, + "level": "error" + }, + "braces_spacing": { + "spaces": 0, + "level": "error" } } From 5d2392ea674e9ccefe567e35ef625314a81a91f7 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 6 Apr 2015 23:45:02 -0400 Subject: [PATCH 05/32] :shirt: Fix new coffeelint errors --- benchmark/benchmark-helper.coffee | 6 ++-- benchmark/benchmark-suite.coffee | 4 +-- benchmark/fixtures/medium.coffee | 14 ++++----- .../translate-crash-log-addresses.coffee | 9 +++--- spec/config-spec.coffee | 6 ++-- spec/fixtures/coffee.coffee | 3 +- .../package-with-config-defaults/index.coffee | 2 +- ...ample-with-tabs-and-leading-comment.coffee | 6 ++-- spec/fixtures/sample-with-tabs.coffee | 2 ++ spec/package-manager-spec.coffee | 24 +++++++-------- spec/pane-container-view-spec.coffee | 2 +- spec/pane-view-spec.coffee | 6 ++-- spec/spec-helper.coffee | 10 +++---- spec/text-editor-spec.coffee | 2 +- spec/theme-manager-spec.coffee | 10 +++---- spec/tokenized-buffer-spec.coffee | 6 ++-- spec/workspace-spec.coffee | 14 ++++----- src/atom.coffee | 2 +- src/browser/application-menu.coffee | 20 ++++++------- src/browser/atom-application.coffee | 2 +- src/command-installer.coffee | 8 ++--- src/config.coffee | 2 +- src/cursor.coffee | 22 +++++++------- src/decoration.coffee | 2 +- src/default-directory-provider.coffee | 2 +- src/display-buffer.coffee | 10 +++---- src/language-mode.coffee | 8 ++--- src/menu-manager.coffee | 2 +- src/notification.coffee | 6 ++-- src/overlay-manager.coffee | 2 +- src/pane-axis-element.coffee | 2 +- src/project.coffee | 2 +- src/scan-handler.coffee | 2 +- src/selection.coffee | 12 ++++---- src/text-editor-component.coffee | 2 +- src/text-editor.coffee | 6 ++-- src/token.coffee | 2 +- src/tokenized-buffer.coffee | 30 +++++++++---------- src/tokenized-line.coffee | 14 ++++----- src/window-event-handler.coffee | 2 +- src/workspace.coffee | 8 ++--- 41 files changed, 150 insertions(+), 146 deletions(-) diff --git a/benchmark/benchmark-helper.coffee b/benchmark/benchmark-helper.coffee index ae6bab740..d831572c5 100644 --- a/benchmark/benchmark-helper.coffee +++ b/benchmark/benchmark-helper.coffee @@ -29,7 +29,7 @@ window.benchmark = (args...) -> else count = defaultCount [fn, options] = args - { profile, focused } = (options ? {}) + {profile, focused} = (options ? {}) method = if focused then fit else it method description, -> @@ -69,7 +69,7 @@ window.keyIdentifierForKey = (key) -> "U+00" + charCode.toString(16) window.keydownEvent = (key, properties={}) -> - $.Event "keydown", _.extend({originalEvent: { keyIdentifier: keyIdentifierForKey(key) }}, properties) + $.Event "keydown", _.extend({originalEvent: {keyIdentifier: keyIdentifierForKey(key)}}, properties) window.clickEvent = (properties={}) -> $.Event "click", properties @@ -93,7 +93,7 @@ window.pagePixelPositionForPoint = (editorView, point) -> point = Point.fromObject point top = editorView.lines.offset().top + point.row * editorView.lineHeight left = editorView.lines.offset().left + point.column * editorView.charWidth - editorView.lines.scrollLeft() - { top, left } + {top, left} window.seteditorViewWidthInChars = (editorView, widthInChars, charWidth=editorView.charWidth) -> editorView.width(charWidth * widthInChars + editorView.lines.position().left) diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index 7a17f22c2..7b06d9758 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -213,7 +213,7 @@ describe "TokenizedBuffer.", -> beforeEach -> editor = benchmarkFixturesProject.openSync('medium.coffee') - { languageMode, buffer } = editor + {languageMode, buffer} = editor benchmark "construction", 20, -> - new TokenizedBuffer(buffer, { languageMode, tabLength: 2}) + new TokenizedBuffer(buffer, {languageMode, tabLength: 2}) diff --git a/benchmark/fixtures/medium.coffee b/benchmark/fixtures/medium.coffee index 2bdb8c6f7..28ec156b0 100644 --- a/benchmark/fixtures/medium.coffee +++ b/benchmark/fixtures/medium.coffee @@ -209,13 +209,13 @@ template = (str) -> 'var p=[],print=function(){p.push.apply(p,arguments);};' + 'with(obj){p.push(\'' + str.replace(/[\r\t\n]/g, " ") - .replace(/'(?=[^<]*%>)/g,"\t") - .split("'").join("\\'") - .split("\t").join("'") - .replace(/<%=(.+?)%>/g, "',$1,'") - .split('<%').join("');") - .split('%>').join("p.push('") + - "');}return p.join('');" + .replace(/'(?=[^<]*%>)/g,"\t") + .split("'").join("\\'") + .split("\t").join("'") + .replace(/<%=(.+?)%>/g, "',$1,'") + .split('<%').join("');") + .split('%>').join("p.push('") + + "');}return p.join('');" # Create the template that we will use to generate the Docco HTML page. docco_template = template fs.readFileSync(__dirname + '/../resources/docco.jst').toString() diff --git a/script/utils/translate-crash-log-addresses.coffee b/script/utils/translate-crash-log-addresses.coffee index 7fb01532b..fdb540d64 100755 --- a/script/utils/translate-crash-log-addresses.coffee +++ b/script/utils/translate-crash-log-addresses.coffee @@ -17,7 +17,7 @@ parse_stack_trace = (raw) -> addresses = [] for line in raw columns = line.split /\ +/ - if columns[1] == 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3] + if columns[1] is 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3] lines[columns[0]] = addresses.length addresses.push '0x' + parseInt(columns[5]).toString(16) + ' ' @@ -36,12 +36,12 @@ parse_log_file = (content) -> lines = content.split /\r?\n/ for line in lines - if state == 'start' + if state is 'start' if /Thread \d+ Crashed::/.test line console.log line state = 'parse' - else if state == 'parse' - break if line == '' + else if state is 'parse' + break if line is '' stack_trace.push line parse_stack_trace stack_trace @@ -53,4 +53,3 @@ process.stdin.on 'data', (chunk) -> input += chunk process.stdin.on 'end', -> parse_log_file input - diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 4abd3b0db..a7e1c6f39 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -251,9 +251,9 @@ describe "Config", -> it "removes all scoped and unscoped properties for that key-path", -> atom.config.setDefaults("foo.bar", baz: 100) - atom.config.set("foo.bar", { baz: 1, ok: 2 }, scopeSelector: ".a") - atom.config.set("foo.bar", { baz: 11, ok: 12 }, scopeSelector: ".b") - atom.config.set("foo.bar", { baz: 21, ok: 22 }) + atom.config.set("foo.bar", {baz: 1, ok: 2}, scopeSelector: ".a") + atom.config.set("foo.bar", {baz: 11, ok: 12}, scopeSelector: ".b") + atom.config.set("foo.bar", {baz: 21, ok: 22}) atom.config.unset("foo.bar.baz") diff --git a/spec/fixtures/coffee.coffee b/spec/fixtures/coffee.coffee index b8367ca59..d68b84267 100644 --- a/spec/fixtures/coffee.coffee +++ b/spec/fixtures/coffee.coffee @@ -1,4 +1,4 @@ -class quicksort +class Quicksort sort: (items) -> return items if items.length <= 1 @@ -13,6 +13,7 @@ class quicksort if current < pivot left.push(current) else + # coffeelint: disable=no_trailing_semicolons right.push(current); sort(left).concat(pivot).concat(sort(right)) diff --git a/spec/fixtures/packages/package-with-config-defaults/index.coffee b/spec/fixtures/packages/package-with-config-defaults/index.coffee index 554c6c5eb..6c48b2af4 100644 --- a/spec/fixtures/packages/package-with-config-defaults/index.coffee +++ b/spec/fixtures/packages/package-with-config-defaults/index.coffee @@ -1,5 +1,5 @@ module.exports = configDefaults: - numbers: { one: 1, two: 2 } + numbers: {one: 1, two: 2} activate: -> # no-op diff --git a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee index 0f81f6fe8..08e81aa68 100644 --- a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee +++ b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee @@ -1,4 +1,6 @@ # This is a comment + # coffeelint: disable=no_tabs + # coffeelint: disable=indentation if this.studyingEconomics - buy() while supply > demand - sell() until supply > demand + buy() while supply > demand + sell() until supply > demand diff --git a/spec/fixtures/sample-with-tabs.coffee b/spec/fixtures/sample-with-tabs.coffee index 1b937ea33..5e7595a7d 100644 --- a/spec/fixtures/sample-with-tabs.coffee +++ b/spec/fixtures/sample-with-tabs.coffee @@ -1,3 +1,5 @@ +# coffeelint: disable=no_tabs +# coffeelint: disable=no_trailing_whitespace # Econ 101 if this.studyingEconomics buy() while supply > demand diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 2789f36c3..db2a76135 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -330,32 +330,32 @@ describe "PackageManager", -> element2 = $$ -> @div class: 'test-2' element3 = $$ -> @div class: 'test-3' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0 waitsForPromise -> atom.packages.activatePackage("package-with-keymaps") runs -> - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1" - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2" - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe "test-1" + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])[0].command).toBe "test-2" + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0 describe "when the metadata contains a 'keymaps' manifest", -> it "loads only the keymaps specified by the manifest, in the specified order", -> element1 = $$ -> @div class: 'test-1' element3 = $$ -> @div class: 'test-3' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0 waitsForPromise -> atom.packages.activatePackage("package-with-keymaps-manifest") runs -> - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe 'keymap-1' + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-n', target: element1[0])[0].command).toBe 'keymap-2' + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-y', target: element3[0])).toHaveLength 0 describe "when the keymap file is empty", -> it "does not throw an error on activation", -> @@ -645,8 +645,8 @@ describe "PackageManager", -> runs -> atom.packages.deactivatePackage('package-with-keymaps') - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0 it "removes the package's stylesheets", -> waitsForPromise -> diff --git a/spec/pane-container-view-spec.coffee b/spec/pane-container-view-spec.coffee index 6c088c343..1b9cf9813 100644 --- a/spec/pane-container-view-spec.coffee +++ b/spec/pane-container-view-spec.coffee @@ -15,7 +15,7 @@ describe "PaneContainerView", -> @deserialize: ({name}) -> new TestView(name) @content: -> @div tabindex: -1 initialize: (@name) -> @text(@name) - serialize: -> { deserializer: 'TestView', @name } + serialize: -> {deserializer: 'TestView', @name} getURI: -> path.join(temp.dir, @name) save: -> @saved = true isEqual: (other) -> @name is other?.name diff --git a/spec/pane-view-spec.coffee b/spec/pane-view-spec.coffee index 763cc9ab4..2df5aa68c 100644 --- a/spec/pane-view-spec.coffee +++ b/spec/pane-view-spec.coffee @@ -14,9 +14,9 @@ describe "PaneView", -> @content: ({id, text}) -> @div class: 'test-view', id: id, tabindex: -1, text initialize: ({@id, @text}) -> @emitter = new Emitter - serialize: -> { deserializer: 'TestView', @id, @text } + serialize: -> {deserializer: 'TestView', @id, @text} getURI: -> @id - isEqual: (other) -> other? and @id == other.id and @text == other.text + isEqual: (other) -> other? and @id is other.id and @text is other.text changeTitle: -> @emitter.emit 'did-change-title', 'title' onDidChangeTitle: (callback) -> @@ -222,7 +222,7 @@ describe "PaneView", -> fs.removeSync(filePath) waitsFor -> - pane.items.length == 4 + pane.items.length is 4 describe "when a pane is destroyed", -> [pane2, pane2Model] = [] diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 70fb4fb58..1c9e6fb6b 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -69,7 +69,7 @@ if specDirectory specPackageName = JSON.parse(fs.readFileSync(path.join(specPackagePath, 'package.json')))?.name specProjectPath = path.join(specDirectory, 'fixtures') -isCoreSpec = specDirectory == fs.realpathSync(__dirname) +isCoreSpec = specDirectory is fs.realpathSync(__dirname) beforeEach -> $.fx.off = true @@ -234,7 +234,7 @@ addCustomMatchers = (spec) -> else notText = if @isNot then " not" else "" this.message = => "Expected object with length #{@actual.length} to#{notText} have length #{expected}" - @actual.length == expected + @actual.length is expected toExistOnDisk: (expected) -> notText = this.isNot and " not" or "" @@ -297,7 +297,7 @@ window.mousemoveEvent = (properties={}) -> window.waitsForPromise = (args...) -> if args.length > 1 - { shouldReject, timeout } = args[0] + {shouldReject, timeout} = args[0] else shouldReject = false fn = _.last(args) @@ -328,7 +328,7 @@ window.fakeSetTimeout = (callback, ms) -> id window.fakeClearTimeout = (idToClear) -> - window.timeouts = window.timeouts.filter ([id]) -> id != idToClear + window.timeouts = window.timeouts.filter ([id]) -> id isnt idToClear window.fakeSetInterval = (callback, ms) -> id = ++window.intervalCount @@ -358,7 +358,7 @@ window.pagePixelPositionForPoint = (editorView, point) -> point = Point.fromObject point top = editorView.renderedLines.offset().top + point.row * editorView.lineHeight left = editorView.renderedLines.offset().left + point.column * editorView.charWidth - editorView.renderedLines.scrollLeft() - { top, left } + {top, left} window.tokensText = (tokens) -> _.pluck(tokens, 'value').join('') diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 439a1ddb6..ecb176ad5 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -547,7 +547,7 @@ describe "TextEditor", -> lastLine = buffer.lineForRow(lastLineIndex) expect(lastLine.length).toBeGreaterThan(0) - lastPosition = { row: lastLineIndex, column: lastLine.length } + lastPosition = {row: lastLineIndex, column: lastLine.length} editor.setCursorScreenPosition(lastPosition) editor.moveRight() diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee index 5e65da1fa..c39e4994b 100644 --- a/spec/theme-manager-spec.coffee +++ b/spec/theme-manager-spec.coffee @@ -84,7 +84,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', []) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -92,7 +92,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -101,7 +101,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -111,7 +111,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', []) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -120,7 +120,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> expect($('style[priority=1]')).toHaveLength 2 diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index c1b16ff08..3cd776c2b 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -352,7 +352,7 @@ describe "TokenizedBuffer", -> tabAsSpaces = _.multiplyString(' ', tokenizedBuffer.getTabLength()) screenLine0 = tokenizedBuffer.tokenizedLineForRow(0) expect(screenLine0.text).toBe "# Econ 101#{tabAsSpaces}" - { tokens } = screenLine0 + {tokens} = screenLine0 expect(tokens.length).toBe 4 expect(tokens[0].value).toBe "#" @@ -452,7 +452,7 @@ describe "TokenizedBuffer", -> it "renders each UTF-8 surrogate pair as its own atomic token", -> screenLine0 = tokenizedBuffer.tokenizedLineForRow(0) expect(screenLine0.text).toBe "'abc\uD835\uDF97def'" - { tokens } = screenLine0 + {tokens} = screenLine0 expect(tokens.length).toBe 5 expect(tokens[0].value).toBe "'" @@ -464,7 +464,7 @@ describe "TokenizedBuffer", -> screenLine1 = tokenizedBuffer.tokenizedLineForRow(1) expect(screenLine1.text).toBe "//\uD835\uDF97xyz" - { tokens } = screenLine1 + {tokens} = screenLine1 expect(tokens.length).toBe 4 expect(tokens[0].value).toBe '//' diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e40ef1925..dac2849c0 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -189,7 +189,7 @@ describe "Workspace", -> workspace.open('a', split: 'right').then (o) -> editor = o runs -> - pane2 = workspace.getPanes().filter((p) -> p != pane1)[0] + pane2 = workspace.getPanes().filter((p) -> p isnt pane1)[0] expect(workspace.getActivePane()).toBe pane2 expect(pane1.items).toEqual [] expect(pane2.items).toEqual [editor] @@ -218,7 +218,7 @@ describe "Workspace", -> workspace.open('a', split: 'right').then (o) -> editor = o runs -> - pane4 = workspace.getPanes().filter((p) -> p != pane1)[0] + pane4 = workspace.getPanes().filter((p) -> p isnt pane1)[0] expect(workspace.getActivePane()).toBe pane4 expect(pane4.items).toEqual [editor] expect(workspace.paneContainer.root.children[0]).toBe pane1 @@ -226,19 +226,19 @@ describe "Workspace", -> describe "when passed a path that matches a custom opener", -> it "returns the resource returned by the custom opener", -> - fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/) - barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//) + fooOpener = (pathToOpen, options) -> {foo: pathToOpen, options} if pathToOpen?.match(/\.foo/) + barOpener = (pathToOpen) -> {bar: pathToOpen} if pathToOpen?.match(/^bar:\/\//) workspace.addOpener(fooOpener) workspace.addOpener(barOpener) waitsForPromise -> pathToOpen = atom.project.getDirectories()[0]?.resolve('a.foo') workspace.open(pathToOpen, hey: "there").then (item) -> - expect(item).toEqual { foo: pathToOpen, options: {hey: "there"} } + expect(item).toEqual {foo: pathToOpen, options: {hey: "there"}} waitsForPromise -> workspace.open("bar://baz").then (item) -> - expect(item).toEqual { bar: "bar://baz" } + expect(item).toEqual {bar: "bar://baz"} it "notifies ::onDidAddTextEditor observers", -> absolutePath = require.resolve('./fixtures/dir/a') @@ -835,7 +835,7 @@ describe "Workspace", -> runs -> expect(results).toHaveLength 3 - resultForA = _.find results, ({filePath}) -> path.basename(filePath) == 'a' + resultForA = _.find results, ({filePath}) -> path.basename(filePath) is 'a' expect(resultForA.matches).toHaveLength 1 expect(resultForA.matches[0].matchText).toBe 'Elephant' diff --git a/src/atom.coffee b/src/atom.coffee index 701f2e91e..88c8257e1 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -499,7 +499,7 @@ class Atom extends Model # Extended: Toggle the full screen state of the current window. toggleFullScreen: -> - @setFullScreen(!@isFullScreen()) + @setFullScreen(not @isFullScreen()) # Schedule the window to be shown and focused on the next tick. # diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index 4544a963d..d88314c89 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -87,15 +87,15 @@ class ApplicationMenu # Replaces VERSION with the current version. substituteVersion: (template) -> - if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label == 'VERSION')) + if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label is 'VERSION')) item.label = "Version #{@version}" # Sets the proper visible state the update menu items showUpdateMenuItem: (state) -> - checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Check for Update') - checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Checking for Update') - downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Downloading Update') - installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Restart and Install Update') + checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Check for Update') + checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Checking for Update') + downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Downloading Update') + installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Restart and Install Update') return unless checkForUpdateItem? and checkingForUpdateItem? and downloadingUpdateItem? and installUpdateItem? @@ -121,11 +121,11 @@ class ApplicationMenu [ label: "Atom" submenu: [ - { label: "Check for Update", metadata: {autoUpdate: true}} - { label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload() } - { label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close() } - { label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools() } - { label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() } + {label: "Check for Update", metadata: {autoUpdate: true}} + {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()} + {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()} + {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()} + {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()} ] ] diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 45c0c8b5c..609d26d9f 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -95,7 +95,7 @@ class AtomApplication # Public: Removes the {AtomWindow} from the global window list. removeWindow: (window) -> @windows.splice @windows.indexOf(window), 1 - @applicationMenu?.enableWindowSpecificItems(false) if @windows.length == 0 + @applicationMenu?.enableWindowSpecificItems(false) if @windows.length is 0 # Public: Adds the {AtomWindow} to the global window list. addWindow: (window) -> diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 1d3a16777..c0ed22482 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -6,7 +6,7 @@ runas = null # defer until used symlinkCommand = (sourcePath, destinationPath, callback) -> fs.unlink destinationPath, (error) -> - if error? and error?.code != 'ENOENT' + if error? and error?.code isnt 'ENOENT' callback(error) else fs.makeTree path.dirname(destinationPath), (error) -> @@ -17,13 +17,13 @@ symlinkCommand = (sourcePath, destinationPath, callback) -> symlinkCommandWithPrivilegeSync = (sourcePath, destinationPath) -> runas ?= require 'runas' - if runas('/bin/rm', ['-f', destinationPath], admin: true) != 0 + if runas('/bin/rm', ['-f', destinationPath], admin: true) isnt 0 throw new Error("Failed to remove '#{destinationPath}'") - if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) != 0 + if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) isnt 0 throw new Error("Failed to create directory '#{destinationPath}'") - if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) != 0 + if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) isnt 0 throw new Error("Failed to symlink '#{sourcePath}' to '#{destinationPath}'") module.exports = diff --git a/src/config.coffee b/src/config.coffee index f7db867ed..50d8caba3 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1128,7 +1128,7 @@ splitKeyPath = (keyPath) -> startIndex = 0 keyPathArray = [] for char, i in keyPath - if char is '.' and (i is 0 or keyPath[i-1] != '\\') + if char is '.' and (i is 0 or keyPath[i-1] isnt '\\') keyPathArray.push keyPath.substring(startIndex, i) startIndex = i + 1 keyPathArray.push keyPath.substr(startIndex, keyPath.length) diff --git a/src/cursor.coffee b/src/cursor.coffee index 3ed9939ad..b54cc6bcd 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -156,7 +156,7 @@ class Cursor extends Model # Public: Returns whether the cursor is at the start of a line. isAtBeginningOfLine: -> - @getBufferPosition().column == 0 + @getBufferPosition().column is 0 # Public: Returns whether the cursor is on the line return character. isAtEndOfLine: -> @@ -210,7 +210,7 @@ class Cursor extends Model isInsideWord: (options) -> {row, column} = @getBufferPosition() range = [[row, column], [row, Infinity]] - @editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) == 0 + @editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) is 0 # Public: Returns the indentation level of the current line. getIndentLevel: -> @@ -243,7 +243,7 @@ class Cursor extends Model # # Returns a {Boolean}. isLastCursor: -> - this == @editor.getLastCursor() + this is @editor.getLastCursor() ### Section: Moving the Cursor @@ -258,9 +258,9 @@ class Cursor extends Model moveUp: (rowCount=1, {moveToEndOfSelection}={}) -> range = @marker.getScreenRange() if moveToEndOfSelection and not range.isEmpty() - { row, column } = range.start + {row, column} = range.start else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() column = @goalColumn if @goalColumn? @setScreenPosition({row: row - rowCount, column: column}, skipSoftWrapIndentation: true) @@ -275,9 +275,9 @@ class Cursor extends Model moveDown: (rowCount=1, {moveToEndOfSelection}={}) -> range = @marker.getScreenRange() if moveToEndOfSelection and not range.isEmpty() - { row, column } = range.end + {row, column} = range.end else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() column = @goalColumn if @goalColumn? @setScreenPosition({row: row + rowCount, column: column}, skipSoftWrapIndentation: true) @@ -315,7 +315,7 @@ class Cursor extends Model if moveToEndOfSelection and not range.isEmpty() @setScreenPosition(range.end) else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() maxLines = @editor.getScreenLineCount() rowLength = @editor.lineTextForScreenRow(row).length columnsRemainingInLine = rowLength - column @@ -586,7 +586,7 @@ class Cursor extends Model # Public: Sets whether the cursor is visible. setVisible: (visible) -> - if @visible != visible + if @visible isnt visible @visible = visible @emit 'visibility-changed', @visible if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-visibility', @visible @@ -664,7 +664,7 @@ class Cursor extends Model position = new Point(row, column - 1) @editor.scanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - if !range.start.isEqual(start) + unless range.start.isEqual(start) position = range.start stop() position @@ -677,7 +677,7 @@ class Cursor extends Model position = new Point(0, 0) zero = new Point(0,0) @editor.backwardsScanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - if !range.start.isEqual(zero) + unless range.start.isEqual(zero) position = range.start stop() position diff --git a/src/decoration.coffee b/src/decoration.coffee index 8654cf39a..48b26e81f 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -146,7 +146,7 @@ class Decoration matchesPattern: (decorationPattern) -> return false unless decorationPattern? for key, value of decorationPattern - return false if @properties[key] != value + return false if @properties[key] isnt value true onDidFlash: (callback) -> diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index a05c532a9..9e25e097b 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -16,7 +16,7 @@ class DefaultDirectoryProvider directoryForURISync: (uri) -> projectPath = path.normalize(uri) - directoryPath = if !fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) + directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) path.dirname(projectPath) else projectPath diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index ec95d0619..d86fd13be 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -166,7 +166,7 @@ class DisplayBuffer extends Model @updateAllScreenLines() screenDelta = @getLastRow() - end bufferDelta = 0 - @emitDidChange({ start, end, screenDelta, bufferDelta }) + @emitDidChange({start, end, screenDelta, bufferDelta}) # Sets the visibility of the tokenized buffer. # @@ -740,7 +740,7 @@ class DisplayBuffer extends Model screenPositionForBufferPosition: (bufferPosition, options) -> throw new Error("This TextEditor has been destroyed") if @isDestroyed() - { row, column } = @buffer.clipPosition(bufferPosition) + {row, column} = @buffer.clipPosition(bufferPosition) [startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row) for screenRow in [startScreenRow...endScreenRow] screenLine = @screenLines[screenRow] @@ -774,7 +774,7 @@ class DisplayBuffer extends Model # # Returns a {Point}. bufferPositionForScreenPosition: (screenPosition, options) -> - { row, column } = @clipScreenPosition(Point.fromObject(screenPosition), options) + {row, column} = @clipScreenPosition(Point.fromObject(screenPosition), options) [bufferRow] = @rowMap.bufferRowRangeForScreenRow(row) new Point(bufferRow, @screenLines[row].bufferColumnForScreenColumn(column)) @@ -828,8 +828,8 @@ class DisplayBuffer extends Model # # Returns the new, clipped {Point}. Note that this could be the same as `position` if no clipping was performed. clipScreenPosition: (screenPosition, options={}) -> - { wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation } = options - { row, column } = Point.fromObject(screenPosition) + {wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation} = options + {row, column} = Point.fromObject(screenPosition) if row < 0 row = 0 diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 125b15ff6..3cbb8ce49 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -122,7 +122,7 @@ class LanguageMode continue unless startRow? # assumption: startRow will always be the min indent level for the entire range - if @editor.indentationForBufferRow(startRow) == indentLevel + if @editor.indentationForBufferRow(startRow) is indentLevel @editor.createFold(startRow, endRow) return @@ -178,7 +178,7 @@ class LanguageMode continue if @editor.isBufferRowBlank(row) indentation = @editor.indentationForBufferRow(row) if indentation <= startIndentLevel - includeRowInFold = indentation == startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row)) + includeRowInFold = indentation is startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row)) foldEndRow = row if includeRowInFold break @@ -211,14 +211,14 @@ class LanguageMode startRow = bufferRow while startRow > firstRow - break if @isLineCommentedAtBufferRow(startRow - 1) != isOriginalRowComment + break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment break unless /\w/.test(@editor.lineTextForBufferRow(startRow - 1)) startRow-- endRow = bufferRow lastRow = @editor.getLastBufferRow() while endRow < lastRow - break if @isLineCommentedAtBufferRow(endRow + 1) != isOriginalRowComment + break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment break unless /\w/.test(@editor.lineTextForBufferRow(endRow + 1)) endRow++ diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 1991cba95..568d726a4 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -164,7 +164,7 @@ class MenuManager filtered = {} for key, bindings of keystrokesByCommand for binding in bindings - continue if binding.indexOf(' ') != -1 + continue if binding.indexOf(' ') isnt -1 filtered[key] ?= [] filtered[key].push(binding) diff --git a/src/notification.coffee b/src/notification.coffee index 0ca82e724..43044c182 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -27,9 +27,9 @@ class Notification getDetail: -> @options.detail isEqual: (other) -> - @getMessage() == other.getMessage() \ - and @getType() == other.getType() \ - and @getDetail() == other.getDetail() + @getMessage() is other.getMessage() \ + and @getType() is other.getType() \ + and @getDetail() is other.getDetail() dismiss: -> return unless @isDismissable() and not @isDismissed() diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index 6dc36b998..21a484fbe 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -37,7 +37,7 @@ class OverlayManager # The same node may be used in more than one overlay. This steals the node # back if it has been displayed in another overlay. - overlayNode.appendChild(itemView) if overlayNode.childNodes.length == 0 + overlayNode.appendChild(itemView) if overlayNode.childNodes.length is 0 cachedOverlay.pixelPosition = pixelPosition overlayNode.style.top = pixelPosition.top + 'px' diff --git a/src/pane-axis-element.coffee b/src/pane-axis-element.coffee index ba0cb4b19..569c36534 100644 --- a/src/pane-axis-element.coffee +++ b/src/pane-axis-element.coffee @@ -31,7 +31,7 @@ class PaneAxisElement extends HTMLElement view = atom.views.getView(child) view.remove() - childReplaced: ({index, oldChild, newChild}) -> + childReplaced: ({index, oldChild, newChild}) -> focusedElement = document.activeElement if @hasFocus() @childRemoved({child: oldChild, index}) @childAdded({child: newChild, index}) diff --git a/src/project.coffee b/src/project.coffee index 5094ef8ce..a02c7d747 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -339,7 +339,7 @@ class Project extends Model @findBufferForPath(@resolvePath(filePath))?.isModified() findBufferForPath: (filePath) -> - _.find @buffers, (buffer) -> buffer.getPath() == filePath + _.find @buffers, (buffer) -> buffer.getPath() is filePath # Only to be used in specs bufferForPathSync: (filePath) -> diff --git a/src/scan-handler.coffee b/src/scan-handler.coffee index 71917cc6e..74e15d930 100644 --- a/src/scan-handler.coffee +++ b/src/scan-handler.coffee @@ -34,7 +34,7 @@ module.exports = (rootPaths, regexSource, options) -> scanner.on 'path-found', -> pathsSearched++ - if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK == 0 + if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK is 0 emit('scan:paths-searched', pathsSearched) search regex, scanner, searcher, -> diff --git a/src/selection.coffee b/src/selection.coffee index 91f942524..f806acf43 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -110,7 +110,7 @@ class Selection extends Model range = @getBufferRange() start = range.start.row end = range.end.row - end = Math.max(start, end - 1) if range.end.column == 0 + end = Math.max(start, end - 1) if range.end.column is 0 [start, end] getTailScreenPosition: -> @@ -386,7 +386,7 @@ class Selection extends Model if autoIndentFirstLine @editor.setIndentationForBufferRow(oldBufferRange.start.row, desiredIndentLevel) - if options.autoIndentNewline and text == '\n' + if options.autoIndentNewline and text is '\n' currentIndentation = @editor.indentationForBufferRow(newBufferRange.start.row) @editor.autoIndentBufferRow(newBufferRange.end.row, preserveLeadingWhitespace: true, skipBlankLines: false) if @editor.indentationForBufferRow(newBufferRange.end.row) < currentIndentation @@ -601,7 +601,7 @@ class Selection extends Model # of levels. Leaves the first line unchanged. adjustIndent: (lines, indentAdjustment) -> for line, i in lines - if indentAdjustment == 0 or line is '' + if indentAdjustment is 0 or line is '' continue else if indentAdjustment > 0 lines[i] = @editor.buildIndentString(indentAdjustment) + line @@ -620,8 +620,8 @@ class Selection extends Model # * `options` (optional) {Object} with the keys: # * `autoIndent` If `true`, the line is indented to an automatically-inferred # level. Otherwise, {TextEditor::getTabText} is inserted. - indent: ({ autoIndent }={}) -> - { row, column } = @cursor.getBufferPosition() + indent: ({autoIndent}={}) -> + {row, column} = @cursor.getBufferPosition() if @isEmpty() @cursor.skipLeadingWhitespace() @@ -640,7 +640,7 @@ class Selection extends Model indentSelectedRows: -> [start, end] = @getBufferRowRange() for row in [start..end] - @editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) == 0 + @editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) is 0 return ### diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index bd0e0ee86..4d04dc98f 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -117,7 +117,7 @@ class TextEditorComponent @cursorMoved = false @selectionChanged = false - if @editor.getLastSelection()? and !@editor.getLastSelection().isEmpty() + if @editor.getLastSelection()? and not @editor.getLastSelection().isEmpty() @domNode.classList.add('has-selection') else @domNode.classList.remove('has-selection') diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 2ca7d74bb..be8376ccb 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -949,14 +949,14 @@ class TextEditor extends Model # For each selection, if the selection is empty, converts the containing word # to upper case. Otherwise convert the selected text to upper case. upperCase: -> - @replaceSelectedText selectWordIfEmpty:true, (text) -> text.toUpperCase() + @replaceSelectedText selectWordIfEmpty: true, (text) -> text.toUpperCase() # Extended: Convert the selected text to lower case. # # For each selection, if the selection is empty, converts the containing word # to upper case. Otherwise convert the selected text to upper case. lowerCase: -> - @replaceSelectedText selectWordIfEmpty:true, (text) -> text.toLowerCase() + @replaceSelectedText selectWordIfEmpty: true, (text) -> text.toLowerCase() # Extended: Toggle line comments for rows intersecting selections. # @@ -2464,7 +2464,7 @@ class TextEditor extends Model {cursor} = selection if indentBasis? containsNewlines = text.indexOf('\n') isnt -1 - if containsNewlines or !cursor.hasPrecedingCharactersOnLine() + if containsNewlines or not cursor.hasPrecedingCharactersOnLine() options.indentBasis ?= indentBasis if fullLine and selection.isEmpty() diff --git a/src/token.coffee b/src/token.coffee index 941daf032..8aa4a8706 100644 --- a/src/token.coffee +++ b/src/token.coffee @@ -27,7 +27,7 @@ class Token isEqual: (other) -> # TODO: scopes is deprecated. This is here for the sake of lang package tests - @value == other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic == !!other.isAtomic + @value is other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic is !!other.isAtomic isBracket: -> /^meta\.brace\b/.test(_.last(@scopes)) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b9d1d01f6..521cdb204 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -154,11 +154,11 @@ class TokenizedBuffer extends Model loop previousStack = @stackForRow(row) @tokenizedLines[row] = @buildTokenizedLineForRow(row, @stackForRow(row - 1)) - if --rowsRemaining == 0 + if --rowsRemaining is 0 filledRegion = false endRow = row break - if row == lastRow or _.isEqual(@stackForRow(row), previousStack) + if row is lastRow or _.isEqual(@stackForRow(row), previousStack) filledRegion = true endRow = row break @@ -280,7 +280,7 @@ class TokenizedBuffer extends Model ruleStack = startingStack stopTokenizingAt = startRow + @chunkSize tokenizedLines = for row in [startRow..endRow] - if (ruleStack or row == 0) and row < stopTokenizingAt + if (ruleStack or row is 0) and row < stopTokenizingAt screenLine = @buildTokenizedLineForRow(row, ruleStack) ruleStack = screenLine.ruleStack else @@ -390,7 +390,7 @@ class TokenizedBuffer extends Model iterateTokensInBufferRange: (bufferRange, iterator) -> bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange + {start, end} = bufferRange keepLooping = true stop = -> keepLooping = false @@ -399,13 +399,13 @@ class TokenizedBuffer extends Model bufferColumn = 0 for token in @tokenizedLines[bufferRow].tokens startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) + iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken) return unless keepLooping bufferColumn += token.bufferDelta backwardsIterateTokensInBufferRange: (bufferRange, iterator) -> bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange + {start, end} = bufferRange keepLooping = true stop = -> keepLooping = false @@ -415,20 +415,20 @@ class TokenizedBuffer extends Model for token in new Array(@tokenizedLines[bufferRow].tokens...).reverse() bufferColumn -= token.bufferDelta startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) + iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken) return unless keepLooping findOpeningBracket: (startBufferPosition) -> range = [[0,0], startBufferPosition] position = null depth = 0 - @backwardsIterateTokensInBufferRange range, (token, startPosition, { stop }) -> + @backwardsIterateTokensInBufferRange range, (token, startPosition, {stop}) -> if token.isBracket() - if token.value == '}' + if token.value is '}' depth++ - else if token.value == '{' + else if token.value is '{' depth-- - if depth == 0 + if depth is 0 position = startPosition stop() position @@ -437,13 +437,13 @@ class TokenizedBuffer extends Model range = [startBufferPosition, @buffer.getEndPosition()] position = null depth = 0 - @iterateTokensInBufferRange range, (token, startPosition, { stop }) -> + @iterateTokensInBufferRange range, (token, startPosition, {stop}) -> if token.isBracket() - if token.value == '{' + if token.value is '{' depth++ - else if token.value == '}' + else if token.value is '}' depth-- - if depth == 0 + if depth is 0 position = startPosition stop() position diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 074e7a785..b81d972a0 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -52,9 +52,9 @@ class TokenizedLine # # Returns a {Number} representing the clipped column. clipScreenColumn: (column, options={}) -> - return 0 if @tokens.length == 0 + return 0 if @tokens.length is 0 - { clip } = options + {clip} = options column = Math.min(column, @getMaxScreenColumn()) tokenStartColumn = 0 @@ -65,9 +65,9 @@ class TokenizedLine if @isColumnInsideSoftWrapIndentation(tokenStartColumn) @softWrapIndentationDelta else if token.isAtomic and tokenStartColumn < column - if clip == 'forward' + if clip is 'forward' tokenStartColumn + token.screenDelta - else if clip == 'backward' + else if clip is 'backward' tokenStartColumn else #'closest' if column > tokenStartColumn + (token.screenDelta / 2) @@ -140,7 +140,7 @@ class TokenizedLine indentTokens softWrapAt: (column, hangingIndent) -> - return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 + return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column is 0 rightTokens = new Array(@tokens...) leftTokens = [] @@ -179,7 +179,7 @@ class TokenizedLine @lineEnding is null isColumnInsideSoftWrapIndentation: (column) -> - return false if @softWrapIndentationTokens.length == 0 + return false if @softWrapIndentationTokens.length is 0 column < @softWrapIndentationDelta @@ -190,7 +190,7 @@ class TokenizedLine _.reduce @softWrapIndentationTokens, ((acc, token) -> acc + token.screenDelta), 0 hasOnlySoftWrapIndentation: -> - @tokens.length == @softWrapIndentationTokens.length + @tokens.length is @softWrapIndentationTokens.length tokenAtBufferColumn: (bufferColumn) -> @tokens[@tokenIndexAtBufferColumn(bufferColumn)] diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 593d33476..96518c446 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -85,7 +85,7 @@ class WindowEventHandler if process.platform in ['win32', 'linux'] @subscribeToCommand $(window), 'window:toggle-menu-bar', -> - atom.config.set('core.autoHideMenuBar', !atom.config.get('core.autoHideMenuBar')) + atom.config.set('core.autoHideMenuBar', not atom.config.get('core.autoHideMenuBar')) @subscribeToCommand $(document), 'core:focus-next', @focusNext diff --git a/src/workspace.coffee b/src/workspace.coffee index 6a7a40a0c..b18799160 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -400,7 +400,7 @@ class Workspace extends Model uri = atom.project.resolvePath(uri) item = @getActivePane().itemForURI(uri) if uri - item ?= opener(uri, options) for opener in @getOpeners() when !item + item ?= opener(uri, options) for opener in @getOpeners() when not item item ?= atom.project.openSync(uri, {initialLine, initialColumn}) @getActivePane().activateItem(item) @@ -419,7 +419,7 @@ class Workspace extends Model if uri? item = pane.itemForURI(uri) - item ?= opener(uri, options) for opener in @getOpeners() when !item + item ?= opener(uri, options) for opener in @getOpeners() when not item try item ?= atom.project.open(uri, options) @@ -865,8 +865,8 @@ class Workspace extends Model openPaths = (buffer.getPath() for buffer in atom.project.getBuffers()) outOfProcessPaths = _.difference(filePaths, openPaths) - inProcessFinished = !openPaths.length - outOfProcessFinished = !outOfProcessPaths.length + inProcessFinished = not openPaths.length + outOfProcessFinished = not outOfProcessPaths.length checkFinished = -> deferred.resolve() if outOfProcessFinished and inProcessFinished From 2bb2022b5be282982812fe4c851a5c8f1b6a7372 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Tue, 7 Apr 2015 00:05:19 -0400 Subject: [PATCH 06/32] :shirt: --- build/tasks/spec-task.coffee | 2 +- build/tasks/task-helpers.coffee | 4 ++-- src/atom.coffee | 2 +- src/config.coffee | 2 +- src/grammar-registry.coffee | 2 +- src/tokenized-buffer.coffee | 2 +- src/workspace-element.coffee | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index 73bb63f70..b5547fe64 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -138,4 +138,4 @@ module.exports = (grunt) -> if process.platform is 'win32' and process.env.JANKY_SHA1 done() else - done(!coreSpecFailed and failedPackages.length == 0) + done(not coreSpecFailed and failedPackages.length is 0) diff --git a/build/tasks/task-helpers.coffee b/build/tasks/task-helpers.coffee index a862f291f..2819c952a 100644 --- a/build/tasks/task-helpers.coffee +++ b/build/tasks/task-helpers.coffee @@ -55,9 +55,9 @@ module.exports = (grunt) -> proc.stderr.on 'data', (data) -> stderr.push(data.toString()) proc.on 'error', (processError) -> error ?= processError proc.on 'close', (exitCode, signal) -> - error ?= new Error(signal) if exitCode != 0 + error ?= new Error(signal) if exitCode isnt 0 results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode} - grunt.log.error results.stderr if exitCode != 0 + grunt.log.error results.stderr if exitCode isnt 0 callback(error, results, exitCode) isAtomPackage: (packagePath) -> diff --git a/src/atom.coffee b/src/atom.coffee index 88c8257e1..b02d04d5c 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -846,7 +846,7 @@ class Atom extends Model setAutoHideMenuBar: (autoHide) -> ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) - ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide) + ipc.send('call-window-method', 'setMenuBarVisibility', not autoHide) if includeDeprecatedAPIs # Deprecated: Callers should be converted to use atom.deserializers diff --git a/src/config.coffee b/src/config.coffee index 50d8caba3..cb2d8ab76 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1190,7 +1190,7 @@ if Grim.includeDeprecatedAPIs Config::toggle = (keyPath) -> Grim.deprecate 'Config::toggle is no longer supported. Please remove from your code.' - @set(keyPath, !@get(keyPath)) + @set(keyPath, not @get(keyPath)) Config::unobserve = (keyPath) -> Grim.deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.' diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index 8272dce47..568de483a 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -57,7 +57,7 @@ if includeDeprecatedAPIs atom.config.scopedSettingsStore GrammarRegistry::addProperties = (args...) -> - args.unshift(null) if args.length == 2 + args.unshift(null) if args.length is 2 deprecate 'Consider using atom.config.set() instead. A direct (but private) replacement is available at atom.config.addScopedSettings().' atom.config.addScopedSettings(args...) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 521cdb204..d9f1bcba7 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -226,7 +226,7 @@ class TokenizedBuffer extends Model [start, end] = @updateFoldableStatus(start, end + delta) end -= delta - event = { start, end, delta, bufferChange: e } + event = {start, end, delta, bufferChange: e} @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 5f127d970..5768b2dbb 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -156,9 +156,9 @@ atom.commands.add 'atom-workspace', 'window:focus-pane-on-left': -> @focusPaneViewOnLeft() 'window:focus-pane-on-right': -> @focusPaneViewOnRight() 'window:save-all': -> @getModel().saveAll() - 'window:toggle-invisibles': -> atom.config.set("editor.showInvisibles", !atom.config.get("editor.showInvisibles")) + 'window:toggle-invisibles': -> atom.config.set("editor.showInvisibles", not atom.config.get("editor.showInvisibles")) 'window:log-deprecation-warnings': -> Grim.logDeprecations() - 'window:toggle-auto-indent': -> atom.config.set("editor.autoIndent", !atom.config.get("editor.autoIndent")) + 'window:toggle-auto-indent': -> atom.config.set("editor.autoIndent", not atom.config.get("editor.autoIndent")) 'pane:reopen-closed-item': -> @getModel().reopenItem() 'core:close': -> @getModel().destroyActivePaneItemOrEmptyPane() 'core:save': -> @getModel().saveActivePaneItem() From ec11c89a7440f257de4a4f64bf4a6e449e58e56f Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Tue, 7 Apr 2015 19:24:29 -0400 Subject: [PATCH 07/32] Revert :shirt: for spec fixtures --- spec/fixtures/coffee.coffee | 3 +-- spec/fixtures/sample-with-tabs-and-leading-comment.coffee | 6 ++---- spec/fixtures/sample-with-tabs.coffee | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/spec/fixtures/coffee.coffee b/spec/fixtures/coffee.coffee index d68b84267..b8367ca59 100644 --- a/spec/fixtures/coffee.coffee +++ b/spec/fixtures/coffee.coffee @@ -1,4 +1,4 @@ -class Quicksort +class quicksort sort: (items) -> return items if items.length <= 1 @@ -13,7 +13,6 @@ class Quicksort if current < pivot left.push(current) else - # coffeelint: disable=no_trailing_semicolons right.push(current); sort(left).concat(pivot).concat(sort(right)) diff --git a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee index 08e81aa68..0f81f6fe8 100644 --- a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee +++ b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee @@ -1,6 +1,4 @@ # This is a comment - # coffeelint: disable=no_tabs - # coffeelint: disable=indentation if this.studyingEconomics - buy() while supply > demand - sell() until supply > demand + buy() while supply > demand + sell() until supply > demand diff --git a/spec/fixtures/sample-with-tabs.coffee b/spec/fixtures/sample-with-tabs.coffee index 5e7595a7d..1b937ea33 100644 --- a/spec/fixtures/sample-with-tabs.coffee +++ b/spec/fixtures/sample-with-tabs.coffee @@ -1,5 +1,3 @@ -# coffeelint: disable=no_tabs -# coffeelint: disable=no_trailing_whitespace # Econ 101 if this.studyingEconomics buy() while supply > demand From 79989a59a96cc646c0d0908b1c2a51cbdb0e9982 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:03:17 -0700 Subject: [PATCH 08/32] :arrow_up: settings-view@0.189 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e9b716d5..e5d3eac3e 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.187.0", + "settings-view": "0.189.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 937fc27f6e3deb4827c87e748b2828be86902059 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:04:43 -0700 Subject: [PATCH 09/32] :arrow_up: keybinding-resolver@0.31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5d3eac3e..20bbb5043 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "grammar-selector": "0.46.0", "image-view": "0.54.0", "incompatible-packages": "0.24.0", - "keybinding-resolver": "0.30.0", + "keybinding-resolver": "0.31.0", "link": "0.30.0", "markdown-preview": "0.148.0", "metrics": "0.45.0", From fe927280ff1983b4b0869ca4fdb2db64d6851c46 Mon Sep 17 00:00:00 2001 From: simurai Date: Thu, 9 Apr 2015 01:12:41 +0900 Subject: [PATCH 10/32] :arrrow_up: one-dark-ui@v0.6.3 one-light-ui@v0.5.3 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 20bbb5043..7d7a2ba9a 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", "base16-tomorrow-light-theme": "0.8.0", - "one-dark-ui": "0.6.2", + "one-dark-ui": "0.6.3", "one-dark-syntax": "0.3.0", "one-light-syntax": "0.4.0", - "one-light-ui": "0.5.2", + "one-light-ui": "0.5.3", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", "archive-view": "0.55.0", From d0bd76072b6ed529b25ea6002f2a2183bb639db9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 15:58:44 -0700 Subject: [PATCH 11/32] Inline platform system menu --- build/tasks/compile-packages-slug-task.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 4e24f948e..ed9c2e9e4 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -6,6 +6,13 @@ _ = require 'underscore-plus' module.exports = (grunt) -> {spawn, rm} = require('./task-helpers')(grunt) + getMenu = (appDir) -> + menusPath = path.join(appDir, 'menus') + menuPath = path.join(menusPath, process.platform) + menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) + rm menusPath + menu ? {} + grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) @@ -50,5 +57,6 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages + metadata._menu = getMenu(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From f36584903ff9d579962978d67e2e275008df9101 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:51:57 -0700 Subject: [PATCH 12/32] Inline all keymaps into package.json --- build/tasks/compile-packages-slug-task.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index ed9c2e9e4..574ce89d4 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -13,6 +13,12 @@ module.exports = (grunt) -> rm menusPath menu ? {} + getKeymaps = (appDir) -> + keymapsPath = path.join(appDir, 'keymaps') + keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) + rm keymapsPath + keymaps ? [] + grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) @@ -58,5 +64,6 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages metadata._menu = getMenu(appDir) + metadata._keymaps = getKeymaps(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From bdca781fb8edfa9f4cbcac63c489a8cc0ab7dd0a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:52:22 -0700 Subject: [PATCH 13/32] Add atom prefix to keys --- build/tasks/compile-packages-slug-task.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 574ce89d4..c5af73911 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -63,7 +63,7 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages - metadata._menu = getMenu(appDir) - metadata._keymaps = getKeymaps(appDir) + metadata._atomMenu = getMenu(appDir) + metadata._atomKeymaps = getKeymaps(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From 0560687e966449e71652240c1f306ee7a5216d5f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:52:39 -0700 Subject: [PATCH 14/32] Remove unneeded default --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index c5af73911..0d95f3e89 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -17,7 +17,7 @@ module.exports = (grunt) -> keymapsPath = path.join(appDir, 'keymaps') keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) rm keymapsPath - keymaps ? [] + keymaps grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) From d30b61f7c9a5a1046311a53d275319271a1bf476 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:54:55 -0700 Subject: [PATCH 15/32] Load platform menu from package.json --- src/menu-manager.coffee | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 1991cba95..29fdbce25 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -8,6 +8,11 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' +try + platformMenu = require('../package.json')?._atomMenu +catch error + platformMenu = null + # Extended: Provides a registry for menu items that you'd like to appear in the # application menu. # @@ -144,10 +149,13 @@ class MenuManager @sendToBrowserProcess(@template, keystrokesByCommand) loadPlatformItems: -> - menusDirPath = path.join(@resourcePath, 'menus') - platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) - {menu} = CSON.readFileSync(platformMenuPath) - @add(menu) + if platformMenuPath + @add(menu) + else + menusDirPath = path.join(@resourcePath, 'menus') + platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) + {menu} = CSON.readFileSync(platformMenuPath) + @add(menu) # Merges an item in a submenu aware way such that new items are always # appended to the bottom of existing menus where possible. From 0d3d72c18114a5e5a63602ab94a3606a665a0f59 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:24:38 -0700 Subject: [PATCH 16/32] Add missing extension --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 0d95f3e89..3deed46c0 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -8,7 +8,7 @@ module.exports = (grunt) -> getMenu = (appDir) -> menusPath = path.join(appDir, 'menus') - menuPath = path.join(menusPath, process.platform) + menuPath = path.join(menusPath, "#{process.platform}.cson") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath menu ? {} From 50688973e65416b17866d2d2f3cbddf9aa6c5c5f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:25:02 -0700 Subject: [PATCH 17/32] Load keymaps from package.json --- build/tasks/compile-packages-slug-task.coffee | 10 +++++++++- src/keymap-extensions.coffee | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 3deed46c0..e9db9b8fa 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -3,6 +3,8 @@ CSON = require 'season' fs = require 'fs-plus' _ = require 'underscore-plus' +OtherPlatforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'].filter (platform) -> platform isnt process.platform + module.exports = (grunt) -> {spawn, rm} = require('./task-helpers')(grunt) @@ -15,7 +17,13 @@ module.exports = (grunt) -> getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') - keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) + keymaps = {} + for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json']) + name = path.basename(keymapPath, path.extname(keymapPath)) + continue unless OtherPlatforms.indexOf(name) is -1 + + keymap = CSON.readFileSync(keymapPath) + keymaps[path.basename(keymapPath)] = keymap rm keymapsPath keymaps diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 551c6580d..3d1ca3547 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -5,11 +5,23 @@ CSON = require 'season' {jQuery} = require 'space-pen' Grim = require 'grim' +try + bundledKeymaps = require('../package.json')?._atomKeymaps +catch error + bundledKeymaps = null + KeymapManager::onDidLoadBundledKeymaps = (callback) -> @emitter.on 'did-load-bundled-keymaps', callback KeymapManager::loadBundledKeymaps = -> - @loadKeymap(path.join(@resourcePath, 'keymaps')) + keymapsPath = path.join(@resourcePath, 'keymaps') + if bundledKeymaps? + for keymapName, keymap of bundledKeymaps + keymapPath = path.join(keymapsPath, keymapName) + @add(keymapPath, keymap) + else + @loadKeymap(keymapsPath) + @emit 'bundled-keymaps-loaded' if Grim.includeDeprecatedAPIs @emitter.emit 'did-load-bundled-keymaps' From ab79f2cf50d9089af441cc7f9003f6bd08fed2ad Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:28:02 -0700 Subject: [PATCH 18/32] :art: Drop unneeded detail: --- src/keymap-extensions.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 3d1ca3547..06ff95cea 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -63,7 +63,7 @@ KeymapManager::subscribeToFileReadFailure = -> else error.message - atom.notifications.addError(message, {detail: detail, dismissable: true}) + atom.notifications.addError(message, {detail, dismissable: true}) # This enables command handlers registered via jQuery to call # `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler. From 3954a5fd84d791f66704137bcfdac7711e20747b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:32:00 -0700 Subject: [PATCH 19/32] .cson -> .json --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index e9db9b8fa..e31dc52e2 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -10,7 +10,7 @@ module.exports = (grunt) -> getMenu = (appDir) -> menusPath = path.join(appDir, 'menus') - menuPath = path.join(menusPath, "#{process.platform}.cson") + menuPath = path.join(menusPath, "#{process.platform}.json") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath menu ? {} From c69af727cf5b9889e6a634310afac14e71b0cd51 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:34:48 -0700 Subject: [PATCH 20/32] Don't default menu value --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index e31dc52e2..f3b04683e 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -13,7 +13,7 @@ module.exports = (grunt) -> menuPath = path.join(menusPath, "#{process.platform}.json") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath - menu ? {} + menu getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') From 4b8bb9e1d9fe927d0dd7566d068616608c463a92 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:39:50 -0700 Subject: [PATCH 21/32] platformMenuPath -> platformMenu --- src/menu-manager.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 29fdbce25..d0a95dd1f 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -149,8 +149,8 @@ class MenuManager @sendToBrowserProcess(@template, keystrokesByCommand) loadPlatformItems: -> - if platformMenuPath - @add(menu) + if platformMenu? + @add(platformMenu) else menusDirPath = path.join(@resourcePath, 'menus') platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) From 83541c01b59e0d8374e25e2460c1e6e61943cebf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 18:00:08 -0700 Subject: [PATCH 22/32] Pull out menu property from _atomMenu --- src/menu-manager.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index d0a95dd1f..6d4e4c77c 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -9,7 +9,7 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' try - platformMenu = require('../package.json')?._atomMenu + platformMenu = require('../package.json')?._atomMenu?.menu catch error platformMenu = null From ca67d33ebef514cdc4d879907809adf12bb979f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 18:00:23 -0700 Subject: [PATCH 23/32] Use inlined context menu from package.json when available --- src/context-menu-manager.coffee | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 00b635251..7446c6ac0 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -8,6 +8,11 @@ Grim = require 'grim' MenuHelpers = require './menu-helpers' {validateSelector} = require './selector-validator' +try + platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] +catch error + platformContextMenu = null + SpecificityCache = {} # Extended: Provides a registry for commands that you'd like to appear in the @@ -49,10 +54,13 @@ class ContextMenuManager atom.keymaps.onDidLoadBundledKeymaps => @loadPlatformItems() loadPlatformItems: -> - menusDirPath = path.join(@resourcePath, 'menus') - platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) - map = CSON.readFileSync(platformMenuPath) - atom.contextMenu.add(map['context-menu']) + if platformContextMenu? + @add(platformContextMenu) + else + menusDirPath = path.join(@resourcePath, 'menus') + platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) + map = CSON.readFileSync(platformMenuPath) + @add(map['context-menu']) # Public: Add context menu items scoped by CSS selectors. # From 80787ef1e20c1dbadd76fe45e90050e40966c0d8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:29:04 -0700 Subject: [PATCH 24/32] Remove try/catch around package.json requiring No other requires are ever guarded against and the package.json should be assumed to be valid JSON. --- src/context-menu-manager.coffee | 6 +----- src/keymap-extensions.coffee | 5 +---- src/menu-manager.coffee | 5 +---- src/package.coffee | 5 +---- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 7446c6ac0..8397da33d 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -8,11 +8,7 @@ Grim = require 'grim' MenuHelpers = require './menu-helpers' {validateSelector} = require './selector-validator' -try - platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] -catch error - platformContextMenu = null - +platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] SpecificityCache = {} # Extended: Provides a registry for commands that you'd like to appear in the diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 06ff95cea..7ffd3d7ef 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -5,10 +5,7 @@ CSON = require 'season' {jQuery} = require 'space-pen' Grim = require 'grim' -try - bundledKeymaps = require('../package.json')?._atomKeymaps -catch error - bundledKeymaps = null +bundledKeymaps = require('../package.json')?._atomKeymaps KeymapManager::onDidLoadBundledKeymaps = (callback) -> @emitter.on 'did-load-bundled-keymaps', callback diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 6d4e4c77c..bd42dddb9 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -8,10 +8,7 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' -try - platformMenu = require('../package.json')?._atomMenu?.menu -catch error - platformMenu = null +platformMenu = require('../package.json')?._atomMenu?.menu # Extended: Provides a registry for menu items that you'd like to appear in the # application menu. diff --git a/src/package.coffee b/src/package.coffee index dd6701527..74c4f0eb8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -11,10 +11,7 @@ Q = require 'q' ModuleCache = require './module-cache' ScopedProperties = require './scoped-properties' -try - packagesCache = require('../package.json')?._atomPackages ? {} -catch error - packagesCache = {} +packagesCache = require('../package.json')?._atomPackages ? {} # Loads and activates a package's main module and resources such as # stylesheets, keymaps, grammar, editor properties, and menus. From 6d61588467c529e99f5bcac7368d66f0ca9e2583 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:40:23 -0700 Subject: [PATCH 25/32] Only look for JSON keymaps --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index f3b04683e..613a4a380 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -18,7 +18,7 @@ module.exports = (grunt) -> getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') keymaps = {} - for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json']) + for keymapPath in fs.listSync(keymapsPath, ['.json']) name = path.basename(keymapPath, path.extname(keymapPath)) continue unless OtherPlatforms.indexOf(name) is -1 From adbd539302b0a979e3e136d3a4122bf6861bb803 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Wed, 8 Apr 2015 14:36:00 -0400 Subject: [PATCH 26/32] Revert :shirt: --- benchmark/fixtures/medium.coffee | 14 +++++++------- .../package-with-config-defaults/index.coffee | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benchmark/fixtures/medium.coffee b/benchmark/fixtures/medium.coffee index 28ec156b0..2bdb8c6f7 100644 --- a/benchmark/fixtures/medium.coffee +++ b/benchmark/fixtures/medium.coffee @@ -209,13 +209,13 @@ template = (str) -> 'var p=[],print=function(){p.push.apply(p,arguments);};' + 'with(obj){p.push(\'' + str.replace(/[\r\t\n]/g, " ") - .replace(/'(?=[^<]*%>)/g,"\t") - .split("'").join("\\'") - .split("\t").join("'") - .replace(/<%=(.+?)%>/g, "',$1,'") - .split('<%').join("');") - .split('%>').join("p.push('") + - "');}return p.join('');" + .replace(/'(?=[^<]*%>)/g,"\t") + .split("'").join("\\'") + .split("\t").join("'") + .replace(/<%=(.+?)%>/g, "',$1,'") + .split('<%').join("');") + .split('%>').join("p.push('") + + "');}return p.join('');" # Create the template that we will use to generate the Docco HTML page. docco_template = template fs.readFileSync(__dirname + '/../resources/docco.jst').toString() diff --git a/spec/fixtures/packages/package-with-config-defaults/index.coffee b/spec/fixtures/packages/package-with-config-defaults/index.coffee index 6c48b2af4..554c6c5eb 100644 --- a/spec/fixtures/packages/package-with-config-defaults/index.coffee +++ b/spec/fixtures/packages/package-with-config-defaults/index.coffee @@ -1,5 +1,5 @@ module.exports = configDefaults: - numbers: {one: 1, two: 2} + numbers: { one: 1, two: 2 } activate: -> # no-op From 7fb6e79c8dcb9f189409f317145ee891764fae55 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 17:03:50 -0700 Subject: [PATCH 27/32] :arrow_up: language-javascript@0.71 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d7a2ba9a..45b92bc33 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.70.0", + "language-javascript": "0.71.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 5fd767b9d8a7f3c43b7aa9accc7771b76556f0cb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 17:46:06 -0700 Subject: [PATCH 28/32] :arrow_up: symbols-view@0.94 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45b92bc33..56bb2fa56 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "spell-check": "0.55.0", "status-bar": "0.67.0", "styleguide": "0.44.0", - "symbols-view": "0.93.0", + "symbols-view": "0.94.0", "tabs": "0.67.0", "timecop": "0.31.0", "tree-view": "0.170.0", From b8fb2f4d11cd6bdf2bd8b5ec2d01702d42c3cafb Mon Sep 17 00:00:00 2001 From: Ivan Zuzak Date: Thu, 9 Apr 2015 15:38:48 +0200 Subject: [PATCH 29/32] Clarify that URIs don't need to be files --- src/workspace.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 6c60cf22a..e864e2af2 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,11 +371,12 @@ class Workspace extends Model Section: Opening ### - # Essential: Opens the given URI in Atom asynchronously, if it's not already open. - # If no URI is given, or the URI is the path of a file that does not exist, - # a new empty text edtior is created. - # - # * `uri` (optional) A {String} containing a URI. + # Essential: Opens the given URI in Atom asynchronously. + # If the URI is already open, the existing item for that URI will be + # activated. If no URI is given, or no registered opener can open + # the URI, a new empty {TextEditor} will be created. + # + # * `uri` (optional) A {String} containing a URI. # * `options` (optional) {Object} # * `initialLine` A {Number} indicating which row to move the cursor to # initially. Defaults to `0`. From f35187e8c343aa329fa151c8f8d6ad3622dd9e00 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 9 Apr 2015 14:21:03 -0700 Subject: [PATCH 30/32] Allow editor.completions to be an array or an object. --- src/config-schema.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index c2944911b..87e1040bc 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -99,9 +99,7 @@ module.exports = # These can be used as globals or scoped, thus defaults. completions: - type: "array" - items: - type: "string" + type: ['array', 'object'] default: [] fontFamily: type: 'string' From d9d319c4066744cd1edcf2a868f17e13dc5f127c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Apr 2015 16:33:12 -0700 Subject: [PATCH 31/32] :arrow_up: settings-view@0.190 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56bb2fa56..5339f582c 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.189.0", + "settings-view": "0.190.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 94ebbccc9f8dee5c0861c454c45c4ef1c58ddf8b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Apr 2015 16:36:56 -0700 Subject: [PATCH 32/32] :arrow_up: language-python@0.34 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5339f582c..8e071aaf0 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "language-perl": "0.22.0", "language-php": "0.22.0", "language-property-list": "0.8.0", - "language-python": "0.33.0", + "language-python": "0.34.0", "language-ruby": "0.51.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0",