Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger check after adding/ignoring word #3069

Open
memeplex opened this issue Mar 3, 2024 · 6 comments · Fixed by #3233
Open

Trigger check after adding/ignoring word #3069

memeplex opened this issue Mar 3, 2024 · 6 comments · Fixed by #3233

Comments

@memeplex
Copy link

memeplex commented Mar 3, 2024

To keep cpu usage in check I like to set spellCheckDelayMs to somewhat high values (2000-5000). I don't care to have instantaneous feedback anyway.

But when I'm correcting, often I add a word to a dictionary or ignore it. In these cases it feels as if nothing has actually happened, the word is not corrected until some seconds later.

I think adding/ignoring a word is a clear enough signal to force an instant recheck (or removing the misspelled mark for the current word).

EDIT: I realized that the same behavior is seen when enabling/disabling/toggling spell checking altogether. If I toggle CSpell on or off at first it seems as if the action hasn't really worked. Again, a forced check is warranted here, despite the delay setting.

@Jason3S
Copy link
Collaborator

Jason3S commented Mar 5, 2024

@memeplex,

Are you seeing a high CPU usage? To spell check most files (<500 lines) it takes about 10ms.
The most common cause for it to take longer is an inefficient regular expression.

But that is besides the point, this issue is about the delay when a change is made to the configuration. In that case, the delay us unwanted. I agree, it makes the spell checker seem sluggish and unresponsive.

I have to think about how to separate the triggers.

@memeplex
Copy link
Author

memeplex commented Mar 5, 2024

Are you seeing a high CPU usage?

I wouldn't say high, but I usually work with very long documents (mainly LaTeX) and I actually don't need to be immediately informed of misspellings (and sometimes I don't want, like in #3070). If there were a way to trigger a one-shot check I would just do that. I sometimes approximate that behavior by toggling CSpell on and off, but I find increasing the period of checking to be a better trade-off between convenience and resource usage. Now, when I'm actually reviewing and adding/ignoring words, that 5s delay that I usually don't matter starts to matter.

@Jason3S
Copy link
Collaborator

Jason3S commented Mar 6, 2024

@memeplex,

If you are willing to try out the cutting edge of the extension: Latest Releases.

Please install the latest alpha version.

Change these settings:

  • "cSpell.diagnosticLevel": "Hint"
  • "cSpell.decorateIssues": true

There are new commands:
image

The settings will remove spelling issues from the "Problems" view and show them in a "Spell Checker" view instead.
image

Toggling the decorations is very fast.

@Jason3S Jason3S linked a pull request May 6, 2024 that will close this issue
@Jason3S Jason3S reopened this May 7, 2024
@Jason3S
Copy link
Collaborator

Jason3S commented May 7, 2024

PR #3233 only hides spelling issues as you type. The command to show/hide the decoration does exactly that. But it will not force a re-check.

The ask here seems to be able to re-check without delay.

@Jason3S
Copy link
Collaborator

Jason3S commented May 31, 2024

@memeplex,

Would you try out the v4 pre-release version: Code Spell Checker - Visual Studio Marketplace.

There are a few configuration changes:

image image

New display commands:

image

It seem like you might prefer a high cSpell.revealIssuesAfterDelayMS with a low cSpell.spellCheckDelayMs.

@memeplex
Copy link
Author

Sorry for the delay, thank you very much for caring about this.

I was about to check this but then I realized that I'm failing to see in which way it's related to my original concern. To be clear, I sometimes work with very long LaTeX documents. I don't need the spellchecker to give immediate feedback, so to keep processing resources on check I set a delay of about 2000 ms. But during the review phase I correct misspellings and it feels odd that after correcting them the error decorations remain visible for a couple of seconds. So my suggestion was to trigger an immediate refresh just in cases like those, when a misspelled word is changed, optimistically assuming that the user attempted to correct it (a fortiori when the change came from a suggested quick fix).

Now, the changes you mentioned above seem to be related to where the errors are shown ("Problems" vs "Spell Checker") or whether decorations are shown at all or not. The "hide issues while typing" and "reveal issues after delay" may be addressing my concern somehow, but I don't quite understand how they work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants