grammarly icon indicating copy to clipboard operation
grammarly copied to clipboard

Grammarly for VSCode - Add Option to Only Check Comments and Strings in Python Code

Open windowshopr opened this issue 2 years ago • 10 comments

I love being able to use Grammarly for VSCode, works awesome! However I do have a feature request.

It would be cool if there was a checkbox in the settings that could allow the user to ignore Python (or other languages) code, and only check grammar for comments or strings. Here's an example:

image

This is getting a grammar related red underline, but there's nothing "wrong" with it, it's just Python code. The red marks on the left nav panel of the project are annoying as well as it makes me think there's a code related error in those files when there isn't. So could there be a way in the future to ignore code and only check for grammar in the comments and strings only?

For comments, the program could just look at the first character in the current line, and if it starts with a # (in the case of Python), then check that line for grammar, and maybe check the next line to see if there's "more" comments that would feed into the previous for sentence's grammar check.

Strings are always encased in single or double quotes. Note that this part wouldn't be "perfect" because there are other uses for encasing code in single and double quotes that aren't related to strings, but it would be a HUGE help. Some strings are quite long and "client facing" so checking those for grammar related issues would be important, but not code (and really, not even comments either as those are for developers only, but it might help with creating better comments in the future).

Anyway, just thought I'd propose that. Thanks!

windowshopr avatar Jun 24 '22 06:06 windowshopr

Yes, it meets issues https://github.com/znck/grammarly/issues/17, https://github.com/znck/grammarly/issues/159, https://github.com/znck/grammarly/issues/258 and https://github.com/znck/grammarly/issues/260. I do not know why these issues have been closed, but this feature seems essential.

ainar avatar Jul 04 '22 13:07 ainar

I added stale automation and went on vacation 😝

znck avatar Jul 20 '22 19:07 znck

+1 on this .. I get peer reviewed on my comments all the time .. would LOVE to have this feature built in

sandinak avatar Sep 07 '22 18:09 sandinak

I want this feature so bad

ethanengland avatar Nov 11 '22 18:11 ethanengland

I still want this feature! Haha hopefully it gets some traction and the devs see it!

windowshopr avatar Nov 11 '22 18:11 windowshopr

It would be incredible if it were possible to define regular expressions that include/exclude specific patterns from spell-checking. That way, one could also, e.g., exclude markdown citations (starting with an @ symbol) or other special words or phrases - or only include strings and comments in a python file.

luerhard avatar Nov 15 '22 22:11 luerhard

I was about to ask for this feature but saw this thread first. I just started using your extension and love it! But immediately I wanted to check my comments in my Python code. It would be a great feature to add. +1.

erlebach avatar Mar 05 '23 16:03 erlebach

Dear all,

Is there any progress in this feature so far? Or do you know how to void grammar checks in Python code?

Thank you so much.

thangckt avatar Jun 16 '23 06:06 thangckt

Any progress? Is there a way to altogether disable the extension for Python files in the worst case?

Or just use it for a list of file endings, such as .md, .txt, .tex?

neuronflow avatar Nov 22 '23 00:11 neuronflow

Would also love to see this feature get added, or an option to ignore parts of files that match a regex (like all code blocks in markdown)

alangshur avatar Dec 01 '23 23:12 alangshur