znck / grammarly

Grammarly for VS Code
https://marketplace.visualstudio.com/items?itemName=znck.grammarly
MIT License
1.64k stars 116 forks source link

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

Open windowshopr opened 2 years ago

windowshopr commented 2 years ago

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!

ainar commented 2 years ago

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.

znck commented 2 years ago

I added stale automation and went on vacation 😝

sandinak commented 2 years ago

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

ethanengland commented 1 year ago

I want this feature so bad

windowshopr commented 1 year ago

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

luerhard commented 1 year ago

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.

erlebach commented 1 year ago

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.

thangckt commented 1 year ago

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.

neuronflow commented 11 months ago

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?

alangshur commented 10 months ago

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)