vscode-spell-checker icon indicating copy to clipboard operation
vscode-spell-checker copied to clipboard

Don't check ongoing word

Open memeplex opened this issue 1 year ago • 2 comments

When I'm in the middle of typing a word it is usually marked as misspelled until I complete the word. One could argue that if what I typed is not the prefix of any possible word, then it's a mistake. But that's not what's happening, the complete word is valid and hence so is the prefix. I believe there are two issues here:

  • Usability: it's a false positive right in front of my eyes (I'm looking at what I write, of course) that I find too noisy.

  • Performance: except for the "is this the prefix of some valid word?" check, there's no point in running the checker all along.

I propose to only check entire words, maybe triggering the checker on punctuation or separator chars, but not before. This is also a good throttling strategy that will naturally increase the checker period without degrading the user experience (I would say, even improving it because of the first point above).

I've used Spell Right and it does something like what I described.

I know I can tweak the checker with minWordLength and spellCheckDelayMs, but it's not the same thing.

PS: not directly related, but out of curiosity: does the checker run at all when there are no modifications to the editor?

PS: I've been checking other apps (Notion, TextEdit, this textarea) and none of them marks a word as misspelled until I press space.

memeplex avatar Mar 03 '24 19:03 memeplex

@memeplex,

I would have to think about how to accomplish this. The spell checker server only gets document change events, but doesn't know where the cursor is.

Jason3S avatar Mar 05 '24 19:03 Jason3S

I'm going to take a look at Spell Right sources and see if I can understand how they achieve this. Isn't the content of the change informed with the event? For example if whitespace was inserted?

memeplex avatar Mar 05 '24 19:03 memeplex

I came here to post this issue if it wasn't already in the tracker. I'm going to have to disable the plugin, because the constant blue flash trailing my cursor is just too distracting. It's otherwise excellent code, granted I've just started using it, but this means I can't use it live, I'll need to switch it on periodically and check the whole document.

As a suggestion, match whitespace and all ASCII punctuation to trigger a check, and it should be fine. Define it so that language-specific modules can add punctuation. It's ok if the occasional word gets checked later if the user navigates away, the blue squiggle is hard to miss.

mnemnion avatar Apr 22 '24 12:04 mnemnion

I should add, for others who find this issue, that setting spellCheckDelayMs to a significantly higher value is a reasonable workaround, mentioned in #3069.

mnemnion avatar Apr 22 '24 13:04 mnemnion

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jun 06 '24 05:06 github-actions[bot]