@@ -63,6 +63,7 @@ import { IFileService } from '../../../../platform/files/common/files.js';
6363import { IChatAttachmentResolveService } from '../../chat/browser/chatAttachmentResolveService.js' ;
6464import { INotebookService } from '../../notebook/common/notebookService.js' ;
6565import { ICellEditOperation } from '../../notebook/common/notebookCommon.js' ;
66+ import { INotebookEditor } from '../../notebook/browser/notebookBrowser.js' ;
6667
6768export const enum State {
6869 CREATE_SESSION = 'CREATE_SESSION' ,
@@ -242,16 +243,18 @@ export class InlineChatController1 implements IEditorContribution {
242243 // check if this editor is part of a notebook editor
243244 // and iff so, use the notebook location but keep the resolveData
244245 // talk about editor data
245- for ( const notebookEditor of notebookEditorService . listNotebookEditors ( ) ) {
246- for ( const [ , codeEditor ] of notebookEditor . codeEditors ) {
246+ let notebookEditor : INotebookEditor | undefined ;
247+ for ( const editor of notebookEditorService . listNotebookEditors ( ) ) {
248+ for ( const [ , codeEditor ] of editor . codeEditors ) {
247249 if ( codeEditor === this . _editor ) {
250+ notebookEditor = editor ;
248251 location . location = ChatAgentLocation . Notebook ;
249252 break ;
250253 }
251254 }
252255 }
253256
254- const zone = _instaService . createInstance ( InlineChatZoneWidget , location , undefined , this . _editor ) ;
257+ const zone = _instaService . createInstance ( InlineChatZoneWidget , location , undefined , { editor : this . _editor , notebookEditor } ) ;
255258 this . _store . add ( zone ) ;
256259 this . _store . add ( zone . widget . chatWidget . onDidClear ( async ( ) => {
257260 const r = this . joinCurrentRun ( ) ;
@@ -1260,12 +1263,13 @@ export class InlineChatController2 implements IEditorContribution {
12601263
12611264 // inline chat in notebooks
12621265 // check if this editor is part of a notebook editor
1263- // and iff so, use the notebook location but keep the resolveData
1264- // talk about editor data
1265- for ( const notebookEditor of this . _notebookEditorService . listNotebookEditors ( ) ) {
1266- for ( const [ , codeEditor ] of notebookEditor . codeEditors ) {
1266+ // if so, update the location and use the notebook specific widget
1267+ let notebookEditor : INotebookEditor | undefined ;
1268+ for ( const editor of this . _notebookEditorService . listNotebookEditors ( ) ) {
1269+ for ( const [ , codeEditor ] of editor . codeEditors ) {
12671270 if ( codeEditor === this . _editor ) {
12681271 location . location = ChatAgentLocation . Notebook ;
1272+ notebookEditor = editor ;
12691273 break ;
12701274 }
12711275 }
@@ -1279,7 +1283,7 @@ export class InlineChatController2 implements IEditorContribution {
12791283 renderTextEditsAsSummary : _uri => true
12801284 }
12811285 } ,
1282- this . _editor
1286+ { editor : this . _editor , notebookEditor } ,
12831287 ) ;
12841288
12851289 result . domNode . classList . add ( 'inline-chat-2' ) ;
0 commit comments