znck / grammarly

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

Support for Jupyter notebooks #160

Open davanstrien opened 3 years ago

davanstrien commented 3 years ago

Unless I missed something, at the moment this plugin doesn't work with Jupyter notebooks opened in visual studio code. Since Jupyter notebooks often have a lot of prose it would be super useful to be able to use this plugin with Jupyter notebooks opened in visual studio code.

Badr-MOUFAD commented 2 years ago

I can't disagree with you @davanstrien!

Often, I write markdowns to explain cells of code or interpret results (especially in an academic setup). It would be so nice to add support of Grammarly when working with Jupyter notebooks in vscode.

githubpsyche commented 2 years ago

Would really really love this

jeffheaton commented 2 years ago

This seems like one of the main types of file you would want Grammarly on. smh In a pinch I can copy/paste an entire Python file to Grammarly, but all the little markdown boxes in ipynb is where it would really be nice.

githubpsyche commented 2 years ago

Think I've found something of use, at least with the pre-release version.

If I add *ipynb to the Grammarly file inclusion setting, I can get feedback on the content in my Jupyter Notebooks. This is achieved with something like the following in my settings.json file:

 "grammarly.files.include": [
        "**/*.ipynb"
    ],

There's one key limitation to the UX when I do this: Grammarly will also attempt to provide feedback on my code. Interestingly, though, when I toggle Grammarly to pause while I have a notebook's code cell active, error checking will only be disabled for my code cells -- and not my markdown cells. This doesn't seem to persist to other notebooks or after I reload my window.

Still, despite some limitations, this fix works well enough for me to derive benefit from the extension inside Jupyter Notebooks.

githubpsyche commented 2 years ago

Toggling the "Start text checking in paused state" setting seems to make this work even more cleanly. Under this setting, text checking only happens if you deliberately trigger the "Grammarly: Resume text check" command -- either through the command menu or through the UI. In the current version of this extension, text checking is controlled on a per cell basis within the notebook interface. So this lets you focus text checking to the markdown OR code cells you're interested in when you're interested in the feedback, while excluding checking those cells you aren't.