Skip to content

Commit e2ba5c5

Browse files
committed
fix: keep directory separators visible when filtering npm scripts
The "Debug npm script" quick pick groups scripts by directory using separators in multi-root / monorepo workspaces. The quick pick sorts by match position while filtering (the default), so typing a filter reorders items across groups and drops the separators - the user can no longer tell which package each script belongs to. Disable match sorting only when scripts span multiple directories, so the separators stay attached to their groups while filtering. Single-directory pickers keep the default match sorting.
1 parent 2df2f9d commit e2ba5c5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/ui/debugNpmScript.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export async function debugNpmScript(inFolder?: vscode.WorkspaceFolder | string)
4949
// directory name so the user knows where it's coming from.
5050
const multiDir = scripts.some(s => s.directory !== scripts[0].directory);
5151
const quickPick = vscode.window.createQuickPick<ScriptPickItem>();
52+
// Keep the original order while filtering so directory separators stay attached to their
53+
// groups; sorting by match would reorder across groups and drop them. (sortByLabel is
54+
// proposed API microsoft/vscode#73904, safe at runtime — cast to avoid the dependency.)
55+
(quickPick as { sortByLabel?: boolean }).sortByLabel = !multiDir;
5256

5357
let lastDir: string | undefined;
5458
const items: ScriptPickItem[] = [];

0 commit comments

Comments
 (0)