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

Created on 13 Jul 2018  路  12Comments  路  Source: microsoft/vscode

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.

feature-request json

Most helpful comment

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.

All 12 comments

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

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!

@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.

@rjgotten my mistake :sweat_smile:

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

@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.)

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

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

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.

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...

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

curtw picture curtw  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

trstringer picture trstringer  路  3Comments

vsccarl picture vsccarl  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments