Pycharm typo in word что это

Обновлено: 06.07.2024

PyCharm checks the grammar of text files, such as your project's README.md . You can also configure it to check various textual elements in your source code: string literals, comments, and even your commit messages. It highlights mistakes related to morphology, punctuation, the overall structure, and style.

By default, PyCharm includes English language support and suggests adding another language if it detects one. For information about supported languages and how to add them, see Natural languages.

PyCharm checks grammar using the Grammar inspection. Press Ctrl+Alt+S to open the IDE settings and select Editor | Inspections . The Grammar inspection is under Proofreading . By default, it is set to the lowest severity level (subtle underline) and is applied in all scopes.

Fix grammar mistakes

Place the caret at a word highlighted by the Grammar inspection.

Click or press Alt+Enter to show the available intention actions.

Select the proper fix from the list of suggestions.

Besides applying the fix, you can either disable the rule that triggered the inspection or add the detected phrase as an exception.

Scope of grammar checks

Ensure that the Grazie plugin is installed and enabled

You can configure the types of files and specific code constructs where you want to check grammar. For example, you can enable grammar checks in Markdown files, in strings and comments of Python files, and disable grammar checks for YAML and JSON.

Configure where to check grammar

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Grammar .

On the Scope tab, select the code constructs where you want to check grammar and the types of files for which you want to enable grammar checks.

Check grammar in string literals.

Check grammar in generic line and block comments.

Check grammar in embedded code documentation.

Check grammar in commit messages for the configured VCS. If you enable this, PyCharm adds the corresponding inspection tool to the .idea/vcs.xml configuration file.

Grammar rules

Ensure that the Grazie plugin is installed and enabled

PyCharm checks grammar against a set of rules defined for a language. For example, in English, there are rules on how to properly use articles, commas, and past tense forms, stylistic hints for creative and plain writing, common typos and words that are commonly confused, proper collocations, and many more.

Most of these rules are enabled by default and detect definite mistakes. However, some of them are suggestions that you may not agree with or not care about. In this case, you can disable a specific rule from the intention action or in the settings.

Intention action to disable the rule

Configure the set of rules

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Grammar .

On the Rules tab, select the rules against which you want to check your text.

Use the search field to filter the list of rules with a keyword, such as article or comma .

Exceptions

Ensure that the Grazie plugin is installed and enabled

Exceptions are words and phrases that you want to be always considered correct. If some rule triggers a mistake in a phrase that you do not want to highlight, you do not need to disable this rule, because then it will not be triggered in other places where the rule is valid. In this case, you can add the phrase as an exception using the intention action.

Intention action to add an exception

Review all added exceptions

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Grammar .

On the Exceptions tab, you can see the list of words and phrases added as exceptions. Remove an exception by selecting it and clicking .

PyCharm helps you make sure that all your source code, including variable names, textual strings, comments, literals, and commit messages, is spelt correctly. For this purpose, PyCharm provides a dedicated Typo inspection which is enabled by default.

In textual strings and comments, only the spelling of this particular word at caret changes. Where the Rename refactoring is available, the inspection suggests to rename all occurrences of a symbol.

The Typo inspection detects and highlights words not included in any dictionary. You can either correct the spelling or accept the word as correct. Disable the Typo inspection if you want to ignore all spelling mistakes. For more information, see Disable spellchecking.

Correct a misspelled word

Place the caret at any word highlighted by the Typo inspection.

Click or press Alt+Enter to show the available intention actions.

Select one of the suggested fixes from the list.

To jump to the next misspelled word, press F2 .

Accept a misspelled word

Place the caret at a word highlighted by the Typo inspection.

Click or press Alt+Enter to show the available intention actions.

Select the Save to dictionary action to add the word to the user's dictionary and skip it in the future.

If you have added the word by mistake, press Ctrl+Z to remove it from the dictionary

By default, PyCharm saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project. For more information, see Select the default dictionary for saving words.

Configure the Typo inspection

By default, the Typo inspection checks all text including code elements, string literals, and comments in all scopes.

Press Ctrl+Alt+S to open the IDE settings and select Editor | Inspections .

Expand the Proofreading node and click Typo in the central pane.

In the right-hand pane, configure the Typo inspection:

Specify the severity level and the scope in which to apply this level.

For example, if you want typos to stand out more, select Error or Warning to highlight typos similar to syntax errors or warnings in your code.

