Proofreading of ReST in PyCharm

Viewed 117

I recently came across Proofreading tool in PyCharm.

In Editor | Proofreading | Grammar menu, there is a selection of file types for which the proofreading is carried out. However, the list does not contain ReST files.

Is there is way how to force PyCharm to check the ReST files as well (to check the English there)?

My intention is to use it for polishing my Sphinx documentation.

Edit:

My setting in Inspections

This is my setting in Inspections.

My setting in Proofreading

This is my setting in Proofreading.

I use PyCharm Professional 2020.3

Organization of my code is following:

main_dir
|- doc
|- code
|- examples
...

The ReST files lies in the doc directory, while main_dir is the root of the PyCharm Project.

1 Answers

The solution for this is configuring Inspections together with Proofreading.

The standard PyCharm configurations should be set to Inspect your Proofreading settings In All Scopes regardless of the file type.

Check in Settings -> Editor -> Inspections -> Proofreading.

IDE inspection screenshot

It's not entirely clear from the JetBrains guide to configure Grammar but there is a possibility reST files may be considered "Check grammar in embedded code documentation." Looking at the IDE configuration in the below screenshot:

Option Description
Comments Check grammar in generic line and block comments.
Documentation Check grammar in embedded code documentation.

IDE config proofreading screenshot

EDIT: After OP feedback.

The first edit of the question seemed to ask both about typos and grammar. So I tried this again, specifically for grammar proofreading using the example sentence "This are mistakes." (should be corrected to "these are mistakes"). It works for .py files and .txt files and PyCharm will suggest a correction but notably with different dialogue windows. Examples as follow:

For .py files

image for .py files

For .txt files

image for .txt files

The usual approach for these cases is creating a custom scope. And so I did trying several combinations like file:*.rst, or file[my_project]:docs/source/*.rst:

image for custom scope

Then adding the scope specifically to the grammar proofreading:

enter image description here

But it still doesn't work for .rst files.

For reference, there are several examples of this approach under similar circumstances, this older post, and a recent one by a JetBrains staff member.

I think this is a PyCharm bug that warrants opening a ticket on the JetBrains bug tracker.

Related