mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 07:15:54 +01:00
npm.fetchOnlinePackageInfo is not respected in latest build. Fixes #103540
This commit is contained in:
@@ -51,6 +51,10 @@ export class PackageJSONContribution implements IJSONContribution {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
private isEnabled() {
|
||||
return this.canRunNPM || this.onlineEnabled();
|
||||
}
|
||||
|
||||
private onlineEnabled() {
|
||||
return !!workspace.getConfiguration('npm').get('fetchOnlinePackageInfo');
|
||||
}
|
||||
@@ -63,7 +67,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
||||
isLast: boolean,
|
||||
collector: ISuggestionsCollector
|
||||
): Thenable<any> | null {
|
||||
if (!this.onlineEnabled()) {
|
||||
if (!this.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -180,7 +184,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
||||
}
|
||||
|
||||
public async collectValueSuggestions(_fileName: string, location: Location, result: ISuggestionsCollector): Promise<any> {
|
||||
if (!this.onlineEnabled()) {
|
||||
if (!this.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -250,7 +254,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
||||
if (this.canRunNPM) {
|
||||
info = await this.npmView(pack);
|
||||
}
|
||||
if (!info) {
|
||||
if (!info && this.onlineEnabled()) {
|
||||
info = await this.npmjsView(pack);
|
||||
}
|
||||
return info;
|
||||
@@ -303,6 +307,9 @@ export class PackageJSONContribution implements IJSONContribution {
|
||||
}
|
||||
|
||||
public getInfoContribution(_fileName: string, location: Location): Thenable<MarkedString[] | null> | null {
|
||||
if (!this.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
if ((location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']) || location.matches(['optionalDependencies', '*']) || location.matches(['peerDependencies', '*']))) {
|
||||
const pack = location.path[location.path.length - 1];
|
||||
if (typeof pack === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user