From cc89f972dcfbec5804ae8c0bc3e16311ad888734 Mon Sep 17 00:00:00 2001 From: Jess Lin Date: Sat, 14 Mar 2015 17:53:03 -0700 Subject: [PATCH] [Gutter][style] Add parentheses to some method calls for readability --- src/gutter-container.coffee | 12 ++++++------ src/gutter.coffee | 2 +- src/text-editor.coffee | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gutter-container.coffee b/src/gutter-container.coffee index 396b74fc4..e7b68ef52 100644 --- a/src/gutter-container.coffee +++ b/src/gutter-container.coffee @@ -31,10 +31,10 @@ class GutterContainer options = options ? {} gutterName = options.name if gutterName == null - throw new Error 'A name is required to create a gutter.' - if @gutterWithName gutterName - throw new Error 'Tried to create a gutter with a name that is already in use.' - newGutter = new Gutter this, options + throw new Error('A name is required to create a gutter.') + if @gutterWithName(gutterName) + throw new Error('Tried to create a gutter with a name that is already in use.') + newGutter = new Gutter(this, options) inserted = false # Insert the gutter into the gutters array, sorted in ascending order by 'priority'. @@ -81,7 +81,7 @@ class GutterContainer # Processes the destruction of the gutter. Throws an error if this gutter is # not within this gutterContainer. removeGutter: (gutter) -> - index = @gutters.indexOf gutter + index = @gutters.indexOf(gutter) if index > -1 @gutters.splice(index, 1) @unsubscribe gutter @@ -97,4 +97,4 @@ class GutterContainer else options.type = 'gutter' options.gutterName = gutter.name - @textEditor.decorateMarker marker, options + @textEditor.decorateMarker(marker, options) diff --git a/src/gutter.coffee b/src/gutter.coffee index f59fa7acd..cb5c36e9c 100644 --- a/src/gutter.coffee +++ b/src/gutter.coffee @@ -49,7 +49,7 @@ class Gutter # * `item` (optional) A model {Object} with a corresponding view registered, # or an {HTMLElement}. decorateMarker: (marker, options) -> - @gutterContainer.addGutterDecoration this, marker, options + @gutterContainer.addGutterDecoration(this, marker, options) # Calls your `callback` when the {Gutter}'s' visibility changes. # diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 3c7111924..6692790f6 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -114,7 +114,7 @@ class TextEditor extends Model @emit 'scroll-left-changed', scrollLeft if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-left', scrollLeft - @gutterContainer = new GutterContainer this + @gutterContainer = new GutterContainer(this) @lineNumberGutter = @gutterContainer.addGutter name: 'line-number' priority: 0 @@ -514,7 +514,7 @@ class TextEditor extends Model # Public: Creates and returns a {Gutter}. # See {GutterContainer::addGutter} for more details. addGutter: (options) -> - @gutterContainer.addGutter options + @gutterContainer.addGutter(options) # Public: Returns the {Array} of all gutters on this editor. getGutters: -> @@ -522,7 +522,7 @@ class TextEditor extends Model # Public: Returns the {Gutter} with the given name, or null if it doesn't exist. gutterWithName: (name) -> - @gutterContainer.gutterWithName name + @gutterContainer.gutterWithName(name) # Calls your `callback` when a {Gutter} is added to the editor. # Immediately calls your callback for each existing gutter.