Specify the type of content to check:

Process code : check various code elements.

Process literals : check text inside string literals.

Process comments : check text inside comments.

Disable spellchecking

Press Ctrl+Alt+S to open the IDE settings and select Editor | Inspections .

Clear the checkbox next to the Typo inspection.

Dictionaries

PyCharm includes bundled dictionaries for all configured languages. You cannot modify them directly but you can extend the spellchecker in other ways:

Save words to a built-in global or project dictionary.

Add plain-text files with the .dic extension that contain lists of words.

If you have the Hunspell plugin installed and enabled, you can add Hunspell dictionaries, which comprise of two files: the DIC file that contains a list of words with the applicable modification rules and the AFF file that lists prefixes and suffixes regulated by a specific modification rule. For example, en_GB.dic and en_GB.aff .

Configure the spellchecker dictionaries

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Spelling .

Configure the list of custom dictionaries:

To add a new custom dictionary to the list, click or press Alt+Insert and specify the location of the required file.

To edit the contents of a custom dictionary in PyCharm, select it and click or press Enter . The corresponding file will open in a new editor tab.

To remove a custom dictionary from the list, select it and click or press Alt+Delete .

Select the default dictionary for saving words

By default, PyCharm saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project.

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Spelling .

Select either the built-in project-level or application-level dictionary or disable the option to prompt you every time you save a word.

Add accepted words manually

Press Ctrl+Alt+S to open the IDE settings and select Editor | Natural Languages | Spelling .

Add words to the Accepted words list. PyCharm adds manually accepted words to the project-level dictionary.

You can't add words that are already present in one of the dictionaries and mixed-case words, such as CamelCase and snake_case .

The Accepted words list also contains words that you saved to either the built-in global or project dictionary. Although it does not contain words added to the project-level dictionary by other users and words from other custom dictionaries, the Typo inspection will not highlight them.

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.


9,851 7 7 gold badges 53 53 silver badges 75 75 bronze badges 1,059 2 2 gold badges 7 7 silver badges 3 3 bronze badges @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.

7 Answers 7

Go to File -> Settings -> Editor -> Inspections . Expand the list under Spelling in the middle window and uncheck the option 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 Python and uncheck the option PEP 8 coding style violation .

2,538 2 2 gold badges 13 13 silver badges 15 15 bronze badges 1,531 1 1 gold badge 12 12 silver badges 6 6 bronze badges I just put that on the line above the line with the false spelling error. Does that help you? @KellyBang Thanks, that seemed to be the case for me too. Maybe in the newer versions they changed the location.

In the latest version of PyCharm it appears as ProofReading:

ProofReading


1,725 1 1 gold badge 16 16 silver badges 26 26 bronze badges


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.

I use Pycharm 2016.1.4 (latest version at the moment) and it has a small box on the right top corner of the window (a checkbox if everything is correct).

enter image description here

When you click on it, it tells you some information about warnings/errors/typos.

Now that I understood that I have some problems, I would try to fix them. It is easy to see where errors and warnings are (their lines are highlighted on the right side of the scroll). But how can I quickly (without looking through whole text for a curly underline) identify positions of the typos?

191k 135 135 gold badges 657 657 silver badges 722 722 bronze badges @greenshade thank you for a suggestion, but no. If it is relevant, I am on mac. fn+shift+f2 takes me to the line with errors or typos on mac

2 Answers 2

PyCharm tells you the type of the problem and it's location by tiny lines on the scroll bar of that file. Different colours mean different types of errors.

Red lines are breaking errors, yellow ones are suggestions. You can click on those little lines to be taken to the correct place.

This does not show the location of typos, that is true. But I found a workaround by going Preferences -> Inspections and turning the Spelling -> Typo severity to Weak warning in which case typos are properly displayed and you can use hotkeys for Next highlighted error and Previous highlighted error which are shown in your Preferences -> Keymap panel. For me, those are F2 and Shift + F2, so I have to use Fn + F2 or Fn + Shift + F2 because I'm on a Macbook.

But I most often use the Code -> Inspect code option, because this searches your whole Project/Module for errors, warnings and even typos and shows them in a really convenient way in a different panel, where you can also click on the errors to be taken to the correct place. Also it shows the problem synopsis and a possible resolution.

Читайте также: