porcupine
porcupine copied to clipboard
plugin idea: spell checker
turns out that it's hard to find a big list of english words in a text file
maybe should use this https://github.com/dwyl/english-words
can't use git submodules because the pip command in README.md doesn't understand them, and not all porcupine users have git
need to be able to spell check wordssmashedtogether, as in gettext.bindtextdomain
this will actually be really difficult for programming languages where smashing words together is a thing
I first thought of treating any 3 letters or less as a known word, so bindgittextdomain
would be valid:
-
bind
is known word -
git
is short enough, let's assume it's valid and not bother looking it up from a word list -
text
is known word -
domain
is known word
but how about something like updatechdirresults
?
-
update
is known word -
chdir
(meant to be interpreted asch
dir
, "change directory") is too long to skip, also not a valid word, so it's flagged as typo -
results
is known word
spell checking only contents of strings doesn't help:
- strings may contain function names, variable names etc (e.g. error messages and debug prints)
- wouldn't catch typos in variable names, e.g. if your whole program uses a variable named
conffig_dir
spell checking names only when defining variables or functions or classes or something else would allow using imported wordsmashedtogether amed functions, but currently there's no good way to detect that, e.g. foo = bar
in python may define a new variable or change the value of an existing variable
codespell looks promising
I use this in vscode: https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker
Uses cspell which is a js lib.
The UX of it is great, IMO we should emulate it if we decide to go further with this. IT addresses basically all of your concerns.
@taahol did some spell checker experiments at some point, but I think I never got around to trying his branch or something like that.