-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Quick documentation look-up for packages #60123
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
Comments
This is a tooling issue, not something controlled by Pub. |
cc @DanTup would this be the lsp server or the vscode plugin providing this? |
It depends on the specifics, but most likely if we did something here it would be in the analysis server (it's slightly more restricted for VS Code, but means all LSP clients get the functionality instead of only VS Code). It's not clear to me exactly what the UI is in the screenshot above, but the analysis server can provide hovers, inlay hints and CodeLens for pubspecs (although none of those are currently implemented). There's also a similar/related issue at Dart-Code/Dart-Code#1977. |
Me either. @RepliedSage11 could you provide more information about how you'd like to be able to see this information, both in VS Code and in IntelliJ? |
The UI in the screenshot is the tooltip displayed when hovering over one of the dependencies in a package.json file. It is rendering the readme file of the package with additional info from npm like the latest available version. I suspect for the pub extension it would be sufficient to show links to pub.dev and the latest version of the package, as well as some quick actions like upgrading an individual package or upgrading all packages. |
Ah, thanks - I think I was thrown by the rounded corners. I think there are probably two parts to this:
I think the first one would either need a request to the Pub API during computing of the hover, or reading directly from the readme. The second, we might already have some of the data for - we run |
Or, per the comment above, just include a link to the package's site on If we can read the comment directly from the readme then I suspect that would be faster, and would work without a network connection.
I agree. We could add a banner in the hover stating that there are newer version that might be compatible that includes the suggestion to run |
This is done now after Dart-Code/Dart-Code#2785 got closed. Not on hover but you can CTRL + Click on the package name. |
This makes more sense in Dart's case since AFAIK in npm you can't have incompatible dependency constrains since every package can just download a copy of a dependency with whatever version they need, so you can update individual dependencies while ignoring others. |
There is functionality in IntelliJ and VS Code that allows to get quick package documentation from a package.json file.
I think this would be a useful addition to the Pub IDE extensions.
My main use case is package upgrades. Right now I have to run
flutter pub outdated
and then manually lookup every package on pub.dev to find its changelog. I would like to be able to see the outdated packages right in the pubspec.yaml file with quick access to the changelog and documentation.This will also promote good practices of keeping your dependencies up to date if you can just take a glimpse at your pubspec instead of running a console command each time, which some folks might not do very often.
Here are the IntelliJ capabilities when working with package.json
The text was updated successfully, but these errors were encountered: