Turn off the spelling suggestions

I don’t think I’ve ever had a useful suggestion from this error message. Do others find it useful? Or annoying?

I’m talking about stuff like “error: unresolved name OK. Did you mean tys?” Where, the name I was looking for was Ok.

The suggestions are always wrong in my experience. In order to make this useful, I think we need to type check the suggestion to make sure it could work and have a better spell checker, especially for short words. That seems like a lot of work, in the meantime I would like to just turn it off.

The spell checker has helped me quite a few times; it’s especially good at fixing plurality. However, it could definitely be improved.

It has helped me occasionally. Quite occasionally.

It also only looks at locals, so something like

fn foo() {}

fn bar() {
    let baz = 0;
    fo()
}

is not as helpful as it could be…

<anon>:5:5: 5:7 error: unresolved name `fo`. Did you mean `baz`?

I think I’m in favour of turning it off (OTOH, having it popping up uselessly might get someone to improve it in a fit of rage :stuck_out_tongue: ).

It was helpful a few times when I made a typo, but I can’t recall those times clearly. Like in everything, when something is good you don’t notice it.

Maybe limit it to only give suggestions for things that are a low Levenshtein distance? Like 1 edit away only?

1 Like

Maybe divide the Levenshtein distance by the length of the identifier?

I once wrote a spellchecker in Python (playing with VP trees) that used a modified Levenshtein distance: replacements had fractional distance which was based on the physical distance between the letters on the keyboard.

On the one hand, this meant it was frighteningly good at suggesting corrections for typos. It also, unfortunately, led to what I ended up calling “drunk typo” suggestions: words of the same length where every letter in the suggestion was very close to each letter in the input. Even with a pretty small dictionary, it was crazy how often it’d find them.

These types of suggestions helped me quite often, I’d be opposed to removing them.

Well in this instance the only options are identifiers in your code, so it shouldn’t run into the situation you had.

The suggestions are wrong with enough frequency that I have to think "wait… what did I mean?" every time I see the "undeclared identifier" error anyway. I don’t think a correct suggestion actually saves me any time, but it does kind of feel nice when the compiler knows what you mean.

Is it possible to only ask “did you mean?” when the alternative is sufficiently close?

On that note a capitalization mistake could be a lower “edit” distance than a completely different letter because capitalization is very easy to get wrong. Maybe keys that are close together could have a lower edit distance than keys that are far apart.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.