Skip to content

Commit 793fd31

Browse files
authored
use a setting in core and set the location to notebook (microsoft#257548)
use a setting in core and set the location from the start
1 parent 3318398 commit 793fd31

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ export class InlineChatController2 implements IEditorContribution {
12401240
@IChatAttachmentResolveService private readonly _chatAttachmentResolveService: IChatAttachmentResolveService,
12411241
@IEditorService private readonly _editorService: IEditorService,
12421242
@IInlineChatSessionService inlineChatService: IInlineChatSessionService,
1243+
@IConfigurationService configurationService: IConfigurationService,
12431244
) {
12441245

12451246
const ctxInlineChatVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
@@ -1270,6 +1271,18 @@ export class InlineChatController2 implements IEditorContribution {
12701271
if (codeEditor === this._editor) {
12711272
location.location = ChatAgentLocation.Notebook;
12721273
notebookEditor = editor;
1274+
// set location2 so that the notebook agent intent is used
1275+
if (configurationService.getValue(InlineChatConfigKeys.notebookAgent)) {
1276+
location.resolveData = () => {
1277+
assertType(this._editor.hasModel());
1278+
1279+
return {
1280+
type: ChatAgentLocation.Notebook,
1281+
sessionInputUri: this._editor.getModel().uri,
1282+
};
1283+
};
1284+
}
1285+
12731286
break;
12741287
}
12751288
}

src/vs/workbench/contrib/inlineChat/common/inlineChat.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const enum InlineChatConfigKeys {
2020
LineEmptyHint = 'inlineChat.lineEmptyHint',
2121
LineNLHint = 'inlineChat.lineNaturalLanguageHint',
2222
EnableV2 = 'inlineChat.enableV2',
23+
notebookAgent = 'inlineChat.notebookAgent',
2324
HideOnRequest = 'inlineChat.hideOnRequest'
2425
}
2526

@@ -77,6 +78,15 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
7778
mode: 'startup'
7879
}
7980
},
81+
[InlineChatConfigKeys.notebookAgent]: {
82+
markdownDescription: localize('notebookAgent', "Enable agent-like behavior for inline chat widget in notebooks. Depends on the `#inlineChat.enableV2#` setting being enabled."),
83+
default: false,
84+
type: 'boolean',
85+
tags: ['experimental'],
86+
experiment: {
87+
mode: 'startup'
88+
}
89+
}
8090
}
8191
});
8292

0 commit comments

Comments
 (0)