File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
positronAssistant/browser Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,12 @@ export function registerChatCodeBlockActions() {
371
371
ChatContextKeys . inChatSession ,
372
372
ContextKeyExpr . or ( ...shellLangIds . map ( e => ContextKeyExpr . equals ( EditorContextKeys . languageId . key , e ) ) )
373
373
) ,
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
+ /*
374
380
},
375
381
{
376
382
id: MenuId.ChatCodeBlock,
@@ -381,6 +387,8 @@ export function registerChatCodeBlockActions() {
381
387
...shellLangIds.map(e => ContextKeyExpr.notEquals(EditorContextKeys.languageId.key, e))
382
388
)
383
389
}],
390
+ */
391
+ // --- End Positron ---
384
392
keybinding : [ {
385
393
primary : KeyMod . CtrlCmd | KeyMod . Alt | KeyCode . Enter ,
386
394
mac : {
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import { ILogService } from '../../../../platform/log/common/log.js';
20
20
import { INotificationService } from '../../../../platform/notification/common/notification.js' ;
21
21
import { ChatAgentLocation } from '../../chat/common/constants.js' ;
22
22
import { CodeAttributionSource , IConsoleCodeAttribution } from '../../../services/positronConsole/common/positronConsoleCodeExecution.js' ;
23
+ import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js' ;
24
+
25
+ const consoleLanguageIds = [ 'r' , 'python' ] ;
23
26
24
27
class PositronAssistantContribution extends Disposable implements IWorkbenchContribution {
25
28
constructor (
@@ -44,7 +47,12 @@ class PositronAssistantContribution extends Disposable implements IWorkbenchCont
44
47
order : 5 ,
45
48
when : ContextKeyExpr . and (
46
49
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
+ ) ,
48
56
} ,
49
57
} ) ;
50
58
}
You can’t perform that action at this time.
0 commit comments