[json] IntelliSense doesn't work for scoped packages in package.json. Fixes #62377
This commit is contained in:
parent
5a892a6450
commit
20906c33c4
1 changed files with 8 additions and 4 deletions
|
@ -26,7 +26,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
'shelljs', 'gulp', 'yargs', 'browserify', 'minimatch', 'react', 'less', 'prompt', 'inquirer', 'ws', 'event-stream', 'inherits', 'mysql', 'esprima',
|
||||
'jsdom', 'stylus', 'when', 'readable-stream', 'aws-sdk', 'concat-stream', 'chai', 'Thenable', 'wrench'];
|
||||
|
||||
private knownScopes = ['@types', '@angular'];
|
||||
private knownScopes = ['@types', '@angular', '@babel', '@nuxtjs', '@vue', '@bazel'];
|
||||
private xhr: XHRRequest;
|
||||
|
||||
public getDocumentSelector(): DocumentSelector {
|
||||
|
@ -163,7 +163,11 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
}
|
||||
} else if (segments.length === 2 && segments[0].length > 1) {
|
||||
let scope = segments[0].substr(1);
|
||||
let queryUrl = `https://registry.npmjs.org/-/v1/search?text=scope:${scope}%20${segments[1]}&size=${SCOPED_LIMIT}&popularity=1.0`;
|
||||
let name = segments[1];
|
||||
if (name.length < 4) {
|
||||
name = '';
|
||||
}
|
||||
let queryUrl = `https://api.npms.io/v2/search?q=scope:${scope}%20${name}&size=250`;
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
|
@ -171,8 +175,8 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
if (success.status === 200) {
|
||||
try {
|
||||
const obj = JSON.parse(success.responseText);
|
||||
if (obj && Array.isArray(obj.objects)) {
|
||||
const objects = <{ package: { name: string; version: string, description: string; } }[]>obj.objects;
|
||||
if (obj && Array.isArray(obj.results)) {
|
||||
const objects = <{ package: { name: string; version: string, description: string; } }[]>obj.results;
|
||||
for (let object of objects) {
|
||||
if (object.package && object.package.name) {
|
||||
const name = object.package.name;
|
||||
|
|
Loading…
Reference in a new issue