Skip to content

Commit

Permalink
debug commands: better fix for checking if threadId is a number
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Oct 10, 2019
1 parent f51b408 commit 7152672
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/vs/workbench/contrib/debug/browser/debugCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ export const DISCONNECT_LABEL = nls.localize('disconnect', "Disconnect");
export const STOP_LABEL = nls.localize('stop', "Stop");
export const CONTINUE_LABEL = nls.localize('continueDebug', "Continue");

function getThreadAndRun(accessor: ServicesAccessor, threadIdArg: number | any, run: (thread: IThread) => Promise<void>): void {
function getThreadAndRun(accessor: ServicesAccessor, threadId: number | any, run: (thread: IThread) => Promise<void>): void {
const debugService = accessor.get(IDebugService);
const threadId = typeof threadIdArg === 'number' ? threadIdArg : undefined;
let thread: IThread | undefined;
if (threadId) {
if (typeof threadId === 'number') {
debugService.getModel().getSessions().forEach(s => {
if (!thread) {
thread = s.getThread(threadId);
Expand Down Expand Up @@ -105,6 +104,10 @@ function getFrame(debugService: IDebugService, frameId: string | undefined): ISt

export function registerCommands(): void {

// These commands are used in call stack context menu, call stack inline actions, command pallete, debug toolbar, mac native touch bar
// When the command is exectued in the context of a thread(context menu on a thread, inline call stack action) we pass the thread id
// Otherwise when it is executed "globaly"(using the touch bar, debug toolbar, command pallete) we do not pass any id and just take whatever is the focussed thread
// Same for stackFrame commands and session commands.
CommandsRegistry.registerCommand({
id: COPY_STACK_TRACE_ID,
handler: async (accessor: ServicesAccessor, _: string, frameId: string | undefined) => {
Expand Down

0 comments on commit 7152672

Please sign in to comment.