Skip to content

Make suggestions based on Damerau-Levenshtein distance - #1824

Merged
kinnison merged 3 commits into
rust-lang:masterfrom
Glamhoth:suggestions
May 9, 2019
Merged

Make suggestions based on Damerau-Levenshtein distance#1824
kinnison merged 3 commits into
rust-lang:masterfrom
Glamhoth:suggestions

Conversation

@Glamhoth

Copy link
Copy Markdown
Contributor

#1816
The only change that I'd suggest is to use Damerau-Levenshtein distance instead of Levenshtein distance, because the former adds transpositions to list of the basic operations. And as we know a lot of misspellings are made that way, even the example from issue is of this kind of error.

@kinnisonkinnison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bad, some comments in-line, and the commit history will need a good rebase toward the end (be careful to retain retep007's authorship at that point).

In addition, I'd like to see at least one test which demonstrates what happens if there's nothing worth suggesting within the heuristic distance of 3. E.g. rustup component add banana.

Comment threadsrc/toolchain.rs Outdated
Comment threadsrc/toolchain.rs Outdated
Comment threadsrc/errors.rs Outdated
Comment threadsrc/toolchain.rs Outdated
@bors

bors commented May 7, 2019

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #1833) made this pull request unmergeable. Please resolve the merge conflicts.

@kinnisonkinnison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So very almost there. Please fold the requested changes into the two main commits you have (i.e. where your initial implementation, and retep's changes lie.

I'll expect to see:

  • commit 1: the clitools.rs update
  • commit 2: your code (with fixes folded in)
  • commit 3: retep's work (with fixes folded in)

If you can do that, I think this is mergeable, so remember to remove WIP: from the title when you think you're ready for the final review before merge 😁

Thanks,

D.

Comment threadtests/cli-v2.rs
Comment threadtests/mock/clitools.rs
@GlamhothGlamhoth changed the title WIP: Make suggestions based on Damerau-Levenshtein distanceMake suggestions based on Damerau-Levenshtein distanceMay 9, 2019
Glamhothand others added 3 commits May 9, 2019 11:27
In order to support testing commands which may return certain
messages on `stderr` in a way in which they should *NOT*
produce such messages, add a counterpart to `expect_not_stdout_ok`.
@kinnison
kinnison merged commit 6396345 into rust-lang:masterMay 9, 2019
@Glamhoth
Glamhoth deleted the suggestions branch May 9, 2019 11:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Glamhoth@bors@kinnison@hrvolapeter