icewolfz / jiMUD

MUD client for ShadowMUD.com using electron
http://www.shadowmud.com
7 stars 0 forks source link

Code editor: spell checker improvements #205

Open icewolfz opened 1 year ago

icewolfz commented 1 year ago

A basic spell checking system has been added, it will supply a context menu of suggested words as well as highlight spelling errors as text changed but it lacks on load or whole document spell checking.

To correctly implement whole document spellchecking on load the current system will need to be converted to a web work to prevent thread blocking as spellchecking could take a lot of time based on document length, also maybe convert to a monaco editor server if can figure out how but so far i haven't found any good examples of that which is why until now i have been unable to add spell checking

The current systems seems to be working outside of whole document checking or any large blocks of text

Issues to figure out: how to access webframe from web worker as it contains the spell checking functions

spellcheck: text, returns markers of misspelled words

icewolfz commented 1 year ago

Short term solution is to pass the word from worker to main, check spelling, and return true/false not sure how slow this would be

icewolfz commented 1 year ago

Supports whole document checking but limits to 100 spelling errors, need to figure out some way to trigger whole document retest if at limit maybe, also will not spell check lines over 1000 characters for performance, not perfect and may be slow

icewolfz commented 1 year ago

Add system to ignore words/add new words

icewolfz commented 1 year ago

there are 2 possible solutions, use the electron add to dictionary system or create a custom array for code editor only and just keep it in the options and do if(options.words.indexOf('word') !== -1) skip

if using electron have to be careful as nay added word will also add to os dictionary for mac and windows https://github.com/electron/electron/blob/main/docs/api/session.md#sesaddwordtospellcheckerdictionaryword

icewolfz commented 1 year ago

Another option is to use an system like find where it search each spelling error out one at a time with a shortcut for a find next spelling error or something

icewolfz commented 1 year ago

System now supports a basic custom dictionary as well as adding to global dictionary, need to create some interface in prefs dialog or a new dialog to manage both dictionaries

Rethink ignore feature, maybe do it per document and when document closed the ignore list is removed instead of the current global ignore system Add an option to clear ignore disctionary

icewolfz commented 1 year ago

b6184143f2c76fa9509b3eca5a6f67e02f70db53 adds per open file and also leaves the global ignore still need to add a way to clear ignore with out closing document/editor, maybe a menu item in edit > clear document ignored, clear global ignored

icewolfz commented 11 months ago

The spell checker markers are not always updated when a word is corrected or text is deleted