Skip to content

Make suggestions based on Levenshtein distance #1816

@kinnison

Description

@kinnison

Describe the problem you are trying to solve

From time to time people have difficulty installing components because of typos. Sometimes they're even really hard to spot, particularly for those who are dyslexic. For example, recently someone had difficulty installing the rls component because they kept typing rsl but reading it as rls and so couldn't tell what was wrong.

Describe the solution you'd like

Whenever we issue a component-not-found or target-not-found etc, consider adding a quick check of the available components/targets, sort them by levenshtein distance, and suggest the nearest one.

Notes

That way, instead of:

$ rustup component add rsl
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rsl' for target 'x86_64-unknown-linux-gnu'

We'd maybe get something like:

$ rustup component add rsl
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rsl' for target 'x86_64-unknown-linux-gnu' - Did you perhaps mean 'rls` ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions