atom / node-spellchecker

SpellChecker Node Module
http://atom.github.io/node-spellchecker
MIT License
299 stars 108 forks source link

Add a 'remove' method to allow testing on platforms with persistent local dictionaries #22

Open hollandjg opened 9 years ago

hollandjg commented 9 years ago

The tests (in spec/) of the .add method can only be run once on Mac OSX, which has a persistent local dictionary. On the second run, the word 'wwoorrdd' is in the dictionary, and the test no longer produces the correct output. The dictionary has to be edited by hand to remove this.

The solution may be to have a remove method which is used as part of the test teardown for tests of the 'add' function. This will leave the users' machine in a state where 'wwoorrdd' is not in the local dictionary, and the tests can be run as often as you like.

beshur commented 8 years ago

Hi. I see there is an implementation for Mac in this module: https://github.com/atom/node-spellchecker/blob/aed067edabd34d88b699e9cc3a6d4244c832782e/src/spellchecker_mac.mm#L102

Upon reviewing the Windows iSpellchecker API, I found another - iSpellchecker2 API with the only method 'Remove': https://msdn.microsoft.com/en-us/library/windows/desktop/mt422900(v=vs.85).aspx iSpellchecker2 appeared in Windows 10 (according to some site: https://naughter.wordpress.com/2015/05/24/changes-in-the-windows-10-sdk-compared-to-windows-8-1-part-two/)

There is hacky way to remove words from user dictionary on Windows 8+: just removing them from %AppData%/Microsoft/Spelling//default.dic files (which are modified). What do you think about this way?

cc @zcbenz

matatk commented 7 years ago

I wonder if an alternative method to this would be to have an option to simply ignore any persistent local dictionary? This would have two effects:

matthew-a-thomas commented 5 years ago

+1 for option to ignore local dictionaries.

Automated tests are not consistent without it.