Some no explicit any in contrib/debug/ (#273469)

* Reduce explicit any

* More no explicit any

* CCR thank you

* Fix

* Fix

* Fix context computation
This commit is contained in:
Rob Lourens
2025-10-30 13:30:22 -07:00
committed by GitHub
parent e1805b9c01
commit 7e1fd498bb
9 changed files with 98 additions and 94 deletions

View File

@@ -824,9 +824,6 @@ export default tseslint.config(
'src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.ts',
'src/vs/workbench/contrib/customEditor/browser/customEditors.ts',
'src/vs/workbench/contrib/customEditor/common/customEditor.ts',
'src/vs/workbench/contrib/debug/browser/breakpointWidget.ts',
'src/vs/workbench/contrib/debug/browser/breakpointsView.ts',
'src/vs/workbench/contrib/debug/browser/callStackView.ts',
'src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts',
'src/vs/workbench/contrib/debug/browser/debugAdapterManager.ts',
'src/vs/workbench/contrib/debug/browser/debugCommands.ts',
@@ -842,8 +839,6 @@ export default tseslint.config(
'src/vs/workbench/contrib/debug/browser/variablesView.ts',
'src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts',
'src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts',
'src/vs/workbench/contrib/debug/common/debug.ts',
'src/vs/workbench/contrib/debug/common/debugModel.ts',
'src/vs/workbench/contrib/debug/common/debugger.ts',
'src/vs/workbench/contrib/debug/common/replModel.ts',
'src/vs/workbench/contrib/debug/test/common/mockDebug.ts',

View File

@@ -549,7 +549,7 @@ class CloseBreakpointWidgetCommand extends EditorCommand {
});
}
runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: unknown): void {
const debugContribution = editor.getContribution<IBreakpointEditorContribution>(BREAKPOINT_EDITOR_CONTRIBUTION_ID);
if (debugContribution) {
// if focus is in outer editor we need to use the debug contribution to close

View File

@@ -580,9 +580,7 @@ class BreakpointsRenderer implements IListRenderer<IBreakpoint, IBreakpointTempl
breakpointIdToActionBarDomeNode.set(breakpoint.getId(), data.actionBar.domNode);
}
disposeElement(a: any, index: number, template: IBreakpointTemplateData): void {
disposeElement(a: IBreakpoint, index: number, template: IBreakpointTemplateData): void {
template.elementDisposables.clear();
}

View File

@@ -7,6 +7,8 @@ import * as dom from '../../../../base/browser/dom.js';
import { ActionBar } from '../../../../base/browser/ui/actionbar/actionbar.js';
import { AriaRole } from '../../../../base/browser/ui/aria/aria.js';
import { HighlightedLabel } from '../../../../base/browser/ui/highlightedlabel/highlightedLabel.js';
import type { IManagedHover } from '../../../../base/browser/ui/hover/hover.js';
import { getDefaultHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegateFactory.js';
import { IListVirtualDelegate } from '../../../../base/browser/ui/list/list.js';
import { IListAccessibilityProvider } from '../../../../base/browser/ui/list/listWidget.js';
import { ITreeCompressionDelegate } from '../../../../base/browser/ui/tree/asyncDataTree.js';
@@ -21,13 +23,16 @@ import { createMatches, FuzzyScore, IMatch } from '../../../../base/common/filte
import { DisposableStore, dispose, IDisposable } from '../../../../base/common/lifecycle.js';
import { posix } from '../../../../base/common/path.js';
import { commonSuffixLength } from '../../../../base/common/strings.js';
import { ThemeIcon } from '../../../../base/common/themables.js';
import { IRange } from '../../../../editor/common/core/range.js';
import { localize } from '../../../../nls.js';
import { ICommandActionTitle, Icon } from '../../../../platform/action/common/action.js';
import { getActionBarActions, getContextMenuActions, MenuEntryActionViewItem, SubmenuEntryActionViewItem } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';
import { IMenuService, MenuId, MenuItemAction, MenuRegistry, registerAction2, SubmenuItemAction } from '../../../../platform/actions/common/actions.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { ContextKeyExpr, ContextKeyExpression, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { ContextKeyExpr, ContextKeyExpression, ContextKeyValue, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { ILabelService } from '../../../../platform/label/common/label.js';
@@ -36,51 +41,58 @@ import { INotificationService } from '../../../../platform/notification/common/n
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
import { asCssVariable, textLinkForeground } from '../../../../platform/theme/common/colorRegistry.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
import { ThemeIcon } from '../../../../base/common/themables.js';
import { ViewAction, ViewPane } from '../../../browser/parts/views/viewPane.js';
import { IViewletViewOptions } from '../../../browser/parts/views/viewsViewlet.js';
import { IViewDescriptorService } from '../../../common/views.js';
import { CALLSTACK_VIEW_ID, CONTEXT_CALLSTACK_FOCUSED, CONTEXT_CALLSTACK_ITEM_STOPPED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD, CONTEXT_CALLSTACK_SESSION_IS_ATTACH, CONTEXT_DEBUG_STATE, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, getStateLabel, IDebugModel, IDebugService, IDebugSession, IRawStoppedDetails, isFrameDeemphasized, IStackFrame, IThread, State } from '../common/debug.js';
import { StackFrame, Thread, ThreadAndSessionIds } from '../common/debugModel.js';
import { isSessionAttach } from '../common/debugUtils.js';
import { renderViewTree } from './baseDebugView.js';
import { CONTINUE_ID, CONTINUE_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, PAUSE_ID, PAUSE_LABEL, RESTART_LABEL, RESTART_SESSION_ID, STEP_INTO_ID, STEP_INTO_LABEL, STEP_OUT_ID, STEP_OUT_LABEL, STEP_OVER_ID, STEP_OVER_LABEL, STOP_ID, STOP_LABEL } from './debugCommands.js';
import * as icons from './debugIcons.js';
import { createDisconnectMenuItemAction } from './debugToolBar.js';
import { CALLSTACK_VIEW_ID, CONTEXT_CALLSTACK_FOCUSED, CONTEXT_CALLSTACK_ITEM_STOPPED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD, CONTEXT_CALLSTACK_SESSION_IS_ATTACH, CONTEXT_DEBUG_STATE, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, getStateLabel, IDebugModel, IDebugService, IDebugSession, IRawStoppedDetails, isFrameDeemphasized, IStackFrame, IThread, State } from '../common/debug.js';
import { StackFrame, Thread, ThreadAndSessionIds } from '../common/debugModel.js';
import { isSessionAttach } from '../common/debugUtils.js';
import { getDefaultHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegateFactory.js';
import type { IManagedHover } from '../../../../base/browser/ui/hover/hover.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
const $ = dom.$;
type CallStackItem = IStackFrame | IThread | IDebugSession | string | ThreadAndSessionIds | IStackFrame[];
function assignSessionContext(element: IDebugSession, context: any) {
context.sessionId = element.getId();
return context;
interface ICallStackItemContext {
sessionId: string;
threadId?: string;
frameId?: string;
frameName?: string;
frameLocation?: { range: IRange; source: DebugProtocol.Source };
}
function assignThreadContext(element: IThread, context: any) {
context.threadId = element.getId();
assignSessionContext(element.session, context);
return context;
function getSessionContext(element: IDebugSession): ICallStackItemContext {
return {
sessionId: element.getId()
};
}
function assignStackFrameContext(element: StackFrame, context: any) {
context.frameId = element.getId();
context.frameName = element.name;
context.frameLocation = { range: element.range, source: element.source.raw };
assignThreadContext(element.thread, context);
return context;
function getThreadContext(element: IThread): ICallStackItemContext {
return {
...getSessionContext(element.session),
threadId: element.getId()
};
}
export function getContext(element: CallStackItem | null) {
function getStackFrameContext(element: StackFrame): ICallStackItemContext {
return {
...getThreadContext(element.thread),
frameId: element.getId(),
frameName: element.name,
frameLocation: { range: element.range, source: element.source.raw }
};
}
export function getContext(element: CallStackItem | null): ICallStackItemContext | undefined {
if (element instanceof StackFrame) {
return assignStackFrameContext(element, {});
return getStackFrameContext(element);
} else if (element instanceof Thread) {
return assignThreadContext(element, {});
return getThreadContext(element);
} else if (isDebugSession(element)) {
return assignSessionContext(element, {});
return getSessionContext(element);
} else {
return undefined;
}
@@ -340,7 +352,7 @@ export class CallStackView extends ViewPane {
this.onCallStackChangeScheduler.schedule();
}
}));
const onFocusChange = Event.any<any>(this.debugService.getViewModel().onDidFocusStackFrame, this.debugService.getViewModel().onDidFocusSession);
const onFocusChange = Event.any<unknown>(this.debugService.getViewModel().onDidFocusStackFrame, this.debugService.getViewModel().onDidFocusSession);
this._register(onFocusChange(async () => {
if (this.ignoreFocusStackFrameEvent) {
return;
@@ -451,7 +463,7 @@ export class CallStackView extends ViewPane {
private onContextMenu(e: ITreeContextMenuEvent<CallStackItem>): void {
const element = e.element;
let overlay: [string, any][] = [];
let overlay: [string, ContextKeyValue][] = [];
if (isDebugSession(element)) {
overlay = getSessionContextOverlay(element);
} else if (element instanceof Thread) {
@@ -511,7 +523,7 @@ interface IStackFrameTemplateData {
elementDisposables: DisposableStore;
}
function getSessionContextOverlay(session: IDebugSession): [string, any][] {
function getSessionContextOverlay(session: IDebugSession): [string, ContextKeyValue][] {
return [
[CONTEXT_CALLSTACK_ITEM_TYPE.key, 'session'],
[CONTEXT_CALLSTACK_SESSION_IS_ATTACH.key, isSessionAttach(session)],
@@ -627,7 +639,7 @@ class SessionsRenderer implements ICompressibleTreeRenderer<IDebugSession, Fuzzy
}
}
function getThreadContextOverlay(thread: IThread): [string, any][] {
function getThreadContextOverlay(thread: IThread): [string, ContextKeyValue][] {
return [
[CONTEXT_CALLSTACK_ITEM_TYPE.key, 'thread'],
[CONTEXT_CALLSTACK_ITEM_STOPPED.key, thread.stopped]
@@ -688,7 +700,7 @@ class ThreadsRenderer implements ICompressibleTreeRenderer<IThread, FuzzyScore,
throw new Error('Method not implemented.');
}
disposeElement(_element: any, _index: number, templateData: IThreadTemplateData): void {
disposeElement(_element: ITreeNode<IThread, FuzzyScore>, _index: number, templateData: IThreadTemplateData): void {
templateData.elementDisposable.clear();
}
@@ -697,7 +709,7 @@ class ThreadsRenderer implements ICompressibleTreeRenderer<IThread, FuzzyScore,
}
}
function getStackFrameContextOverlay(stackFrame: IStackFrame): [string, any][] {
function getStackFrameContextOverlay(stackFrame: IStackFrame): [string, ContextKeyValue][] {
return [
[CONTEXT_CALLSTACK_ITEM_TYPE.key, 'stackFrame'],
[CONTEXT_STACK_FRAME_SUPPORTS_RESTART.key, stackFrame.canRestart]
@@ -924,12 +936,12 @@ function stoppedDescription(stoppedDetails: IRawStoppedDetails): string {
(stoppedDetails.reason ? localize({ key: 'pausedOn', comment: ['indicates reason for program being paused'] }, "Paused on {0}", stoppedDetails.reason) : localize('paused', "Paused"));
}
function isDebugModel(obj: any): obj is IDebugModel {
return typeof obj.getSessions === 'function';
function isDebugModel(obj: unknown): obj is IDebugModel {
return !!obj && typeof (obj as IDebugModel).getSessions === 'function';
}
function isDebugSession(obj: any): obj is IDebugSession {
return obj && typeof obj.getAllThreads === 'function';
function isDebugSession(obj: unknown): obj is IDebugSession {
return !!obj && typeof (obj as IDebugSession).getAllThreads === 'function';
}
class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem> {
@@ -1008,7 +1020,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
}
private async getThreadCallstack(thread: Thread): Promise<Array<IStackFrame | string | ThreadAndSessionIds>> {
let callStack: any[] = thread.getCallStack();
let callStack: Array<IStackFrame | string | ThreadAndSessionIds> = thread.getCallStack();
if (!callStack || !callStack.length) {
await thread.fetchCallStack();
callStack = thread.getCallStack();

View File

@@ -8,7 +8,7 @@ import { VSBuffer } from '../../../../base/common/buffer.js';
import { CancellationToken } from '../../../../base/common/cancellation.js';
import { Color } from '../../../../base/common/color.js';
import { Event } from '../../../../base/common/event.js';
import { IJSONSchemaSnippet } from '../../../../base/common/jsonSchema.js';
import { IJSONSchema, IJSONSchemaSnippet } from '../../../../base/common/jsonSchema.js';
import { IDisposable } from '../../../../base/common/lifecycle.js';
import severity from '../../../../base/common/severity.js';
import { URI, UriComponents, URI as uri } from '../../../../base/common/uri.js';
@@ -459,7 +459,7 @@ export interface IDebugSession extends ITreeElement, IDisposable {
scopes(frameId: number, threadId: number): Promise<DebugProtocol.ScopesResponse | undefined>;
variables(variablesReference: number, threadId: number | undefined, filter: 'indexed' | 'named' | undefined, start: number | undefined, count: number | undefined): Promise<DebugProtocol.VariablesResponse | undefined>;
evaluate(expression: string, frameId?: number, context?: string, location?: IDebugEvaluatePosition): Promise<DebugProtocol.EvaluateResponse | undefined>;
customRequest(request: string, args: any): Promise<DebugProtocol.Response | undefined>;
customRequest(request: string, args: unknown): Promise<DebugProtocol.Response | undefined>;
cancel(progressId: string): Promise<DebugProtocol.CancelResponse | undefined>;
disassemble(memoryReference: string, offset: number, instructionOffset: number, instructionCount: number): Promise<DebugProtocol.DisassembledInstruction[] | undefined>;
readMemory(memoryReference: string, offset: number, count: number): Promise<DebugProtocol.ReadMemoryResponse | undefined>;
@@ -538,14 +538,14 @@ export interface IThread extends ITreeElement {
*/
readonly stopped: boolean;
next(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;
stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;
stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;
stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;
continue(): Promise<any>;
pause(): Promise<any>;
terminate(): Promise<any>;
reverseContinue(): Promise<any>;
next(granularity?: DebugProtocol.SteppingGranularity): Promise<void>;
stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<void>;
stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<void>;
stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<void>;
continue(): Promise<void>;
pause(): Promise<void>;
terminate(): Promise<void>;
reverseContinue(): Promise<void>;
}
export interface IScope extends IExpressionContainer {
@@ -567,7 +567,7 @@ export interface IStackFrame extends ITreeElement {
getScopes(): Promise<IScope[]>;
getMostSpecificScopes(range: IRange): Promise<ReadonlyArray<IScope>>;
forgetScopes(): void;
restart(): Promise<any>;
restart(): Promise<void>;
toString(): string;
openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<IEditorPane | undefined>;
equals(other: IStackFrame): boolean;
@@ -630,7 +630,7 @@ export interface IBreakpoint extends IBaseBreakpoint {
readonly endLineNumber?: number;
readonly column?: number;
readonly endColumn?: number;
readonly adapterData: any;
readonly adapterData: unknown;
readonly sessionAgnosticData: { lineNumber: number; column: number | undefined };
/** An ID of the breakpoint that triggers this breakpoint. */
readonly triggeredBy?: string;
@@ -865,7 +865,7 @@ export interface IConfig extends IEnvConfig {
// internals
__configurationTarget?: ConfigurationTarget;
__sessionId?: string;
__restart?: any;
__restart?: unknown;
__autoAttach?: boolean;
port?: number; // TODO
}
@@ -886,7 +886,7 @@ export interface IDebugAdapter extends IDisposable {
startSession(): Promise<void>;
sendMessage(message: DebugProtocol.ProtocolMessage): void;
sendResponse(response: DebugProtocol.Response): void;
sendRequest(command: string, args: any, clb: (result: DebugProtocol.Response) => void, timeout?: number): number;
sendRequest(command: string, args: unknown, clb: (result: DebugProtocol.Response) => void, timeout?: number): number;
stopSession(): Promise<void>;
}
@@ -952,8 +952,8 @@ export interface IDebuggerContribution extends IPlatformSpecificAdapterContribut
languages?: string[];
// debug configuration support
configurationAttributes?: any;
initialConfigurations?: any[];
configurationAttributes?: Record<string, IJSONSchema>;
initialConfigurations?: unknown[];
configurationSnippets?: IJSONSchemaSnippet[];
variables?: { [key: string]: string };
when?: string;
@@ -1036,7 +1036,7 @@ export interface IConfigurationManager {
registerDebugConfigurationProvider(debugConfigurationProvider: IDebugConfigurationProvider): IDisposable;
unregisterDebugConfigurationProvider(debugConfigurationProvider: IDebugConfigurationProvider): void;
resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: any, token: CancellationToken): Promise<any>;
resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: unknown, token: CancellationToken): Promise<IConfig | null | undefined>;
}
export enum DebuggerString {
@@ -1207,7 +1207,7 @@ export interface IDebugService {
* Removes all breakpoints. If id is passed only removes the breakpoint associated with that id.
* Notifies debug adapter of breakpoint changes.
*/
removeBreakpoints(id?: string): Promise<any>;
removeBreakpoints(id?: string): Promise<void>;
/**
* Adds a new function breakpoint for the given name.
@@ -1268,12 +1268,12 @@ export interface IDebugService {
* Sends all breakpoints to the passed session.
* If session is not passed, sends all breakpoints to each session.
*/
sendAllBreakpoints(session?: IDebugSession): Promise<any>;
sendAllBreakpoints(session?: IDebugSession): Promise<void>;
/**
* Sends breakpoints of the given source to the passed session.
*/
sendBreakpoints(modelUri: uri, sourceModified?: boolean, session?: IDebugSession): Promise<any>;
sendBreakpoints(modelUri: uri, sourceModified?: boolean, session?: IDebugSession): Promise<void>;
/**
* Adds a new watch expression and evaluates it against the debug adapter.
@@ -1308,12 +1308,12 @@ export interface IDebugService {
/**
* Restarts a session or creates a new one if there is no active session.
*/
restartSession(session: IDebugSession, restartData?: any): Promise<any>;
restartSession(session: IDebugSession, restartData?: unknown): Promise<void>;
/**
* Stops the session. If no session is specified then all sessions are stopped.
*/
stopSession(session: IDebugSession | undefined, disconnect?: boolean, suspend?: boolean): Promise<any>;
stopSession(session: IDebugSession | undefined, disconnect?: boolean, suspend?: boolean): Promise<void>;
/**
* Makes unavailable all sources with the passed uri. Source will appear as grayed out in callstack view.
@@ -1346,7 +1346,7 @@ export const enum BreakpointWidgetContext {
export interface IDebugEditorContribution extends editorCommon.IEditorContribution {
showHover(range: Position, focus: boolean): Promise<void>;
addLaunchConfiguration(): Promise<any>;
addLaunchConfiguration(): Promise<void>;
closeExceptionWidget(): void;
}

View File

@@ -394,7 +394,7 @@ export class Variable extends ExpressionContainer implements IExpression {
return this.threadId;
}
async setVariable(value: string, stackFrame: IStackFrame): Promise<any> {
async setVariable(value: string, stackFrame: IStackFrame): Promise<void> {
if (!this.session) {
return;
}
@@ -717,35 +717,35 @@ export class Thread implements IThread {
return Promise.resolve(undefined);
}
next(granularity?: DebugProtocol.SteppingGranularity): Promise<any> {
next(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
return this.session.next(this.threadId, granularity);
}
stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<any> {
stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
return this.session.stepIn(this.threadId, undefined, granularity);
}
stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<any> {
stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
return this.session.stepOut(this.threadId, granularity);
}
stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<any> {
stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
return this.session.stepBack(this.threadId, granularity);
}
continue(): Promise<any> {
continue(): Promise<void> {
return this.session.continue(this.threadId);
}
pause(): Promise<any> {
pause(): Promise<void> {
return this.session.pause(this.threadId);
}
terminate(): Promise<any> {
terminate(): Promise<void> {
return this.session.terminateThreads([this.threadId]);
}
reverseContinue(): Promise<any> {
reverseContinue(): Promise<void> {
return this.session.reverseContinue(this.threadId);
}
}
@@ -987,14 +987,14 @@ export interface IBreakpointOptions extends IBaseBreakpointOptions {
uri: uri;
lineNumber: number;
column: number | undefined;
adapterData: any;
adapterData: unknown;
triggeredBy: string | undefined;
}
export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
private sessionsDidTrigger?: Set<string>;
private readonly _uri: uri;
private _adapterData: any;
private _adapterData: unknown;
private _lineNumber: number;
private _column: number | undefined;
public triggeredBy: string | undefined;
@@ -1064,7 +1064,7 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
return super.message;
}
get adapterData(): any {
get adapterData(): unknown {
return this.data && this.data.source && this.data.source.adapterData ? this.data.source.adapterData : this._adapterData;
}

View File

@@ -241,10 +241,9 @@ export class Debugger implements IDebugger, IDebuggerMetadata {
}
// fill in the default configuration attributes shared by all adapters.
return Object.keys(this.debuggerContribution.configurationAttributes).map(request => {
return Object.entries(this.debuggerContribution.configurationAttributes).map(([request, attributes]) => {
const definitionId = `${this.type}:${request}`;
const platformSpecificDefinitionId = `${this.type}:${request}:platform`;
const attributes: IJSONSchema = this.debuggerContribution.configurationAttributes[request];
const defaultRequired = ['name', 'type', 'request'];
attributes.required = attributes.required && attributes.required.length ? defaultRequired.concat(attributes.required) : defaultRequired;
attributes.additionalProperties = false;

View File

@@ -415,19 +415,19 @@ suite('Debug - CallStack', () => {
model.addSession(session);
const { firstStackFrame, secondStackFrame } = createTwoStackFrames(session);
let context = getContext(firstStackFrame);
assert.strictEqual(context.sessionId, firstStackFrame.thread.session.getId());
assert.strictEqual(context.threadId, firstStackFrame.thread.getId());
assert.strictEqual(context.frameId, firstStackFrame.getId());
assert.strictEqual(context?.sessionId, firstStackFrame.thread.session.getId());
assert.strictEqual(context?.threadId, firstStackFrame.thread.getId());
assert.strictEqual(context?.frameId, firstStackFrame.getId());
context = getContext(secondStackFrame.thread);
assert.strictEqual(context.sessionId, secondStackFrame.thread.session.getId());
assert.strictEqual(context.threadId, secondStackFrame.thread.getId());
assert.strictEqual(context.frameId, undefined);
assert.strictEqual(context?.sessionId, secondStackFrame.thread.session.getId());
assert.strictEqual(context?.threadId, secondStackFrame.thread.getId());
assert.strictEqual(context?.frameId, undefined);
context = getContext(session);
assert.strictEqual(context.sessionId, session.getId());
assert.strictEqual(context.threadId, undefined);
assert.strictEqual(context.frameId, undefined);
assert.strictEqual(context?.sessionId, session.getId());
assert.strictEqual(context?.threadId, undefined);
assert.strictEqual(context?.frameId, undefined);
let contributedContext = getContextForContributedActions(firstStackFrame);
assert.strictEqual(contributedContext, firstStackFrame.source.raw.path);

View File

@@ -6,7 +6,7 @@
import assert from 'assert';
import { join, normalize } from '../../../../../base/common/path.js';
import * as platform from '../../../../../base/common/platform.js';
import { IDebugAdapterExecutable, IConfig, IDebugSession, IAdapterManager } from '../../common/debug.js';
import { IDebugAdapterExecutable, IConfig, IDebugSession, IAdapterManager, IDebuggerContribution } from '../../common/debug.js';
import { Debugger } from '../../common/debugger.js';
import { TestConfigurationService } from '../../../../../platform/configuration/test/common/testConfigurationService.js';
import { URI } from '../../../../../base/common/uri.js';
@@ -20,7 +20,7 @@ suite('Debug - Debugger', () => {
let _debugger: Debugger;
const extensionFolderPath = '/a/b/c/';
const debuggerContribution = {
const debuggerContribution: IDebuggerContribution = {
type: 'mock',
label: 'Mock Debug',
program: './out/mock/mockDebug.js',
@@ -157,7 +157,7 @@ suite('Debug - Debugger', () => {
const ae = ExecutableDebugAdapter.platformAdapterExecutable([extensionDescriptor0], 'mock');
assert.strictEqual(ae!.command, join(extensionFolderPath, debuggerContribution.program));
assert.strictEqual(ae!.command, join(extensionFolderPath, debuggerContribution.program!));
assert.deepStrictEqual(ae!.args, debuggerContribution.args);
});