-
Notifications
You must be signed in to change notification settings - Fork 230
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
pubspec.yaml should have a "latest" keyword for easy authoring #2895
Comments
Would also allow docs like this to be copy/pastable:
|
Interesting idea! We have
Does this work for your use cases? |
dart pub add will work great, yes thanks. I guess there still remains a question of what to do for our docs (should they be recommending But i'm also fine to see this closed. Thanks for the reply! |
I see the IDE-friendliness of the "latest" keyword that transforms into the latest good version compared to using the CLI. I would hope for IDEs to incorporate @jonasfj WDYT? |
@DanTup has been working on package name completion in I've even seen a future iteration of @DanTup's work where there is completion for version constraints. This will certainly improve the story for people editing But yes, incorporating Similarly, we should probably make analyzer hints to add a dependency using |
The package-name work has landed in the analyzer, though versions isn't complete yet (the way it currently works only supports LSP/VS Code, but I have ideas to fix this). It suggests the latest version number, so there might not be much value in including an entry for "latest" directly - although if we ever show more than just the latest version, it could make sense to annotate them (eg. with "latest pre-release", "latest stable" or maybe even ones that may not be compatible with your current SDK constraints or similar). |
I think I misunderstood this as "when completed from code completion", but reading the copy/paste example above, I realise that wasn't the case. If this was implemented (to update the pubspec on the first |
This is already super awesome, which is why I think we shouldn't support a nit: we probably shouldn't suggest the latest version, but only suggest caret ranges like
But templates are regularly updated, and if a new major version is published, you really should check if it works with the template code, before upgrading. Templates should already be using I don't think making I'm going to close this issue, because I think we should:
If you are publishing packages it's strongly discouraged, I think even forbidden. If you're developing an application it's discouraged. It has major downsides if you're maintaining a big complicated application with many developers. For quick hacks using |
I never remember what the right syntax is depending on the latest package.
I know "any" is discouraged, but I use it anyway, because it's convenient.
What if instead, there was a
latest
keyword (or similar) which just replaced with the correct syntax the first time it fetched?That makes
pub get
no longer idempotent (not quite the right word, but I can't think of the right one?) with regards to pubspec.yaml, so maybe this instead belongs in the Editor plugins or some higher level user affordance?Curious for your thoughts @devoncarew. Feel free to close. Just jotting down thoughts as I do some weekend hacking with Dart.
The text was updated successfully, but these errors were encountered: