You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
blocked on dart / flutterRequires a change in Dart or Flutter to progressin commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
We put a lot of work into messages coming out of dart pub get.
We have messages like:
Current package version have been retracted.
Newer a.b.c version available.
Package is discontinued.
Package is discontinued, replaced by package:foo.
Summaries of changes.
Content hash from pubspec.lock doesn't match content from server (new in 2.19)
Package version affected by security advisory (coming in the future)
Perhaps we should start a conversation about how we can highlight this information to users.
Context: we sometimes discover that users run into issues that were fixed 2 months ago, because they never run dart pub upgrade, even after an SDK upgrade.
Maybe, improving messaging here could help.
This is just to open a discussion, maybe we'd want pub to have other output. Or maybe this is better injected through the LSP.
Currently when we run "pub get" the output is hidden unless a) the process is still running after 10s or b) it exits with a non-zero exit code. In those cases, we show the Output pane that its output was being written to.
We could change these triggers to show the output in more cases, although I'm not familiar enough to know how often the cases above occur. If we end up showing the Output pane almost every time we run, I think that could be annoying (users may be aware of these issues from the last time they ran it, and don't need reminding every time they modify pubspec - which triggers the run again).
It would be nice if we could show some of this information in a more integrated way though. Perhaps we could run pub get --json or similar and have the usual output (that we can handle the same way we treat all of stdout today), but also have the items in a structured way that we can show elsewhere. For example, there's a new API I'd like to adopt soon that would let us move a lot of the information we have scattered around the place into a single flyout from the status bar:
Some of the things noted above (like a package you're using having a security advisory) might fit nicely there - we could show some kind id indicator on the status bar so it's noticable, but without popping open a pane of text output every time you fetch packages. (note: I haven't tried to use this API yet so I don't know its full capabilities/limitations).
For advisories, the idea is that users will be able to add ignored_advisories to pubspec.yaml.
Such that you can declare that you've reviewed an advisory and don't care.
So in that case, maybe we want LSP to add a warning for each import-statement, or adding warnings to pubspec.yaml. It would make a lot of noise, but it's also easy to fix, but just adding it to ignored_advisories (ideally, with a quick fix).
But things like:
Discontinued package,
Newer version available,
Maybe it's better for it just to be a subtle message that doesn't annoy users too much.
I'm less certain about what level of noise we want for using a retracted package version. We have no explicit mechanism for declaring that you want a retracted version -- but you only get it, if it's in your pubspec.lock or in dependency_overrides.
One possibility is that dart pub get writes a .dart_tool/pub/dependency-summary.json that exposes these messages for analysis_server/lsp or IDEs to consume.
Still not sure we want that: because for a message like "newer version available", it's legitimate to ignore it, yet there is no mechanism for stating that you don't care.
One possibility is that dart pub get writes a .dart_tool/pub/dependency-summary.json that exposes these messages for analysis_server/lsp or IDEs to consume.
Having it on disk has some advantages - both the LSP server (which can produce diagnostics/quick-fixes) and the IDE (which may want to surface some of these things in specific ways that are UI/editor-specific and never likely to fall inside LSP) can access it without spawning (duplicate) commands (plus it removes some complexity of actually running commands, providing output to the user if the command fails/hangs, etc.). If we did this, we should ensure there's a timestamp in it so tell how fresh the data is (since unlike invoking a command directly, it could easily be stale and I'm not sure we want to rely on the file timestamps).
For some things (like security advisories), I feel like the status bar with some coloured indicator could be good - however it's less simple to invoke a quick-fix from there because it's not driven by the analysis server. We could probably handle this with a well-known server command that could be invoked if you chose to ignore it though (which lets the server produce the pubspec edits).
Is it worth trying to come up with an example of some JSON for the the kind of information you have for each of these? Perhaps some of them can be generalised (so the IDE/server don't need to quite know the specifics of every item if many of them will generally be treated the same, just with some different text/identifier).
In terms of having a place to display richer information, perhaps we could decorate the pubspec.yaml file when the user opens it? We could use synthetic labels after a package dep to display additional information about the package:
dependencies:
args: ^1.7.0 # on version 1.7.1; version 1.8.0 is availablecollection: ^1.0.0 # on version 1.2.3; version has been retracted!path: ^2.0.0 # on version 2.1.0
We could also use CodeLens to have clickable links to upgrade (the same Run/Debug links we show on main functions and tests/groups), though if there are likely to be many it might look a bit cluttered (they add extra space between lines of code, messing with the spacing).
To have synthetic labels like we do for Closing Labels, we'd have to do something custom unless microsoft/vscode#151920 is implemented (so we could use the LSP-standard Inlay Hints without them being styled badly).
That is an interesting option, but I personally find them confusing when they look exactly like actual comments.
I've gotten used to them for the Flutter widget tree closing labels, but agree that they do need to look distinct from regular user code. It sounds like the subtle style used for closing labels isn't available to us currently though, just the a more bold / emphasized variant.
I would love to see a follow-up toast to the "run pub get?" toast if the output said any packages were out of date. While it may be annoying for some people, we see a lot of issues from people where the problem is that they just haven't run flutter pub upgrade to update transitive dependencies.
I would love to see a follow-up toast to the "run pub get?" toast if the output said any packages were out of date.
For this specifically, we might already have what we need. There's a pub outdated --json that we could run after pub get. If any package listed has a higher upgradable than current, we could (with an option to turn on/off), prompt to run pub upgrade?
I also opened #4262 about possible showing summary of pub updated in the language status, although I'm not yet sure many people look in there except me when jumping between SDK versions 🙃
FWIW, we do already prompt to pub upgrade when you go up an SDK version, but that's a special case.
I think that would work. It will however do quite a lot of work compared to what is needed.
pub get is optimized to just give a list of outdated/discontinued/retracted packages without doing more resolutions. @jonasfj should we consider an easy-to-parse json-output of pub get that will contain this information?
When we run pub get in the case above, we may end up showing the user the output (if it's taking too long, or if they open the Output pane and select it) so having a --machine flag of similar to give JSON probably won't work too well here.
I think if there are going to be changes to pub to support this, this perhaps something like the above (writing a file like .dart_tool/pub/dependency-summary.json for a normal pub get) would be the better solution. That way we can still show the users the output, but we can also get a structured view of things when the process completes.
Is there still any interest/desire in making any changes here? There were some ideas above that would require pub to provide additional output in a structured form so I don't think there's anything we can do in the IDE without that being defined/implemented first.
I still think the idea is valid. But I'm not sure we have a lot of resources currently to implement it.
Thinking about this now, we could perhaps surface security advisories the same way as analyzer warnings. The "outdated" ones should probably be more subtle.
Always having pub output a timestamped .dart_tool/pub/resolution_findings.json sounds like a promising direction. It could contain findings from the last resolution, together with severities and locations in pubspec.yaml.
Locations might sometimes be complicated though. A finding could be about a transitive dependency (no local pubspec.yaml to point to) or about a dependency shared between multiple workspace packages (multiple local pubspec.yaml files to point to). Should we really point to the pubspec.lock file? I don't know how often that is opened in the IDE.
We could either codify fixed types of findings (outdated, discontinued, ...) and have the dart code plugin assign severities, or let pub define severities, and just have severity categories (info, warning, error).
We could either codify fixed types of findings (outdated, discontinued, ...) and have the dart code plugin assign severities, or let pub define severities, and just have severity categories (info, warning, error).
I wonder if we should do this work in the analysis server instead? (cc @bwilkerson) Eg. pub writes the file, the analysis server reads it and produces diagnostics (this makes it ide-agnostic, and could even work from dart analyze at the CLI or in CI). Server has existing ways to configure severities in analysis_options.yaml so users could configure whether they want these and whether they're warnings/errots?
I don't think using pubspec.lock as the location for transitive dependencies would be that bad - it would show up in the Problems list in the IDE, and could perhaps even have a fix for running something like pub upgrade?
Yes, we should always do as much work as possible in the analysis server so that all of our supported IDEs can benefit from that work. Server seems ideal for reporting diagnostics as well as for supporting relevant fixes.
I also like the idea of using closing labels for additional information in the pubspec.
This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.
@sigurdm is there (or should we open) a pub issue for this? I think having Pub create such a file is the first step before doing anything in the analysis server. Probably we should move this issue to the SDK (since we think this would be best done in analysis_server) but I don't know if it's worth doing that prior to the Pub work.
blocked on dart / flutterRequires a change in Dart or Flutter to progressin commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
Activity
DanTup commentedon Nov 9, 2022
Currently when we run "pub get" the output is hidden unless a) the process is still running after 10s or b) it exits with a non-zero exit code. In those cases, we show the Output pane that its output was being written to.
We could change these triggers to show the output in more cases, although I'm not familiar enough to know how often the cases above occur. If we end up showing the Output pane almost every time we run, I think that could be annoying (users may be aware of these issues from the last time they ran it, and don't need reminding every time they modify pubspec - which triggers the run again).
It would be nice if we could show some of this information in a more integrated way though. Perhaps we could run
pub get --jsonor similar and have the usual output (that we can handle the same way we treat all ofstdouttoday), but also have the items in a structured way that we can show elsewhere. For example, there's a new API I'd like to adopt soon that would let us move a lot of the information we have scattered around the place into a single flyout from the status bar:Some of the things noted above (like a package you're using having a security advisory) might fit nicely there - we could show some kind id indicator on the status bar so it's noticable, but without popping open a pane of text output every time you fetch packages. (note: I haven't tried to use this API yet so I don't know its full capabilities/limitations).
jonasfj commentedon Nov 9, 2022
For advisories, the idea is that users will be able to add
ignored_advisoriestopubspec.yaml.Such that you can declare that you've reviewed an advisory and don't care.
So in that case, maybe we want LSP to add a warning for each import-statement, or adding warnings to
pubspec.yaml. It would make a lot of noise, but it's also easy to fix, but just adding it toignored_advisories(ideally, with a quick fix).But things like:
Maybe it's better for it just to be a subtle message that doesn't annoy users too much.
I'm less certain about what level of noise we want for using a retracted package version. We have no explicit mechanism for declaring that you want a retracted version -- but you only get it, if it's in your
pubspec.lockor independency_overrides.jonasfj commentedon Nov 9, 2022
One possibility is that
dart pub getwrites a.dart_tool/pub/dependency-summary.jsonthat exposes these messages foranalysis_server/lsp or IDEs to consume.Still not sure we want that: because for a message like "newer version available", it's legitimate to ignore it, yet there is no mechanism for stating that you don't care.
DanTup commentedon Nov 9, 2022
Having it on disk has some advantages - both the LSP server (which can produce diagnostics/quick-fixes) and the IDE (which may want to surface some of these things in specific ways that are UI/editor-specific and never likely to fall inside LSP) can access it without spawning (duplicate) commands (plus it removes some complexity of actually running commands, providing output to the user if the command fails/hangs, etc.). If we did this, we should ensure there's a timestamp in it so tell how fresh the data is (since unlike invoking a command directly, it could easily be stale and I'm not sure we want to rely on the file timestamps).
For some things (like security advisories), I feel like the status bar with some coloured indicator could be good - however it's less simple to invoke a quick-fix from there because it's not driven by the analysis server. We could probably handle this with a well-known server command that could be invoked if you chose to ignore it though (which lets the server produce the pubspec edits).
Is it worth trying to come up with an example of some JSON for the the kind of information you have for each of these? Perhaps some of them can be generalised (so the IDE/server don't need to quite know the specifics of every item if many of them will generally be treated the same, just with some different text/identifier).
devoncarew commentedon Nov 9, 2022
In terms of having a place to display richer information, perhaps we could decorate the pubspec.yaml file when the user opens it? We could use synthetic labels after a package dep to display additional information about the package:
DanTup commentedon Nov 9, 2022
We could also use CodeLens to have clickable links to upgrade (the same Run/Debug links we show on main functions and tests/groups), though if there are likely to be many it might look a bit cluttered (they add extra space between lines of code, messing with the spacing).
To have synthetic labels like we do for Closing Labels, we'd have to do something custom unless microsoft/vscode#151920 is implemented (so we could use the LSP-standard Inlay Hints without them being styled badly).
mit-mit commentedon Nov 10, 2022
That is an interesting option, but I personally find them confusing when they look exactly like actual comments.
devoncarew commentedon Nov 10, 2022
I've gotten used to them for the Flutter widget tree closing labels, but agree that they do need to look distinct from regular user code. It sounds like the subtle style used for closing labels isn't available to us currently though, just the a more bold / emphasized variant.
stuartmorgan-g commentedon Mar 9, 2023
I would love to see a follow-up toast to the "run
pub get?" toast if the output said any packages were out of date. While it may be annoying for some people, we see a lot of issues from people where the problem is that they just haven't runflutter pub upgradeto update transitive dependencies.DanTup commentedon Mar 13, 2023
For this specifically, we might already have what we need. There's a
pub outdated --jsonthat we could run afterpub get. If any package listed has a higherupgradablethancurrent, we could (with an option to turn on/off), prompt to runpub upgrade?@jonasfj is that logic correct?
I also opened #4262 about possible showing summary of
pub updatedin the language status, although I'm not yet sure many people look in there except me when jumping between SDK versions 🙃FWIW, we do already prompt to
pub upgradewhen you go up an SDK version, but that's a special case.sigurdm commentedon Mar 14, 2023
I think that would work. It will however do quite a lot of work compared to what is needed.
pub getis optimized to just give a list of outdated/discontinued/retracted packages without doing more resolutions.@jonasfj should we consider an easy-to-parse json-output of
pub getthat will contain this information?DanTup commentedon Mar 14, 2023
When we run
pub getin the case above, we may end up showing the user the output (if it's taking too long, or if they open the Output pane and select it) so having a--machineflag of similar to give JSON probably won't work too well here.I think if there are going to be changes to
pubto support this, this perhaps something like the above (writing a file like.dart_tool/pub/dependency-summary.jsonfor a normalpub get) would be the better solution. That way we can still show the users the output, but we can also get a structured view of things when the process completes.DanTup commentedon Aug 12, 2025
Is there still any interest/desire in making any changes here? There were some ideas above that would require
pubto provide additional output in a structured form so I don't think there's anything we can do in the IDE without that being defined/implemented first.sigurdm commentedon Aug 12, 2025
I still think the idea is valid. But I'm not sure we have a lot of resources currently to implement it.
Thinking about this now, we could perhaps surface security advisories the same way as analyzer warnings. The "outdated" ones should probably be more subtle.
Always having pub output a timestamped
.dart_tool/pub/resolution_findings.jsonsounds like a promising direction. It could contain findings from the last resolution, together with severities and locations in pubspec.yaml.Locations might sometimes be complicated though. A finding could be about a transitive dependency (no local pubspec.yaml to point to) or about a dependency shared between multiple workspace packages (multiple local pubspec.yaml files to point to). Should we really point to the pubspec.lock file? I don't know how often that is opened in the IDE.
We could either codify fixed types of findings (outdated, discontinued, ...) and have the dart code plugin assign severities, or let pub define severities, and just have severity categories (info, warning, error).
The design surface seems rather large...
DanTup commentedon Aug 12, 2025
I wonder if we should do this work in the analysis server instead? (cc @bwilkerson) Eg. pub writes the file, the analysis server reads it and produces diagnostics (this makes it ide-agnostic, and could even work from
dart analyzeat the CLI or in CI). Server has existing ways to configure severities inanalysis_options.yamlso users could configure whether they want these and whether they're warnings/errots?I don't think using
pubspec.lockas the location for transitive dependencies would be that bad - it would show up in the Problems list in the IDE, and could perhaps even have a fix for running something likepub upgrade?bwilkerson commentedon Aug 12, 2025
Yes, we should always do as much work as possible in the analysis server so that all of our supported IDEs can benefit from that work. Server seems ideal for reporting diagnostics as well as for supporting relevant fixes.
I also like the idea of using closing labels for additional information in the pubspec.
github-actions commentedon Sep 2, 2025
This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.
DanTup commentedon Sep 2, 2025
@sigurdm is there (or should we open) a
pubissue for this? I think having Pub create such a file is the first step before doing anything in the analysis server. Probably we should move this issue to the SDK (since we think this would be best done in analysis_server) but I don't know if it's worth doing that prior to the Pub work.sigurdm commentedon Sep 2, 2025
Feel free to open an issue.
We probably need some work in figuring out the details of what goes into the file.
DanTup commentedon Sep 2, 2025
sgtm, I've opened dart-lang/pub#4663