Skip to content

Commit

Permalink
Disable debug context menu items in chat codeblocks (microsoft#224635)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Aug 2, 2024
1 parent 5eab756 commit 69c99aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/vs/workbench/contrib/debug/browser/debugCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { showLoadedScriptMenu } from 'vs/workbench/contrib/debug/common/loadedSc
import { showDebugSessionMenu } from 'vs/workbench/contrib/debug/browser/debugSessionPicker';
import { TEXT_FILE_EDITOR_ID } from 'vs/workbench/contrib/files/common/files';
import { ILocalizedString } from 'vs/platform/action/common/action';
import { CONTEXT_IN_CHAT_SESSION } from 'vs/workbench/contrib/chat/common/chatContextKeys';

export const ADD_CONFIGURATION_ID = 'debug.addConfiguration';
export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint';
Expand Down Expand Up @@ -1009,7 +1010,11 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
title: nls.localize('addInlineBreakpoint', "Add Inline Breakpoint"),
category: DEBUG_COMMAND_CATEGORY
},
when: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, PanelFocusContext.toNegated(), EditorContextKeys.editorTextFocus),
when: ContextKeyExpr.and(
CONTEXT_IN_DEBUG_MODE,
PanelFocusContext.toNegated(),
EditorContextKeys.editorTextFocus,
CONTEXT_IN_CHAT_SESSION.toNegated()),
group: 'debug',
order: 1
});
Expand Down
18 changes: 15 additions & 3 deletions src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { PanelFocusContext } from 'vs/workbench/common/contextkeys';
import { CONTEXT_IN_CHAT_SESSION } from 'vs/workbench/contrib/chat/common/chatContextKeys';
import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpointsView';
import { DisassemblyView } from 'vs/workbench/contrib/debug/browser/disassemblyView';
import { Repl } from 'vs/workbench/contrib/debug/browser/repl';
Expand Down Expand Up @@ -304,7 +305,12 @@ export class RunToCursorAction extends EditorAction {
id: RunToCursorAction.ID,
label: RunToCursorAction.LABEL.value,
alias: 'Debug: Run to Cursor',
precondition: ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, PanelFocusContext.toNegated(), ContextKeyExpr.or(EditorContextKeys.editorTextFocus, CONTEXT_DISASSEMBLY_VIEW_FOCUS)),
precondition: ContextKeyExpr.and(
CONTEXT_DEBUGGERS_AVAILABLE,
PanelFocusContext.toNegated(),
ContextKeyExpr.or(EditorContextKeys.editorTextFocus, CONTEXT_DISASSEMBLY_VIEW_FOCUS),
CONTEXT_IN_CHAT_SESSION.negate()
),
contextMenuOpts: {
group: 'debug',
order: 2,
Expand Down Expand Up @@ -345,7 +351,10 @@ export class SelectionToReplAction extends EditorAction {
id: SelectionToReplAction.ID,
label: SelectionToReplAction.LABEL.value,
alias: 'Debug: Evaluate in Console',
precondition: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus),
precondition: ContextKeyExpr.and(
CONTEXT_IN_DEBUG_MODE,
EditorContextKeys.editorTextFocus,
CONTEXT_IN_CHAT_SESSION.negate()),
contextMenuOpts: {
group: 'debug',
order: 0
Expand Down Expand Up @@ -385,7 +394,10 @@ export class SelectionToWatchExpressionsAction extends EditorAction {
id: SelectionToWatchExpressionsAction.ID,
label: SelectionToWatchExpressionsAction.LABEL.value,
alias: 'Debug: Add to Watch',
precondition: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus),
precondition: ContextKeyExpr.and(
CONTEXT_IN_DEBUG_MODE,
EditorContextKeys.editorTextFocus,
CONTEXT_IN_CHAT_SESSION.negate()),
contextMenuOpts: {
group: 'debug',
order: 1
Expand Down

0 comments on commit 69c99aa

Please sign in to comment.