diff options
author | Andrea Mah <31675041+andreamah@users.noreply.github.com> | 2022-07-27 18:38:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 18:38:12 +0300 |
commit | 18fb2dde5d56a464b39f7b93e40dd5e2f38fc74a (patch) | |
tree | c7da7f6b6623fd7ea43b23fb9fbf3c8a5fe77d38 /src/vs | |
parent | e572968d23fa5c80d407bac507143a6f60e2c0f8 (diff) |
Set initial debug session pick and edit pick prompt (#156387)
Initially selected session/console in the quickpick should match the currently selected one
Fixes #156310
Diffstat (limited to 'src/vs')
-rw-r--r-- | src/vs/workbench/contrib/debug/browser/debugSessionPicker.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/vs/workbench/contrib/debug/browser/debugSessionPicker.ts b/src/vs/workbench/contrib/debug/browser/debugSessionPicker.ts index 98dfb2e82f5..9e3b5b7efff 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSessionPicker.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSessionPicker.ts @@ -24,11 +24,14 @@ export async function showDebugSessionMenu(accessor: ServicesAccessor, selectAnd const quickPick = quickInputService.createQuickPick<IPickerDebugItem>(); localDisposableStore.add(quickPick); quickPick.matchOnLabel = quickPick.matchOnDescription = quickPick.matchOnDetail = quickPick.sortByLabel = false; - quickPick.placeholder = nls.localize('moveFocusedView.selectView', 'Search for debug session by name'); - quickPick.items = _getPicks(quickPick.value, selectAndStartID, debugService, viewsService, commandService); + quickPick.placeholder = nls.localize('moveFocusedView.selectView', 'Search debug sessions by name'); + + const pickItems = _getPicksAndActiveItem(quickPick.value, selectAndStartID, debugService, viewsService, commandService); + quickPick.items = pickItems.picks; + quickPick.activeItems = pickItems.activeItems; localDisposableStore.add(quickPick.onDidChangeValue(async () => { - quickPick.items = _getPicks(quickPick.value, selectAndStartID, debugService, viewsService, commandService); + quickPick.items = _getPicksAndActiveItem(quickPick.value, selectAndStartID, debugService, viewsService, commandService).picks; })); localDisposableStore.add(quickPick.onDidAccept(() => { const selectedItem = quickPick.selectedItems[0]; @@ -39,11 +42,13 @@ export async function showDebugSessionMenu(accessor: ServicesAccessor, selectAnd quickPick.show(); } -function _getPicks(filter: string, selectAndStartID: string, debugService: IDebugService, viewsService: IViewsService, commandService: ICommandService): Array<IPickerDebugItem | IQuickPickSeparator> { +function _getPicksAndActiveItem(filter: string, selectAndStartID: string, debugService: IDebugService, viewsService: IViewsService, commandService: ICommandService): { picks: Array<IPickerDebugItem | IQuickPickSeparator>; activeItems: Array<IPickerDebugItem> } { const debugConsolePicks: Array<IPickerDebugItem | IQuickPickSeparator> = []; const headerSessions: IDebugSession[] = []; + const currSession = debugService.getViewModel().focusedSession; const sessions = debugService.getModel().getSessions(false); + const activeItems: Array<IPickerDebugItem> = []; sessions.forEach((session) => { if (session.compact && session.parentSession) { @@ -61,6 +66,9 @@ function _getPicks(filter: string, selectAndStartID: string, debugService: IDebu const pick = _createPick(session, filter, debugService, viewsService, commandService); if (pick) { debugConsolePicks.push(pick); + if (session.getId() === currSession?.getId()) { + activeItems.push(pick); + } } } }); @@ -76,7 +84,7 @@ function _getPicks(filter: string, selectAndStartID: string, debugService: IDebu accept: () => commandService.executeCommand(selectAndStartID) }); - return debugConsolePicks; + return { picks: debugConsolePicks, activeItems }; } |