-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On identifier not found, detect swapped words #66968
Comments
I'd like to try to work on this. As fn main() {
let long_variable_name = true;
println!("{}", long_name_variable);
} @rustbot claim |
@estebank I'm thinking about the priority of the different possible matches. I tend to think that a match found by levenstein distance should have a greater priority, but what do you think? |
@LeSeulArtichaut it's tricky. I feel that your instinct might be right but we'd only know when looking at real world usage. The nice thing is that the lev distance check by its very nature it is limited, so doing the swapped words check as a fallback should work out ok in practice. |
Releasing my assignment, as I am not sure to be able to commit. rust/src/libsyntax/util/lev_distance.rs Lines 46 to 82 in ae1b871
@rustbot release-assignment |
(I think this is appropriate, please tell me if it isn't) |
I can take a stab at this, seems reasonable with previous comments. @rustbot claim |
On identifiers that have more than one word, it is relatively common to write them in the wrong order (
foo_bar_baz
→foo_baz_bar
). These are normally not found by Levenshtein distance checks, but we could do a basic "split on_
, sort and join before comparison" so that we could suggest the right identifier.This issue has been assigned to @cjkenn via this comment.
The text was updated successfully, but these errors were encountered: