Python 如何避免 Pycharm 中的字符串拼写检查

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23383554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 02:53:42  来源:igfitidea点击:

How to avoid the spell check on string in Pycharm

pythonsyntaxpycharm

提问by StefanoG_ITA

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.

哪里有禁用 PyCharm IDE 字符串拼写检查的选项?我讨厌我的评论和字符串下的锯齿线。

回答by Bakuriu

PyCharm does notcheck the syntaxinside strings and comments. It checks spelling.

PyCharm并没有检查语法中的字符串和评论。它检查拼写

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

您可以在“设置...”页面下找到拼写检查器的设置Project Settings 中有一个Spelling页面。在此页面内,在“词典”选项卡底部,您可以启用/禁用词典。如果您不想进行拼写检查,只需禁用所有这些。

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/dictdirectory to the directories searched for dictionaries and enable the italiandictionary.

特别是如果您使用的是 Linux 系统并且您已经安装了意大利语语言包,那么您可能在以下位置拥有意大利语词典:/usr/share/dict/italian。您可以将该/usr/share/dict目录添加到搜索字典的目录中并启用该italian字典。



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

似乎 PyCharm 只检查带有.dic扩展名的文件。如果您想使用,/usr/share/dict/italian您可能应该将它复制到另一个目录中重命名它,italian.dic或者您可以创建一个符号链接。

回答by Than Skourtan

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

File -> Settings -> Editor -> Inspections。展开Spelling中间窗口下方的列表并取消选中该选项Typo

enter image description here

在此处输入图片说明

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 Pythonand uncheck the option PEP 8 coding style violation.

然而,实际上大部分锯齿线是由违反PEP 8 编码风格引起的。如果您也想禁用此选项,请在同一窗口中,展开下面的列表Python并取消选中该选项PEP 8 coding style violation

回答by 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.

您还可以通过按 Alt + Enter this word 并选择 将特定的错字词添加到 PyCharm 字典Save [typo word] to dictionary。有时这对我来说是最好的选择。

回答by Brndn

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

在较新版本的 PyCharm 中,转到首选项 -> 编辑器 -> 检查 -> 拼写。