Merge pull request #201082 from susiwen8/fix-201081

fix: `install` in `npm script` shouldn't be opened
This commit is contained in:
Megan Rogge 2023-12-19 13:12:54 -06:00 committed by GitHub
commit 8ee37dc19a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -16,7 +16,8 @@ import {
createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, INpmTaskDefinition,
NpmTaskProvider,
startDebugging,
ITaskWithLocation
ITaskWithLocation,
INSTALL_SCRIPT
} from './tasks';
@ -82,7 +83,7 @@ class NpmScript extends TreeItem {
: task.task.name;
super(name, TreeItemCollapsibleState.None);
this.taskLocation = task.location;
const command: ExplorerCommands = workspace.getConfiguration('npm').get<ExplorerCommands>('scriptExplorerAction') || 'open';
const command: ExplorerCommands = name === `${INSTALL_SCRIPT} ` ? 'run' : workspace.getConfiguration('npm').get<ExplorerCommands>('scriptExplorerAction') || 'open';
const commandList = {
'open': {

View file

@ -31,7 +31,7 @@ type AutoDetect = 'on' | 'off';
let cachedTasks: ITaskWithLocation[] | undefined = undefined;
const INSTALL_SCRIPT = 'install';
export const INSTALL_SCRIPT = 'install';
export interface ITaskLocation {
document: Uri;