fix: keep directory separators visible when filtering npm scripts#2370
Open
patrickiel wants to merge 1 commit into
Open
fix: keep directory separators visible when filtering npm scripts#2370patrickiel wants to merge 1 commit into
patrickiel wants to merge 1 commit into
Conversation
e2fa550 to
3aa6687
Compare
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.
3aa6687 to
e2ba5c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Debug npm Script picker (
extension.js-debug.npmScript) groups scripts by directory usingQuickPickItemKind.Separatorwhen scripts come from multiple directories (multi-root / monorepo workspaces). While filtering, the quick pick sorts items by match position (VS Code's default), which reorders items across groups and drops the separators. As soon as you type a filter, you can no longer tell which package each script belongs to.Fix
Disable match sorting only when scripts span multiple directories (
multiDir), so the separators stay attached while filtering. Single-directory pickers keep the default match sorting and are unchanged.const quickPick = vscode.window.createQuickPick<ScriptPickItem>(); + (quickPick as { sortByLabel?: boolean }).sortByLabel = !multiDir;sortByLabelis a proposed API (microsoft/vscode#73904) but is safe to set at runtime (the setter has no proposal guard). The change uses a typed cast to avoid taking a proposed-API dependency, matching the existing cast style in the codebase (e.g.objectPreview/index.ts).