chore(vscode): update to 1.56.0

This commit is contained in:
Akash Satheesan
2021-04-30 20:25:17 +05:30
1749 changed files with 88014 additions and 43316 deletions

View File

@ -11,6 +11,7 @@ import { NpmScriptsTreeDataProvider } from './npmView';
import { getPackageManager, invalidateTasksCache, NpmTaskProvider, hasPackageJson } from './tasks';
import { invalidateHoverScriptsCache, NpmScriptHoverProvider } from './scriptHover';
import { NpmScriptLensProvider } from './npmScriptLens';
import * as which from 'which';
let treeDataProvider: NpmScriptsTreeDataProvider | undefined;
@ -30,8 +31,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}
}));
const canRunNPM = canRunNpmInCurrentWorkspace();
context.subscriptions.push(addJSONProviders(httpRequest.xhr, canRunNPM));
const npmCommandPath = await getNPMCommandPath();
context.subscriptions.push(addJSONProviders(httpRequest.xhr, npmCommandPath));
registerTaskProvider(context);
treeDataProvider = registerExplorer(context);
@ -71,6 +72,17 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
context.subscriptions.push(new NpmScriptLensProvider());
}
async function getNPMCommandPath(): Promise<string | undefined> {
if (canRunNpmInCurrentWorkspace()) {
try {
return await which(process.platform === 'win32' ? 'npm.cmd' : 'npm');
} catch (e) {
return undefined;
}
}
return undefined;
}
function canRunNpmInCurrentWorkspace() {
if (vscode.workspace.workspaceFolders) {
return vscode.workspace.workspaceFolders.some(f => f.uri.scheme === 'file');