Skip to content

How to add words? #293

@ehuss

Description

@ehuss

How to add words interactively?

I'm trying to figure out how to add words to a dictionary (or at least to ignore the same word). Most spell checkers I am used to have an "Add to Dictionary" option or an "Ignore" option that will ignore the same word for the rest of the document. None of the options in the cargo spellcheck fix menu seem to provide that:

y - apply this suggestion
n - do not apply the suggested correction
q - quit; do not stage this hunk or any of the remaining ones
d - do not apply this suggestion and skip the rest of the file
g - select a suggestion to go to
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
e - manually edit the current hunk
? - print help

How to manually set up a dictionary?

Assuming it doesn't support adding words automatically, I tried several things to set up a custom dictionary. However, I found several roadblocks.

  1. Add to extra_dictionaries in the config mentioned at https://github.com/drahnr/cargo-spellcheck/blob/master/docs/configuration.md. I created .config/spellcheck.toml with the contents:
[Hunspell]
extra_dictionaries = ["spelling.txt"]

Got error: 0: Could not find extra dictionary spelling.txt in any of the search paths

  1. Tried extra_dictionaries = ["./spelling.txt"], go the same error.

  2. Tried with an absolute path, got 0: Failed to find any en_US.dic / en_US.aff in any search dir or no search provided

  3. After lots of messing around, figured out that creating a table disabled the default settings, so I had to add:

[Hunspell]
extra_dictionaries = ["/path/to/spelling.txt"]
use_builtin = true

Got an error:

   0: First line of extra dictionary must a number, but is: >foobar<
   1: invalid digit found in string
  1. I thought the extra dictionaries would be a "personal dictionary" according to the hunspell docs, which says it should be a text file with words. But apparently it is a .dic file. I added a random number at the top of the file, and was able to progress.

  2. However, now after each word, I have to stop, edit the file, restart cargo spellcheck (which takes a long time to start up).

I think I am missing something fundamental, or maybe I am very confused?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions