drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`fix` command injects without replacing.

drahnr opened this issue · comments

Describe the bug

With the fix subcommand, the wrong segment is replaced under some unknown conditions.

To Reproduce

Steps to reproduce the behaviour:

  1. A file containing
/// With all patches applied.
///
/// Nothing todo, there is no line in need of a reflow.
///
/// Verify the individual patches are as expected.
struct Foo;
  1. Run cargo spellcheck fix
  2. ...

Expected behavior

The shown segment is replaced.

Screenshots
image

Please complete the following information:

  • System: Fedora 33
  • Obtained: git,cargo
  • Version: v0.8.0

Additional context

The underlying issue is that both nlprule and hunspell detect to do as something that needs fixing. Both now modify the span of to do, and the secondary bandaid just messes it up.

One solution would be to do this in a multi pass fashion, checker after checker with potential intermediate user interaction, store it and run the second checker.