[Gutter][style] Add parentheses to some method calls for readability

This commit is contained in:
Jess Lin 2015-03-14 17:53:03 -07:00
parent ee7625249f
commit cc89f972dc
3 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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.
#

View File

@ -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.