Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get debug session from tree vs debugService so view is populated even when debug session isn't focused #224221

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading