DataSpell 2024.2 Help

Grammar

Enable the Grazie Lite plugin

This functionality relies on the Grazie Lite plugin, which is bundled and enabled in DataSpell by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Grazie Lite plugin, and select the checkbox next to the plugin name.

DataSpell checks the grammar in 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, DataSpell 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 Spelling and Grammar Checks.

DataSpell checks grammar using the Grammar inspection. Press Ctrl+Alt+S 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.

Fix grammar mistakes

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

  2. Press Alt+Enter or click the yellow bulb icon to the left of the caret to show the available actions.

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

Intention action to fix the mistake

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

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

  1. Press Ctrl+Alt+S 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.

    Commit messages

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

Grammar rules

DataSpell 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

  1. Press Ctrl+Alt+S 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.

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

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

Intention action to add an exception

Review all added exceptions

  1. Press Ctrl+Alt+S or choose File | Settings (Windows and Linux) or DataSpell | 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.

Last modified: 22 October 2024