feature: Suggest candidates when alias not found#7004
Conversation
9e0d15e to
1e9854a
Compare
24707b7 to
b295392
Compare
|
@emillon Would you like this in 3.7? |
|
That's "just" a CLI change that's low risk but still a UX improvement so yes I don't mind including it. |
b295392 to
3029fe6
Compare
bin/alias.ml
Outdated
| ~f:(fun _ a _ -> Some a) | ||
| build.aliases (aliases t) | ||
| | _ :: t -> aliases t | ||
| | _ -> Alias.Name.Map.empty |
There was a problem hiding this comment.
I don't think this is right. You should use --context or default to make the suggestion.
There was a problem hiding this comment.
As discussed in chat, getting hold of context_arg from the CLI is a bit tricky here as I would have to thread it through unrelated places.
3029fe6 to
d02575a
Compare
|
So there is an issue with this PR as pointed out by Rudi. The suggested aliases will only appear from the first context considered when generating the hints. However for most users, I feel as though this will not matter. The correct fix IMO, would be to get hold of Common.context_arg globally and pick the currently selected context for generating the hints. I don't think I will do that in this PR however. |
| @@ -0,0 +1,8 @@ | |||
| Dune should suggest similar aliases when it cannot find one. | |||
There was a problem hiding this comment.
Can you turn that into a file cram test ? (alias-candidate.t with cat > dune and cat > dune-project in it)
There was a problem hiding this comment.
that's fewer files, tests are more self-contained. I think we said we now prefer that for new tests.
|
This is an improvement even if it's not correct in the presence of several contexts. Fine to include it but please write a ticket or a test to document the followup. Or postpone to 3.8 as you prefer. |
d02575a to
adcd3a5
Compare
|
The bigger problem with this feature is that it doesn't list the aliases defined in subdirectories. We might want to leave a note on that. |
|
OK I've decided against including this in 3.7. Let me implement this properly in 3.8. |
|
@Alizter what do you want to do about this one for 3.8? |
adcd3a5 to
5338d67
Compare
|
So updating my position on this PR. @rgrinberg asked to limit the alias query to the build context however this doesn't make sense to me for a few reasons.
Therefore I think the status of the PR is good and ready to go. |
|
#7004 (5338d67) changes the metrics as follows in comparison to Benchmark: defaultTest: dune monorepo benchmarks
|
|
#7004 (7864e0d) changes the metrics as follows in comparison to Benchmark: defaultTest: dune monorepo benchmarks
|
rgrinberg
left a comment
There was a problem hiding this comment.
Not perfect, but good enough for now. Some stylistic issues.
c44ec51 to
fad6141
Compare
|
@rgrinberg I've made the stylistic changes you suggested and updated the changelog to the new directory. |
CHANGES.md
Outdated
| - Bump minimum version of the dune language for the melange syntax extension | ||
| from 3.7 to 3.8 (#7665, @jchavarri) | ||
|
|
||
| - Dune now suggests other aliases when an alias is not found (#7004, @Alizter) |
There was a problem hiding this comment.
this doesn't need a CHANGES entry
There was a problem hiding this comment.
I think this comment is out of date since I moved the changelog to its own file before you reviewed. Are you also suggesting I remove that?
There was a problem hiding this comment.
I've removed that too for now, if we need a changelog we can just write a new one at a later date.
There was a problem hiding this comment.
We usually don't write CHANGES entry for error message improvements
fad6141 to
ed57ce5
Compare
Signed-off-by: Ali Caglayan <alizter@gmail.com>
ed57ce5 to
12c9365
Compare
|
@rgrinberg I've removed the changelog entry and refactored the accumulation of name suggestions to use a much shorter |
We now suggest candidates when an alias is not found. Error messages look like: