By default, IntelliJ IDEA 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, JavaDocs, and even your commit messages. It highlights mistakes related to morphology, punctuation, the overall structure, and style.
By default, IntelliJ IDEA includes English language support and suggests adding another language if it detects one. For information about supported languages and how to add them, see Proofreading.
IntelliJ IDEA checks grammar using the Grammar inspection. In the Settings/Preferences dialog Ctrl+Alt+S, select . 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 Fix and choose the proper fix from the list of suggestions.
Scope of grammar checks
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 Java files, and disable grammar checks for YAML and JSON.
Configure where to check grammar
Check grammar in string literals.
Check grammar in generic line and block comments.
Check grammar in embedded code documentation, such as JavaDoc comments.
Check grammar in commit messages for the configured VCS. If you enable this, IntelliJ IDEA adds the corresponding inspection tool to the .idea/vcs.xml configuration file.
IntelliJ IDEA 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.
Configure the set of rules
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
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.