Skip to content

Commit

Permalink
get debug session from tree vs debugService so view is populated even…
Browse files Browse the repository at this point in the history
… when debug session isn't focused (#224221)

fix #223352
  • Loading branch information
meganrogge authored Jul 29, 2024
1 parent 7c957be commit 13390b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/debug/browser/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
this.tree?.collapseAll();
}

getDebugSession(): IDebugSession | undefined {
return this.tree?.getInput();
}

getReplInput(): CodeEditorWidget {
return this.replInput;
}
Expand Down
16 changes: 7 additions & 9 deletions src/vs/workbench/contrib/debug/browser/replAccessibleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { AccessibleViewProviderId, AccessibleViewType, IAccessibleViewContentProvider, IAccessibleViewService } from 'vs/platform/accessibility/browser/accessibleView';
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
import { IDebugService, IReplElement } from 'vs/workbench/contrib/debug/common/debug';
import { IReplElement } from 'vs/workbench/contrib/debug/common/debug';
import { IAccessibleViewImplentation } from 'vs/platform/accessibility/browser/accessibleViewRegistry';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { getReplView, Repl } from 'vs/workbench/contrib/debug/browser/repl';
Expand All @@ -22,14 +22,14 @@ export class ReplAccessibleView implements IAccessibleViewImplentation {
type: AccessibleViewType = AccessibleViewType.View;
getProvider(accessor: ServicesAccessor) {
const viewsService = accessor.get(IViewsService);
const debugService = accessor.get(IDebugService);
const accessibleViewService = accessor.get(IAccessibleViewService);
const replView = getReplView(viewsService);
if (!replView) {
return undefined;
}

const focusedElement = replView.getFocusedElement();
return new ReplOutputAccessibleViewProvider(replView, focusedElement, debugService, accessibleViewService);
return new ReplOutputAccessibleViewProvider(replView, focusedElement, accessibleViewService);
}
}

Expand All @@ -52,18 +52,16 @@ class ReplOutputAccessibleViewProvider extends Disposable implements IAccessible
constructor(
private readonly _replView: Repl,
private readonly _focusedElement: IReplElement | undefined,
@IDebugService private readonly _debugService: IDebugService,
@IAccessibleViewService private readonly _accessibleViewService: IAccessibleViewService) {
super();
this._treeHadFocus = !!_focusedElement;
}
public provideContent(): string {
const viewModel = this._debugService.getViewModel();
const focusedDebugSession = viewModel?.focusedSession;
if (!focusedDebugSession) {
return 'No debug session is active.';
const debugSession = this._replView.getDebugSession();
if (!debugSession) {
return 'No debug session available.';
}
const elements = focusedDebugSession.getReplElements();
const elements = debugSession.getReplElements();
if (!elements.length) {
return 'No output in the debug console.';
}
Expand Down

0 comments on commit 13390b3

Please sign in to comment.