mirror of
https://github.com/coder/code-server.git
synced 2025-07-29 04:52:53 +08:00
chore(vscode): update to 1.56.0
This commit is contained in:
@ -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');
|
||||
|
Reference in New Issue
Block a user