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

Commit 492fb3b

Browse files
committed
Don't mark github as a spelling error
1 parent b53c6bc commit 492fb3b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/spell-check-handler.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
SpellChecker = require 'spellchecker'
22

33
module.exports = ({id, text}) ->
4+
SpellChecker.add("GitHub")
5+
SpellChecker.add("github")
6+
47
misspelledCharacterRanges = SpellChecker.checkSpelling(text)
58

69
row = 0

spec/spell-check-spec.coffee

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
describe "Spell check", ->
22
[workspaceElement, editor, editorElement] = []
33

4+
textForDecoration = ({marker}) ->
5+
editor.getTextInBufferRange(marker.getBufferRange())
6+
47
beforeEach ->
58
workspaceElement = atom.views.getView(atom.workspace)
69

@@ -34,8 +37,6 @@ describe "Spell check", ->
3437
decorations = editor.getHighlightDecorations(class: 'spell-check-misspelling')
3538
decorations.length > 0
3639

37-
textForDecoration = ({marker}) ->
38-
editor.getTextInBufferRange(marker.getBufferRange())
3940

4041
runs ->
4142
expect(decorations.length).toBe 4
@@ -44,6 +45,20 @@ describe "Spell check", ->
4445
expect(textForDecoration(decorations[2])).toEqual "edn"
4546
expect(textForDecoration(decorations[3])).toEqual "dsoe"
4647

48+
it "doesn't consider our company's name to be a spelling error", ->
49+
editor.setText("GitHub (aka github): Where codez are built.")
50+
atom.config.set('spell-check.grammars', ['source.js'])
51+
52+
decorations = null
53+
54+
waitsFor ->
55+
decorations = editor.getHighlightDecorations(class: 'spell-check-misspelling')
56+
decorations.length > 0
57+
58+
runs ->
59+
expect(decorations.length).toBe 1
60+
expect(textForDecoration(decorations[0])).toBe "codez"
61+
4762
it "hides decorations when a misspelled word is edited", ->
4863
editor.setText('notaword')
4964
advanceClock(editor.getBuffer().getStoppedChangingDelay())

0 commit comments

Comments
 (0)