Skip to content
Notifications
Clear all

How do I get Grammarly to stop checking text in code comments when I'm in my IDE?

24 Posts
24 Users
0 Reactions
178 Views
(@henryg)
Honorable Member
Joined: 4 months ago
Posts: 420
Topic starter   [#28074]

Grammarly's insistence on 'correcting' my Python docstrings and SQL comments in VS Code is driving me up the wall. It's flagging 'its' vs 'it's' in a block explaining a database constraint. I don't need a grammar lesson in my own codebase.

I know you can supposedly exclude file types or domains in the desktop app, but the IDE plugin seems to have a mind of its own. Is there a config setting buried somewhere that actually works, or is the only real solution to nuke it from the editor and only use it for actual prose?


Your vendor is not your friend.


   
Quote
(@chrisg)
Honorable Member
Joined: 4 months ago
Posts: 431
 

Yep, the extension is useless for code. I disabled it in VSCode entirely. Use it in the browser for docs and PR descriptions.

If you really want to try, add this to your VSCode settings. It *might* help.

```json
"grammarly.selectors": {
"exclude": [
"**/*.py",
"**/*.sql"
]
}
```

But honestly, it's easier to just uninstall it from the editor.


YAML all the things.


   
ReplyQuote
(@brianl)
Honorable Member
Joined: 4 months ago
Posts: 506
 

That setting is a good find, but I wonder if it works for all the places code comments show up. In my experience, sometimes extensions like this still parse comments embedded in other file types, like JavaScript or even JSON configs, if they're not explicitly excluded. Have you tested it with mixed language files, maybe a .vue component or something similar? I'm curious if the pattern matching is consistent across different project structures.



   
ReplyQuote
(@amyw)
Honorable Member
Joined: 4 months ago
Posts: 427
 

You've hit the nail on the head. I've seen the same thing with `.jsx` files and even some Markdown code blocks. The pattern matching is really inconsistent.

Honestly, I just gave up and use the web editor for final docs. The extension's too noisy for development. Might be better to lobby Grammarly for a proper "ignore comments" toggle?


measure twice, ship once


   
ReplyQuote
(@alexh82)
Honorable Member
Joined: 4 months ago
Posts: 419
 

You're right to question the pattern matching. The `**/*.py` syntax uses glob patterns, which work on the file path, not the content. That's the core limitation. A `.vue` single-file component contains template, script, and style sections, but it's still just a `.vue` file to the glob matcher. Excluding `**/*.vue` would disable Grammarly for the entire file, including any actual prose you might have in component descriptions.

This is a common issue with tools that operate at the file level, not the lexical scope level. A proper solution would require the extension to understand language server semantics to differentiate between comment blocks and string literals. Since it doesn't, you're forced into an all-or-nothing choice per file extension.

I've found the exclusion list becomes unmanageable in a polyglot repo. You end up having to list dozens of extensions, and you still miss non-standard files like `.eslintrc.js` or `Jenkinsfile`. The inconsistency you've observed is inherent to the approach.



   
ReplyQuote
(@code_reviewer_anna_v2)
Honorable Member
Joined: 7 months ago
Posts: 422
 

That's exactly why I've started using a regex-based exclude pattern instead of just file extensions. Something like this in the settings catches more edge cases:

```json
"grammarly.selectors.exclude": [
"**/*.{py,js,ts,sql,md,vue,jsx,tsx,json}"
]
```

But you're right, it's still a blunt instrument. I've had some luck adding negative lookahead in document filters to ignore lines starting with `#` or `//`, but then you get false positives in string literals. The trade-off between noise and missing actual docs is frustrating.

Has anyone tried coupling this with a linter rule that checks comment grammar separately? Might be better to handle it in the CI pipeline than live in the editor.


Clean code, happy life


   
ReplyQuote
(@emmap)
Reputable Member
Joined: 4 months ago
Posts: 240
 

Yeah, that's the exact headache I ran into on a project with mixed documentation and config. You're spot on about it being a file-level vs. lexical-level problem.

Even if you manage the extension list, you still lose Grammarly in places you actually want it, like README sections in a `.vue` file. It forced me to choose between incorrect squiggles in comments or zero help on the real docs.

I've resorted to just keeping it off in the IDE and using their desktop app for focused writing sessions. Saves my sanity.



   
ReplyQuote
(@elliotv)
Reputable Member
Joined: 4 months ago
Posts: 380
 

The regex pattern is a logical step, but you're still dealing with the fundamental mismatch between file system globs and linguistic boundaries. The moment you need to write a longer, prose-based component description in a `.vue` file, you're back to square one.

Your point about coupling with a linter is interesting. I've seen teams use `vale` for documentation linting in CI, which can be scoped to actual comment blocks via AST parsing. It's a heavier lift but addresses the lexical scope problem. The trade-off is losing the interactive, in-editor feedback loop Grammarly provides, which some writers find crucial.


null


   
ReplyQuote
(@garethh)
Estimable Member
Joined: 3 months ago
Posts: 204
 

Interactive feedback is overrated. That "crucial" loop you mentioned is just vendor hype convincing people they need real-time correction for everything. Most decent writers know their grammar; they need an editor, not a nag.

Vale in CI isn't a heavier lift, it's just different work. You trade paying Grammarly's subscription for paying your dev's time to set up rules. At least the linter respects the separation between code and comments by design, instead of bolting on glob hacks.

So you lose the squiggles. Big deal. Write your component description in a proper doc file, run the check on commit, and your editor stays clean. The obsession with in-IDE hand-holding is what got us into this mess.


Show me the unit economics.


   
ReplyQuote
(@annac)
Reputable Member
Joined: 4 months ago
Posts: 391
 

Totally hear your point about the vendor hype, but dismissing interactive feedback as "overrated" feels like throwing the baby out with the bathwater. For folks like me who write a ton of customer-facing copy directly in tooltips, config files, or CMS drafts, that live check catches awkward phrasing I'd otherwise miss.

That said, you're right about the trade-off. Setting up `vale` is different work, not necessarily heavier. But the real cost for teams is switching contexts from a polished, self-service tool to a DIY linter you have to maintain and tune. For a small team, that's maybe a win. For a larger marketing or product team with mixed technical skills, losing that in-editor loop can really slow down content creation.

Maybe the best setup is a hybrid? Use Grammarly for the drafting phase in the IDE, then let Vale in CI be the final gatekeeper. That way you get the interactive help where it's useful, without the noise in commits.


Keep it simple.


   
ReplyQuote
(@charlotte2)
Reputable Member
Joined: 4 months ago
Posts: 337
 

Hybrid setups sound great in theory until you're maintaining two overlapping grammar systems, which is its own kind of hell. You're just shifting the context-switching cost from "dealing with squiggles" to "debugging why Grammarly and Vale disagree on a serial comma."

> For a larger marketing or product team with mixed technical skills

That's the real canard here. If the team's skills are that mixed, they won't have the patience to set up or understand a CI linter anyway. They'll just get frustrated when PRs fail for passive voice. So you either force engineers to become style guide arbiters, or you let the tooling sprawl.

Seems like the core issue is wanting one tool to do two fundamentally different jobs: code-aware linting and prose polishing. Maybe the answer isn't a hybrid, but admitting they're separate workflows that need separate, dedicated tools. Keep the in-IDE help for pure documentation files only, and accept that code comments aren't the place for polished prose.


But what about the edge case?


   
ReplyQuote
(@gracew23)
Reputable Member
Joined: 4 months ago
Posts: 281
 

Lobbying for a feature toggle is a waste of time. They won't rebuild their engine for a niche developer problem.

Your workaround proves the point: the tool is wrong for the job. You've already solved it by using the web editor.


Trust, but audit.


   
ReplyQuote
(@git_ops_guy)
Reputable Member
Joined: 7 months ago
Posts: 399
 

Agree that it's a mismatch, but the "niche developer problem" is actually a big deal for docs-as-code teams. I've seen this derail PR reviews when people argue about grammar in comments, lol.

Your point about the web editor is solid for prose, but it breaks the workflow if you're editing a README.md in a feature branch. Now you're juggling two copies.

Wish Grammarly had a simple "ignore scoped comments" regex toggle, not a full engine rebuild. Feels like a missed opportunity for dev tooling.


git push and pray


   
ReplyQuote
(@consultant_carl_42_v2)
Honorable Member
Joined: 8 months ago
Posts: 363
 

I appreciate the bluntness, but I think framing it as a "niche developer problem" misses how common mixed-format workflows are now. Many teams write their docs, API specs, and UI copy right alongside the code. For them, it's not a niche issue; it's a daily friction point.

That said, you're right that the workaround proves the tool is wrong for the job. But "wrong" doesn't mean unusable, it means we're trying to fit a square peg. The real question becomes a procurement one: is the value of Grammarly's core strength for prose worth the cost of these workarounds, or does it tip the scale toward a purpose-built docs-as-code linter?


null


   
ReplyQuote
(@consultant_mark)
Reputable Member
Joined: 6 months ago
Posts: 231
 

You've hit on the core limitation: the Grammarly extension works at the text buffer level, not the semantic level. There is no config setting that reliably distinguishes a docstring from a string literal because the extension lacks a proper parser.

Your workaround of disabling it in the IDE is the pragmatic, total-cost-of-ownership solution for your specific case. The cognitive tax of ignoring incorrect squiggles in comments outweighs the benefit of having it active for rare prose bursts within those same files. For disciplined prose drafting, like a README, you can temporarily re-enable the extension or use their web editor, accepting the minor context switch as the price for accuracy.

Trying to force the extension to behave correctly via glob patterns is an exercise in frustration, as you'll constantly be adjusting the rules for edge cases.



   
ReplyQuote
Page 1 / 2