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

[json] package.json: complete package versions from scopes or private registries #54248

Open
rjgotten opened this issue Jul 13, 2018 · 12 comments
Assignees
Labels
feature-request Request for new features or functionality json JSON support issues
Milestone

Comments

@rjgotten
Copy link

While there are numerous issues explaining that package names cannot be autocompleted for scopes on the official registry or for private registries, that doesn't mean you shouldn't be able to autocomplete package versions.

And I'd argue that atleast for private registries autocompleting the version is generally more important than autocompleting the name. The name is usually well known for internal dependencies. But the version range available; that not so much...

Anyway, for scoped packages and even for scopes that are redirected to other registries using registry entries in .npmrc, the versions can be gotten from a simple npm view command, which returns a JSON structure that also holds all of a package's versions. No reason the functionality for that command couldn't be tapped for autocompletion as well.

@vscodebot vscodebot bot added the install-update VS Code installation and upgrade system issues label Jul 13, 2018
@Tyriar
Copy link
Member

Tyriar commented Jul 16, 2018

This feature is probably being provided by https://github.com/Microsoft/vscode-npm-scripts, you should file the request there

@Tyriar Tyriar added *caused-by-extension Issue identified to be caused by an extension and removed install-update VS Code installation and upgrade system issues labels Jul 16, 2018
@vscodebot
Copy link

vscodebot bot commented Jul 16, 2018

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jul 16, 2018
@rjgotten
Copy link
Author

rjgotten commented Jul 16, 2018

@Tyriar

The current support is being provided by the built-in package with ID vscode.npm.
I cannot find any reference to the vscode-npm-scripts package you are refering to.

@Tyriar Tyriar removed the *caused-by-extension Issue identified to be caused by an extension label Jul 16, 2018
@Tyriar Tyriar reopened this Jul 16, 2018
@Tyriar
Copy link
Member

Tyriar commented Jul 16, 2018

@rjgotten my mistake 😅

@egamma egamma assigned aeschli and unassigned egamma Jul 16, 2018
@aeschli aeschli added this to the Backlog milestone Jul 17, 2018
@aeschli aeschli added feature-request Request for new features or functionality json JSON support issues labels Jul 17, 2018
@aeschli aeschli changed the title Auto-complete package versions in package.json from scopes or private registries [json] package.json: complete package versions from scopes or private registries Jul 17, 2018
@aeschli
Copy link
Contributor

aeschli commented Jul 17, 2018

Thanks for the hint. We should try if npm view packageName versions works well enough.
If you want to give it a try, the code is in https://github.com/Microsoft/vscode/blob/master/extensions/npm/src/features/packageJSONContribution.ts

@rjgotten
Copy link
Author

rjgotten commented Jul 17, 2018

@aeschli
Hmm... far as I can tell that code hardcodes access to https://registry.npmjs.org rather than go through the proper steps that would respect alternate mapped registries in an .npmrc file, correct?

I assume that means quite a lot of work if you want to replicate npm view.
Wonder if you could get away using NPM as an API. (I thought the NPM team deprecated that tho.)

@aeschli
Copy link
Contributor

aeschli commented Jul 17, 2018

Yes, of course, the current code supports only the default registry lookup.

@aeschli
Copy link
Contributor

aeschli commented Jul 17, 2018

Probably the best would be to call npm as a command so we get the version the user has configured.

@austinh
Copy link

austinh commented Jan 27, 2020

Ive tried to follow the various issues mentioned in here but it does not seem that there has been a conclusion on this issue. It seems like many people assume this is an extension, but actually its not and its provided by core functionality, is that correct?

I would love this feature and think it would be an excellent addition to vscode.

@chadlavi
Copy link

nth'ing this -- it's very annoying when your work uses a private registry for internal libraries to not get any intellisense for version info on them just because vscode has some hard-coded package that (very weirdly) only looks to npm.

Especially since github does registries now as well, and microsoft owns both npm and github...

@meriturva
Copy link

I use this extension: https://github.com/pgsandstrom/package-json-upgrade
And works quite well with private registries.

@chadlavi
Copy link

@meriturva thanks for the rec, that does provide the functionality I wanted for private registries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality json JSON support issues
Projects
None yet
Development

No branches or pull requests

7 participants