0

tl;dr; Can I adjust through which registry (a private one instead of the public) Visual Studio 2017 intellisense searches when adding packages to package.json

We are currently exploring the npm package management as provided in TFS2017 Update 1. We have setup a private registry and adjusted our .npmrc files to point to this private registry in stead of the public registry. (We adjusted the built-in config file and per-user config file.)

Since I already had nodejs and npm before installation of VS2017, I actually have two nodejs/npm on my system, so I adjusted the .npmrc of both the VS2017-npm [as used by the task explorer] and the default npm [as used by any normal command prompt].

We were able to publish a package to the private npm registry using the task explorer. (I also have the NPM Task Runner extension installed) But the package intellisense while typing in the package.json in Visual Studio 2017 does not find it. (Our package starts with "lv-", when we start typing in "lv-" we only see packages published on the public registry, not the one we published to our private registry).

So, the VS2017 package intellisense seems to skip our private npm registry and only searches the public npm .

Does anyone know where we can "repoint" the Visual Studio 2017 / NPM Task Runner extension intellisense for npm to search our registry ?

Should be by using the .npmrc files no ?

AardVark71
  • 3,928
  • 2
  • 30
  • 50
  • Please file VS feedback for this. Currently we only look in one package registry, and the only way to override that is through editing the VS registry hive, and then it applies globally to all projects (not what you want). – Jimmy Jun 09 '17 at 20:56
  • @Jimmy Thanks for your comment ! I was already willing to go through the private registry bin (we are doing that anyway to add a single-file generator) but can't find any ref to _registry.npmjs.org_ or _registry.npmjs.com_ . I hope it's not still a hardcoded value for registry.npmjs.org as in the first extension Mads Kristensen made ( https://github.com/madskristensen/JSON-Intellisense/blob/master/src/NPM/Constants.cs ) – AardVark71 Jun 11 '17 at 11:04

1 Answers1

1

I looked through the VS code, and unfortunately it turns out this scenario was only half-baked.

Good news: you can customize the URL used for package name intellisense:

  1. Load the registry file for your VS instance (see here if you don't know how to access it)
  2. Find the Software\Microsoft\VisualStudio\15.0_<instance>_Config\Languages\LanguageServices\JSON key
  3. Add a value named NPMPackageSearchUrl and set it to your desired registry URL.

Bad News:

  1. The package version intellisense is hard-coded to use registry.npmjs.org, so you'll only get names from your private registry.
  2. This will break your package name intellisense from registry.npmjs.org.

Please file feedback on this anyways, and we can get it on our backlog to make it work. (I'd file a bug, but your user feedback carries more weight in bug triage.)

Jimmy
  • 27,142
  • 5
  • 87
  • 100
  • Thanks for your feedback !! Just tried it out and doesn't pick up the own package right away. It probably won't help, but am going to restart once anyway. Also, wanted to let you know that I reported this here : https://developercommunity.visualstudio.com/content/problem/67393/visual-studio-2017-npm-package-intellisense-does-n.html – AardVark71 Jun 11 '17 at 18:24
  • Uh... just read your bad news point two... it will break intellisense from the public registry .. that's REALLY BAD news indeed, means we can't activate intellisense for our private registry – AardVark71 Jun 11 '17 at 18:40