jupyterlab-contrib / spellchecker

Spellchecker for JupyterLab notebook markdown cells and file editor.
BSD 3-Clause "New" or "Revised" License
202 stars 20 forks source link

Code cells are being spellchecked #141

Open Nicholaswogan opened 5 months ago

Nicholaswogan commented 5 months ago

In many cases, this extension is checking the spelling in "code" cells. Is this expected behavior? Can this behavior be turned off?

Screenshot 2024-01-22 at 1 52 49 PM

krassowski commented 5 months ago

Yes and no. By default only comments are checked in code, which is opt-out. String checking are opt-in. What do you see in your settings (go to menu bar Settings → Settings Editor → Spellchecker); this should look like:

image

Nicholaswogan commented 5 months ago

This is what my settings looks like:

Screenshot 2024-01-23 at 8 13 40 AM

bradezard131 commented 1 week ago

Also seeing this issue, getting misspelling notes on imports, class names, etc. and no obvious way to turn it off image

krassowski commented 1 week ago

@bradezard131 is this in a notebook or in the file editor? What browser are you using? If you type something in the editor does it go away?

bradezard131 commented 1 week ago

This is a notebook running in chrome. It does appear to go away when I start typing in each cell, which I'll use as a workaround for now to clean it up. I'd hope that this is still considered a bug though that I have to type in every cell to clean up the attention-grabbing red boxes.

krassowski commented 1 week ago

It does appear to go away when I start typing in each cell, which I'll use as a workaround for now to clean it up

Ok, I see what is happening. It has nothing to do with the feature of spelling in code. Instead, the notebook initially advertises the cell to contain text and only switches the MIME format to Python code after the kernel has connected. Thus, the extension thinks that it is checking plain text. I never seen this in the notebook before but I did see this issue in File editor.

The solution would be to ensure we refresh the spellchecking after the editor MIME type changed.