Skip to content

Commit ae3b03a

Browse files
committed
Fix npm.scripsExplorerExclude for multiroot
Fixes microsoft#138826
1 parent 1b2c610 commit ae3b03a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

extensions/npm/src/npmView.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,17 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
291291
let folder = null;
292292
let packageJson = null;
293293

294-
const regularExpressionsSetting = workspace.getConfiguration('npm').get<string[]>('scriptExplorerExclude', []);
295-
const regularExpressions = regularExpressionsSetting?.map(value => RegExp(value));
294+
const excludeConfig: Map<string, RegExp[]> = new Map();
296295

297296
tasks.forEach(each => {
298-
if (regularExpressions.some((regularExpression) => (<NpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
297+
const location = each.location;
298+
if (location && !excludeConfig.has(location.uri.toString())) {
299+
const regularExpressionsSetting = workspace.getConfiguration('npm', location.uri).get<string[]>('scriptExplorerExclude', []);
300+
excludeConfig.set(location.uri.toString(), regularExpressionsSetting?.map(value => RegExp(value)));
301+
}
302+
const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined;
303+
304+
if (regularExpressions && regularExpressions.some((regularExpression) => (<NpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
299305
return;
300306
}
301307

0 commit comments

Comments
 (0)