codemirror-spell-checker
codemirror-spell-checker copied to clipboard
Don't show numbers as spelling errors
This is a fix for #32. I just check whether the word matches /^[0-9]+$/
and ignore it if so.
Along the way, I cleaned up the tokenizer to use regular expressions to detect word characters. This has two advantages:
- Simpler code.
- More efficient. Old code was checking
"very long string".includes
which will check against each character individually. Regular expressions should (I think) build a map to check for matching characters. Also, regular expressions should allow us to read the entire word at once instead of character by character.
~~By the way, the checks report 'customWords' is assigned a value but never use
but this was true in the original code. I assume you were in the middle of implementing #16.~~
Thanks for making the change. One last thing—can you set up a JSFiddle to demonstrate this change?
any updates on getting this merged and released?
I couldn't figure out how to get a JSFiddle working...
At long last, here is a working CodePen: https://codepen.io/edemaine/pen/QoooOa
I had to update a few more things to get this working again:
- The existing
customWords
code was broken in the case thatcustomWords
weren't specified. -
gulp
needed an explicit (older) version to work. - Some small lint updates.
Hopefully this can now be merged. @WesCossick if you'd rather hand off maintenance, I could try.
Hey @WesCossick Can you please look into this? Thank you!