# Grammar

> **TL;DR**
> Configure: `Settings | Editor | Natural Languages | Grammar and Style`
>
>
>
> Inspection: `Settings | Editor | Inspections | Proofreading | Grammar`

Procedure: Enable the Natural Languages plugin

This functionality relies on the [Natural Languages](https://plugins.jetbrains.com/plugin/12175-grazie-lite)  plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Natural Languages plugin, and select the checkbox next to the plugin name.

IntelliJ IDEA checks the grammar in text files, such as your project's `README.md`. You can also [configure it](#scope) 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 support for the English language and suggests adding support for other languages that it detects. For more information about supported languages and how to add them, refer to [Natural languages](proofreading.html).

IntelliJ IDEA checks grammar using the Grammar inspection.  Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open 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.

Procedure: Fix grammar mistakes

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

2. Press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) or click ![the yellow bulb icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.codeInsight.intentionBulb.svg) to the left of the caret to show the [available actions](null).

3. Select the proper fix from the list of suggestions.

![Intention action to fix the mistake](https://resources.jetbrains.com.cn/help/img/idea/2026.2/grazie-intention-fix.png)

Besides applying the fix, you can either [disable the rule](#rules) that triggered the inspection or add the detected phrase as an [exception](#exceptions).

## 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.

Procedure: Configure where to check grammar

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Natural Languages | Grammar and Style`.

2. 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.

| Option | Description |
| --- | --- |
| String literals | Check grammar in string literals. |
| Comments | Check grammar in generic line and block comments. |
| Documentation | Check grammar in embedded code documentation, such as JavaDoc comments. |
| Commit messages |  Check grammar in commit messages for the [configured VCS](version-control-integration.html). If you enable this, IntelliJ IDEA adds the corresponding inspection tool to the `.idea/vcs.xml` configuration file.  |

## Grammar rules

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](#fix)  or in the settings.

![Intention action to disable the rule](https://resources.jetbrains.com.cn/help/img/idea/2026.2/grazie-intention-disable-rule.png)

Procedure: Configure the set of rules

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Natural Languages | Grammar and Style`.

2. On the  Rules  tab, expand the language node and select the rules against which you want to check your text.

3. In the Other rules section at the bottom of the dialog, enable the rules you want to use.

Note that Machine Learning rules require the connection to the [cloud](proofreading.html#local-vs-cloud).

4. If your IDE is [connected to Writing
Assistance Cloud](proofreading.html#local-vs-cloud), you can configure rules per domain.

From the Domain list, select the context for which you want to configure rules, for example, commit messages or code comments. After that, in the General  section, enable the rules that you want to apply to the selected context.

Some local and cloud-based rules may overlap. In such cases, enabling a cloud-based rule also enables its associated local rule.

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

![Configuring writing style per domain](https://resources.jetbrains.com.cn/help/img/idea/2026.2/grammar_rules_per_domain.png)

Procedure: Automatically fix simple issues

There are certain mistakes that are trivial enough to fix them automatically. For example, you can specify your preferred dash style and be sure that the IDE will convert any dash or hyphen you use to the proper one for you.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Natural Language`.

2. Select Automatically fix simple issues as you type (e.g., convert hyphens to dashes).

## Exceptions

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    `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS))  menu.

![Intention action to add an exception](https://resources.jetbrains.com.cn/help/img/idea/2026.2/grazie-intention-exception.png)

Procedure: Review all added exceptions

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) or choose `File | Settings` (Windows and Linux) or `IntelliJ IDEA | Preferences` (macOS) from the menu  , then choose `Editor | Natural Languages | Grammar and Style` on the left.

2. On the  Exceptions  tab, you can see the list of words and phrases added as exceptions. Remove an exception by selecting it and clicking ![the Remove button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.remove.svg) .

