Markdown-Edit
Markdown-Edit copied to clipboard
Pluggable spell checker
If at all possible, I'd like to have the same spell checking experience (incl. my custom words) as in MS Office. Or Firefox. Or Chrome. Those all have their own dictionaries and I'd rather not to maintain the fourth one just for MDE.
Do you want the Word/Chrome/Firefox interface or just incorporation of the dictionaries into MDE?
Dictionaries are the main thing for me.
Will the intended implementation also allow me to use my native language, which is not one of those seven listed?
First I have to figure out if I can incorporate them :smile:
MS Office, Firefox and Chrome dont' support pluggable spell checkers. The reason I suspect is that there is no common standard that they (are willing) to share. MDE uses Hunspell. You might check if there is a Hunspell dictionary for your native language available. I could include it then.
Isn't Firefox using Hunspell as well? I thought so.
As some of us crazy Brit's enjoy our spellings such as "Armour", I downloaded a seemingly active and frequently updated Hunspell dictionary for en-GB from here, and dropped it into MDE's SpellCheck\Dictionaries folder. One restart of MDE later and I was happily using the new dictionary - seems to be working fine. So at least downloading a Hunspell dictionary in your own language should work without a hitch.
With that said however, it would be nice if MDE allowed you to configure the location of the custom dictionary file. I tend to configure any application that uses these to use the same file (as generally your custom dictionary is just a wordlist in plain text format), that way I don't have to add the same unrecognised words over and over again to different applications. Perhaps this is something you would consider adding, even as a non-UI-go-play-with-the-JSON type setting. Or, I could try and create a PR for it myself it would be worth including? I had a quick a poke in SpellingService.cs
and that's easy enough to adjust, once I work out how your setting system works.
Interesting idea about assignable custom dictionary file. Easy to do also.
I've looked into shared spelling dictionaries and the story is sad. Everyone seems to cook up they're own system (as I did). Spellchecking really needs to be part of the operating system IMHO. (There is an OS service but I can't find anyone using it).
MDE doesn't require FF or MS Office to be installed. Taking dependencies on them would be a serious maintenance headache. Perhaps an import utility?
How about a configurable option with path where the dictionary can be found? I'd set it to something like C:\path\to\my\firefox\profile\dictionaries\en_US.ext
. No UI needed, this can be an advanced config option via the config file only.
Also an interesting idea. The spellcheck dictionary selection in the UI would have to be disabled when this option is set, but it's a minor change.
What are your thoughts about an assignable custom dictionary? Only problem I see is that the other program may have it locked when it's running.
Hm didn't think about file locking, that might be an issue. Can think of a couple of approaches but no perfect one..
In regards to file locking, why worry about it? If a user takes this sort of approach where they want to share this sort of information with another application, you can probably assume they are power users and would understand that there is the potential for issues. You could always try waiting a second or two then retrying the operation, but if an application is so badly behaved as to keep a lock on that file always - not a lot you can do. And unless you're magically adding words to in two applications at the same time the chances of both of you trying to open the file for writing at the same time ought to be slim.
Some programs behave poorly by not closing file handles or leaving them open while running. You're right in that it's not an issue most of the time. Unfortunately, I as the programmer have to think and respond to these edge cases. Probably just have to pop up message saying sorry, can't do that right now will do.
Yes, but as you seemed to be doing that already elsewhere in you code when exception are raised in regards to file I/O, I assumed you would be doing that without explicitly mentioning it ;) You can't handle every conceivable scenario, and often it isn't worth the time trying to come up with a fancy solution for some rare edge case.
Agreed. As long as it doesn't crash I don't think anyone will mind.
Is it possible to attach the dictionary for translation of words/phrases?
I don't understand what you're asking. Can you explain a bit more?
I wish to translate text in editor and have an ability to translate selected word or phrase into different language by right-click menu. Now I can correct misspelled words with typos only.
Got it. Thanks.