Skip to content
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

Feature Request: Allow picking the first possible target if and only if target selector is ambiguous #7484

Open
fendor opened this issue Jul 14, 2021 · 5 comments

Comments

@fendor
Copy link
Collaborator

fendor commented Jul 14, 2021

Sometimes it is convenient to select a target if the given selector is ambiguous, either based on the component type or just the first that is accessible.

This is specifically helpful as cabal supports Filepath targets. Given a Filepath target, cabal figures out the component the filepath belongs to and loads that. However, sometimes a Filepath is part of multiple components. In that case, the target is ambiguous and no build-info is printed.
Especially for tooling, it would be better if you defaulted to just some component, as the options probably don't differ too much, and we keep working most of the time.

We propose here to add --pick-first-target to NixStyleFlags, so that users can conveniently decide to just pick a target and not error if the targets are ambiguous.

PR is here: #7482

Edit: Added better motivation

@fendor
Copy link
Collaborator Author

fendor commented Jul 14, 2021

This issue is just for completeness. I do not understand the motivation for this flag and if it is the motivation I came up with, I am definitely against it, as I prefer the explicitness over some form of convenience.

@jneira
Copy link
Member

jneira commented Jul 14, 2021

This issue is just for completeness. I do not understand the motivation for this flag and if it is the motivation I came up with, I am definitely against it, as I prefer the explicitness over some form of convenience.

who could help us to understand the motivation? @bubba ?

@fendor
Copy link
Collaborator Author

fendor commented Jul 20, 2021

Added better motivation after a discussion with @DanielG

@jneira
Copy link
Member

jneira commented Jul 20, 2021

mmm maybe i was expecting another thing or missing something obvious but i dont find the motivation here or in the pr 🤔

@fendor
Copy link
Collaborator Author

fendor commented Jul 20, 2021

Hm just this:

This is specifically helpful as cabal supports Filepath targets. Given a Filepath target, cabal figures out the component the filepath belongs to and loads that. However, sometimes a Filepath is part of multiple components. In that case, the target is ambiguous and no build-info is printed.
Especially for tooling, it would be better if you defaulted to just some component, as the options probably don't differ too much, and we keep working most of the time.

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

No branches or pull requests

3 participants