Skip to content

Add levenshtein distance based suggestions everywhere #30197

Open

Description

Currently, we suggest typo fixes in case of function calls, locals, and field accesses. So, both the marked lines below will suggest the correct fix:

struct A {foo: u8}
fn main() {
    let x = A {foo: 1};
    x.fob; // here
    let aaaaaaa=1;
    let z = aaaaaab; // here
}

However, this is not the case for imports, crates, and inline paths. We should fix this.

This is probably not an easy bug, but should be fun. Basically you need to look for the source of the "could not find X" error, and do something similar to

fn find_best_match_for_name(&mut self, name: &str) -> SuggestionType {

@apasel422 @wafflespeanut want to work on this?

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

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions