Skip to content

Commit 8ee37dc

Browse files
authored
Merge pull request microsoft#201082 from susiwen8/fix-201081
fix: `install` in `npm script` shouldn't be opened
2 parents 1324426 + f78d488 commit 8ee37dc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

extensions/npm/src/npmView.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, INpmTaskDefinition,
1717
NpmTaskProvider,
1818
startDebugging,
19-
ITaskWithLocation
19+
ITaskWithLocation,
20+
INSTALL_SCRIPT
2021
} from './tasks';
2122

2223

@@ -82,7 +83,7 @@ class NpmScript extends TreeItem {
8283
: task.task.name;
8384
super(name, TreeItemCollapsibleState.None);
8485
this.taskLocation = task.location;
85-
const command: ExplorerCommands = workspace.getConfiguration('npm').get<ExplorerCommands>('scriptExplorerAction') || 'open';
86+
const command: ExplorerCommands = name === `${INSTALL_SCRIPT} ` ? 'run' : workspace.getConfiguration('npm').get<ExplorerCommands>('scriptExplorerAction') || 'open';
8687

8788
const commandList = {
8889
'open': {

extensions/npm/src/tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type AutoDetect = 'on' | 'off';
3131

3232
let cachedTasks: ITaskWithLocation[] | undefined = undefined;
3333

34-
const INSTALL_SCRIPT = 'install';
34+
export const INSTALL_SCRIPT = 'install';
3535

3636
export interface ITaskLocation {
3737
document: Uri;

0 commit comments

Comments
 (0)