porcupine icon indicating copy to clipboard operation
porcupine copied to clipboard

plugin idea: spell checker

Open Akuli opened this issue 4 years ago • 4 comments

Akuli avatar Aug 13 '20 20:08 Akuli

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

Akuli avatar Aug 15 '20 17:08 Akuli

need to be able to spell check wordssmashedtogether, as in gettext.bindtextdomain

Akuli avatar Aug 19 '20 10:08 Akuli

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 as ch 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

Akuli avatar Aug 19 '20 14:08 Akuli

codespell looks promising

Akuli avatar Nov 09 '21 10:11 Akuli

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.

benjamin-kirkbride avatar Jul 02 '23 15:07 benjamin-kirkbride

@taahol did some spell checker experiments at some point, but I think I never got around to trying his branch or something like that.

Akuli avatar Jul 02 '23 17:07 Akuli