mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
parent
00a03f5797
commit
66c63c5d70
|
@ -13,6 +13,14 @@ import { invalidateHoverScriptsCache, NpmScriptHoverProvider } from './scriptHov
|
|||
|
||||
let treeDataProvider: NpmScriptsTreeDataProvider | undefined;
|
||||
|
||||
function invalidateScriptCaches() {
|
||||
invalidateHoverScriptsCache();
|
||||
invalidateTasksCache();
|
||||
if (treeDataProvider) {
|
||||
treeDataProvider.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
||||
configureHttpRequest();
|
||||
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
|
||||
|
@ -45,6 +53,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
|||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('npm.runSelectedScript', runSelectedScript));
|
||||
context.subscriptions.push(vscode.commands.registerCommand('npm.runScriptFromFolder', selectAndRunScriptFromFolder));
|
||||
context.subscriptions.push(vscode.commands.registerCommand('npm.refresh', () => {
|
||||
invalidateScriptCaches();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
function canRunNpmInCurrentWorkspace() {
|
||||
|
@ -55,15 +67,6 @@ function canRunNpmInCurrentWorkspace() {
|
|||
}
|
||||
|
||||
function registerTaskProvider(context: vscode.ExtensionContext): vscode.Disposable | undefined {
|
||||
|
||||
function invalidateScriptCaches() {
|
||||
invalidateHoverScriptsCache();
|
||||
invalidateTasksCache();
|
||||
if (treeDataProvider) {
|
||||
treeDataProvider.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (vscode.workspace.workspaceFolders) {
|
||||
let watcher = vscode.workspace.createFileSystemWatcher('**/package.json');
|
||||
watcher.onDidChange((_e) => invalidateScriptCaches());
|
||||
|
|
|
@ -129,7 +129,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
|||
subscriptions.push(commands.registerCommand('npm.runScript', this.runScript, this));
|
||||
subscriptions.push(commands.registerCommand('npm.debugScript', this.debugScript, this));
|
||||
subscriptions.push(commands.registerCommand('npm.openScript', this.openScript, this));
|
||||
subscriptions.push(commands.registerCommand('npm.refresh', this.refresh, this));
|
||||
subscriptions.push(commands.registerCommand('npm.runInstall', this.runInstall, this));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue