streetsidesoftware / vscode-spell-checker

A simple source code spell checker for code
https://streetsidesoftware.github.io/vscode-spell-checker/
Other
1.43k stars 128 forks source link

Detect common misspelled words like "calender" and fix. #706

Open kshetline opened 3 years ago

kshetline commented 3 years ago

The proper spelling "calendar" is also accepted, but since "calender" is a common misspelling, and it should definitely be disallowed.

I tried to use the various "Remove Words" commands (global, workspace, and folder) and wasn't able to remove "calender".

I've double checked my workspace and user settings.json, and I do not see the misspelling added there. I tried the deliberate misspelling "calendor", and that gets flagged as it should.

image

I'm using VSCode 1.53.2. The Code Spell Checker version is 1.10.2. I'm using VSCode with macOS 11.2.1.

Jason3S commented 3 years ago

Thank you for bring this up since it is related to an enhancement, the ability to detect and suggest replacements for commonly misused words.

Calender (see Wikipedia) is a great example, but unless you are in the manufacturing industry, it is most likely not the one you want. "Incase" is another example, where "in case" or "encase" are what was intended.

To make the spell checker reject "calender" in the future, you need to tell it to forbid it by adding it to the flagWords list:

Go to Settings -> spell flag words and add "calender".

image

rustonaut commented 3 years ago

Same for "releses".

Through that isn't even an English work as far as I can tell?! (It's a Galician word so it might appear in some of the default dictionaries, maybe?).

Either way I'm wondering if it makes sense to have some "default" flagged word list, or at least allow disabling some of the default dictionaries.

I personally would prefer if by default anything but the human and programming language specific dictionary are disabled but if you have a misspelled work which is in another of the current "default" dictionaries (e.g. companies, django) the spell checker context menu shows "valid in dictionary: " or similar with a option to enable that dictionary (through still having the "Add to User Dict" option).

But I guess that would be quite a bit of additional work. So just a random idea I want to note in this issue, not even a feature request :wink:

BenC14 commented 3 years ago

Same for "releses".

Through that isn't even an English work as far as I can tell?! (It's a Galician word so it might appear in some of the default dictionaries, maybe?).

Either way I'm wondering if it makes sense to have some "default" flagged word list, or at least allow disabling some of the default dictionaries.

I personally would prefer if by default anything but the human and programming language specific dictionary are disabled but if you have a misspelled work which is in another of the current "default" dictionaries (e.g. companies, django) the spell checker context menu shows "valid in dictionary: " or similar with a option to enable that dictionary (through still having the "Add to User Dict" option).

But I guess that would be quite a bit of additional work. So just a random idea I want to note in this issue, not even a feature request 😉

Yeah agreed, it would be super helpful to:

  1. Have a debugging tool that would tell you which dictionary matched your incorrect word
  2. Have the ability to quickly disable default dictionaries
  3. Have an easy shortcut to mark a word as incorrect for future occurrences.

for those wondering I am here because apparently handels is a word 🤦‍♂️

Jason3S commented 3 years ago

Yeah agreed, it would be super helpful to:

  1. Have a debugging tool that would tell you which dictionary matched your incorrect word
  2. Have the ability to quickly disable default dictionaries
  3. Have an easy shortcut to mark a word as incorrect for future occurrences.

for those wondering I am here because apparently handels is a word 🤦‍♂️

@BenC14, I'm guessing you are most likely using Python, CPP or have allowCompoundWords turned on.

allowCompoundWords is a source of heartache. It was intended to reduce the number of false positives. But is a source of many false negatives. Your example of handels is one of them:

image

The + is where the words are glued together.

To turn off allowCompoundWords, the following VS Code setting will work (See #383):

    "cSpell.languageSettings": [
        {
            "languageId": "*",
            "allowCompoundWords": false
        }
    ]

handel is not in any of the dictionaries.

To find out use:

npx cspell trace  handels

image

If you are using a language where allowCompoundWords is turned on by default:

npx cspell trace --languageId=cpp handels 

image