ChatGPT解决这个技术问题 Extra ChatGPT

How to avoid the spell check on string in Pycharm

Where is the option to disable the spell check on the strings for the PyCharm IDE? I hate the jagged line under my comments and strings.

@Close Voters: I see 2 of you suggest moving this to SU. Questions about programming tools are on-topic for SO, so I disagree with these particular close votes.
In case if this is not the spell checker -- please show a screenshot with some example code.

d
daaawx

Go to File -> Settings -> Editor -> Inspections. Expand the list under Spelling in the middle window and uncheck the option Typo.

https://i.stack.imgur.com/mPoXy.png

However, practically most of the jagged line is caused by violations of the PEP 8 coding style. If you would like to disable this option too, in the same window, expand the list under Python and uncheck the option PEP 8 coding style violation.


# noinspection SpellCheckingInspection
Thanks @MarkRibau. How to do it for a specific comment? There doesn't seem to be a way.
I just put that on the line above the line with the false spelling error. Does that help you?
For me there was no 'Spelling' section, it was under 'Proofreading'
@KellyBang Thanks, that seemed to be the case for me too. Maybe in the newer versions they changed the location.
M
Marc Sances

In the latest version of PyCharm it appears as ProofReading:

https://i.stack.imgur.com/8BnYC.png


u
user3105337

You can disable spellchecking for specific code section by commenting # noinspection SpellCheckingInspection above it.

See https://www.jetbrains.com/help/pycharm/spellchecking.html


For some strange reason I have to insert the directive two lines in a row for it to take effect.
B
Bakuriu

PyCharm does not check the syntax inside strings and comments. It checks spelling.

You can find the settings of the spell-checker under the Settings... page. There is a Spelling page inside Project Settings. Inside this page, at the bottom of the Dictionaries tab you can enable/disable dictionaries. If you don't want spell checking simply disable all of them.

Note that it is possible to add custom words in the spell checker, or, if you already have a dictionary on your computer, you can add it. This can turn out useful if you want to spell check different languages (for example Italian).

In particular if you are using a Linux system and you have installed the Italian language pack, you probably have the Italian dictionary under: /usr/share/dict/italian. You can add the /usr/share/dict directory to the directories searched for dictionaries and enable the italian dictionary.

It seems like PyCharm only checks files with the .dic extension. If you want to use /usr/share/dict/italian you should probably either copy it into an other directory renaming it italian.dic or you could create a symbolic link.


J
Jakub Rakus

In my opinion the best option is to disable typo checks only for code. This way green lines under variable/method/class names and strings disappear, but PyCharm still controls comments to avoid misspellings, so You have both nice compact code and fully understandable docs.

I don't exactly know since which PyCharm version this option is accessible, but for sure in revision 2020.2 if You highlight a Typo in Settings > Editor > Inspections > Proofreading there are three additional options in the right panel - just uncheck Process code.

https://i.stack.imgur.com/RKfn2.png


B
Brndn

In the newer version of PyCharm, go to Preferences -> Editor -> Inspections -> Spelling.


v
valex

You can also add particular typo word to PyCharm dictionary by pressing Alt + Enter this word and select Save [typo word] to dictionary. Sometimes this is best choice for me.


A
Azamat_yamin

I found how to disable typos only in string literals in official documentation by disabling process literals, but it doesn't work for me (maybe it's a bug, that will be fixed in the future).

Settings->Proofreading->Typo


l
lexnn

For single line you can use the # noqa at the end of the line and it will suppress spelling inspections (the squiggly green line).

GOOFY_API_USERNAME_THING = "LAksdfallae@#lkdaslekserlse#lsese" # noqa

I'm using PyCharm 2021.3.2