Skip to content

Commit 9fee537

Browse files
committed
Fixing microsoft#76711 handle the case that a script is customized in the tasks.json
1 parent 4bf092c commit 9fee537

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

‎extensions/npm/src/npmView.ts‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
145145
subscriptions.push(commands.registerCommand('npm.runInstall', this.runInstall, this));
146146
}
147147

148-
private scriptIsValid(scripts: any, task: Task): boolean {
149-
for (const script in scripts) {
150-
let label = getTaskName(script, task.definition.path);
151-
if (task.name === label) {
152-
return true;
153-
}
154-
}
155-
return false;
156-
}
157-
158148
private async runScript(script: NpmScript) {
159-
let task = script.task;
160-
let uri = getPackageJsonUriFromTask(task);
161-
let scripts = await getScripts(uri!);
162-
163-
if (!this.scriptIsValid(scripts, task)) {
164-
this.scriptNotValid(task);
165-
return;
166-
}
167149
tasks.executeTask(script.task);
168150
}
169151

@@ -176,11 +158,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
176158
let uri = getPackageJsonUriFromTask(task);
177159
let scripts = await getScripts(uri!);
178160

179-
if (!this.scriptIsValid(scripts, task)) {
180-
this.scriptNotValid(task);
181-
return;
182-
}
183-
184161
let debugArg = this.extractDebugArg(scripts, task);
185162
if (!debugArg) {
186163
let message = localize('noDebugOptions', 'Could not launch "{0}" for debugging because the scripts lacks a node debug option, e.g. "--inspect-brk".', task.name);
@@ -195,11 +172,6 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
195172
startDebugging(task.name, debugArg[0], debugArg[1], script.getFolder());
196173
}
197174

198-
private scriptNotValid(task: Task) {
199-
let message = localize('scriptInvalid', 'Could not find the script "{0}". Try to refresh the view.', task.name);
200-
window.showErrorMessage(message);
201-
}
202-
203175
private findScript(document: TextDocument, script?: NpmScript): number {
204176
let scriptOffset = 0;
205177
let inScripts = false;

0 commit comments

Comments
 (0)