New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C/C++: Some misspelled words are not detected #345
Comments
Hi, thanks for looking into this. I'm using C++ (and the official C++ extension). I didn't do any special setup of the spell checker other than which file types are checked and adding some words to the workspace dictionary (definitely not these ones, I will check). |
It is because most people while programming in c++ glue words together: |
I to do not think the way it currently works is ideal. The plan is to change C/C++ compound matching to match against noun compounds instead of compounds made up of all words. |
I am running into this issue during code reviews and it causes quite a bit of grief. Specifically, words like Many developers use a naming convention to separate individual words in an identifier name (e.g. camelCase, PascalCase, and snake_case). It would be great if the extension could take advantage of this to check for misspelled words. Unfortunately, it is difficult to predict which naming convention a developer is using. Therefore, an option to control how the extension parses compound words could work well for this issue. The option would have a checklist of common compound word naming conventions (including compound words using all lowercase letters) that the extension would know to treat as compound words. If camelCase is enabled, There's also the case where any any naming convention could be used (non-common ones). Considering something like |
I see the same with Python. For example, "singal" is not detected, presumably because it's "sing" + "al". I thought that the |
@kit1980 you are right, it is because To turn off The following will turn off compound word matching for C/C++ and Python:
|
Thanks for the fix! This should really be the default behavior IMHO (or at least the default behavior needs some case-matching refinement). Add me to the list of people who pushed code with typos because of this. |
My plan is to turn
With this definition valid words are:
The follow are some of the not allowed words:
|
Is this the reason why spellcheck-servie.mp4 |
Yes it was. Sorry for the noice. |
@PEZ, You can use the
|
Ah. sweet! |
The setting for compound words tell us that it might make misspelled words look correct. It would be nice to also tell us the setting can be disabled per language. I was getting frustrated with all the undetected typos in Markdown, like insructions, but disabling compound words for Markdown helps a lot. I'd rather have false positives (flagged correct word) than false negatives (misspelled word not flagged). Is there also a way to disable in code comments, i.e. compound words would only be allowed in code, not in natural language text? |
I continue to strongly urge not setting I think a better practice is to just add the common compound words to a custom dictionary. It is possible to define a custom compound dictionary:
dictionaryDefinitions:
- name: code-compounds
description: Custom Dictionary for compound words
path: ./compound-words.txt
addWords: true
languageSettings:
- caseSensitive: false
languageId: cpp,c,python,javascript
dictionaries:
- code-compounds
Only words with
|
Jason, thanks for the reply but I'm afraid I don't understand the approach of having to explicitly list the compound words. How would cSpell accept identifiers like |
Forget it. Senior moment: snake and camel case are not considered compound words. |
Exactly. The spell checker is able to split snake and camel case. It even will handle Using the compound syntax above the following is considered correct:
Not accepted:
|
Misspelled words which are not detected: avalible, handeled, evalulated, deciced, pressent, senting.
The text was updated successfully, but these errors were encountered: