Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit c228c87

Browse files
committed
Updated code with requested changes:
* Removed ".coffee" from require statements. * Moved empty array initialization closer to where it was populated.
1 parent a509817 commit c228c87

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

lib/main.coffee

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ module.exports =
118118
sendGlobalArgs: ->
119119
@task.send {type: "global", global: @globalArgs}
120120

121-
# Retrieves, creating if required, a spelling manager for use with synchronous
122-
# operations such as retrieving corrections.
121+
# Retrieves, creating if required, a spelling manager for use with
122+
# synchronous operations such as retrieving corrections.
123123
getInstance: (globalArgs) ->
124124
if not @instance
125-
SpellCheckerManager = require './spell-check-manager.coffee'
125+
SpellCheckerManager = require './spell-check-manager'
126126
@instance = SpellCheckerManager
127127
@instance.setGlobalArgs globalArgs
128128

lib/spell-check-handler.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is the task local handler for the manager so we can reuse the manager
22
# throughout the life of the task.
3-
SpellCheckerManager = require './spell-check-manager.coffee'
3+
SpellCheckerManager = require './spell-check-manager'
44
instance = SpellCheckerManager
55
instance.isTask = true
66

lib/spell-check-manager.coffee

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@ class SpellCheckerManager
133133

134134
# If we don't have any incorrect spellings, then there is nothing to worry
135135
# about, so just return and stop processing.
136-
misspellings = []
137-
138136
if incorrects.length is 0
139-
return {id: args.id, misspellings}
137+
return {id: args.id, misspellings: []}
140138

141139
# Build up an intersection of all the incorrect ranges. We only treat a word
142140
# as being incorrect if *every* checker that provides negative values treats
@@ -156,7 +154,7 @@ class SpellCheckerManager
156154

157155
# If we have no intersection, then nothing to report as a problem.
158156
if intersection.length is 0
159-
return {id: args.id, misspellings}
157+
return {id: args.id, misspellings: []}
160158

161159
# Remove all of the confirmed correct words from the resulting incorrect
162160
# list. This allows us to have correct-only providers as opposed to only
@@ -169,6 +167,7 @@ class SpellCheckerManager
169167
row = 0
170168
rangeIndex = 0
171169
lineBeginIndex = 0
170+
misspellings = []
172171
while lineBeginIndex < text.length and rangeIndex < intersection.ranges.length
173172
# Figure out where the next line break is. If we hit -1, then we make sure
174173
# it is a higher number so our < comparisons work properly.
@@ -348,7 +347,7 @@ class SpellCheckerManager
348347
# See if we need to reload the known words.
349348
if @knownWordsChecker is null
350349
console.log "spell-check: loading known words", @knownWords
351-
KnownWordsChecker = require './known-words-checker.coffee'
350+
KnownWordsChecker = require './known-words-checker'
352351
@knownWordsChecker = new KnownWordsChecker @knownWords
353352
@knownWordsChecker.enableAdd = @addKnownWords
354353
@addSpellChecker @knownWordsChecker
@@ -378,7 +377,3 @@ class SpellCheckerManager
378377

379378
manager = new SpellCheckerManager
380379
module.exports = manager
381-
382-
# KnownWordsChecker = require './known-words-checker.coffee'
383-
# knownWords = atom.config.get('spell-check.knownWords')
384-
# addKnownWords = atom.config.get('spell-check.addKnownWords')

0 commit comments

Comments
 (0)