From e2ba5c512fdea6f4226e86a36753f5f857bf7afc Mon Sep 17 00:00:00 2001 From: Patrick Demichiel Date: Sun, 7 Jun 2026 07:47:48 +0200 Subject: [PATCH] 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. --- src/ui/debugNpmScript.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/debugNpmScript.ts b/src/ui/debugNpmScript.ts index c94f33a66..0636c17f9 100644 --- a/src/ui/debugNpmScript.ts +++ b/src/ui/debugNpmScript.ts @@ -49,6 +49,10 @@ export async function debugNpmScript(inFolder?: vscode.WorkspaceFolder | string) // directory name so the user knows where it's coming from. const multiDir = scripts.some(s => s.directory !== scripts[0].directory); const quickPick = vscode.window.createQuickPick(); + // Keep the original order while filtering so directory separators stay attached to their + // groups; sorting by match would reorder across groups and drop them. (sortByLabel is + // proposed API microsoft/vscode#73904, safe at runtime — cast to avoid the dependency.) + (quickPick as { sortByLabel?: boolean }).sortByLabel = !multiDir; let lastDir: string | undefined; const items: ScriptPickItem[] = [];