Skip to content

Commit cbe897b

Browse files
authored
Assistant: Remove "Insert into Terminal" action in non-shell code blocks (#8211)
### Release Notes #### New Features - N/A #### Bug Fixes - Removed the "Insert into Terminal" action in non-shell code blocks (#7751).
1 parent cee6f39 commit cbe897b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ export function registerChatCodeBlockActions() {
371371
ChatContextKeys.inChatSession,
372372
ContextKeyExpr.or(...shellLangIds.map(e => ContextKeyExpr.equals(EditorContextKeys.languageId.key, e)))
373373
),
374+
}],
375+
// --- Start Positron ---
376+
// In code blocks with non-shell languages, don't show this action at all.
377+
// We already have a separate action for running code in the console.
378+
// See: https://github.com/posit-dev/positron/issues/7751.
379+
/*
374380
},
375381
{
376382
id: MenuId.ChatCodeBlock,
@@ -381,6 +387,8 @@ export function registerChatCodeBlockActions() {
381387
...shellLangIds.map(e => ContextKeyExpr.notEquals(EditorContextKeys.languageId.key, e))
382388
)
383389
}],
390+
*/
391+
// --- End Positron ---
384392
keybinding: [{
385393
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter,
386394
mac: {

src/vs/workbench/contrib/positronAssistant/browser/positronAssistant.contribution.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import { ILogService } from '../../../../platform/log/common/log.js';
2020
import { INotificationService } from '../../../../platform/notification/common/notification.js';
2121
import { ChatAgentLocation } from '../../chat/common/constants.js';
2222
import { CodeAttributionSource, IConsoleCodeAttribution } from '../../../services/positronConsole/common/positronConsoleCodeExecution.js';
23+
import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
24+
25+
const consoleLanguageIds = ['r', 'python'];
2326

2427
class PositronAssistantContribution extends Disposable implements IWorkbenchContribution {
2528
constructor(
@@ -44,7 +47,12 @@ class PositronAssistantContribution extends Disposable implements IWorkbenchCont
4447
order: 5,
4548
when: ContextKeyExpr.and(
4649
ContextKeyExpr.equals(ChatContextKeys.location.key, ChatAgentLocation.Panel),
47-
ChatContextKeys.Editing.hasToolConfirmation.toNegated())
50+
ChatContextKeys.Editing.hasToolConfirmation.toNegated(),
51+
// TODO: We should use a context key so that we can dynamically include languages
52+
// that can execute code in the console i.e. with registered interpreters.
53+
// See: https://github.com/posit-dev/positron/issues/8219.
54+
ContextKeyExpr.or(...consoleLanguageIds.map(e => ContextKeyExpr.equals(EditorContextKeys.languageId.key, e))),
55+
),
4856
},
4957
});
5058
}

0 commit comments

Comments
 (0)