@@ -281,17 +281,20 @@ public CompletableFuture<ChatCreateResult> createConversation(String workDoneTok
281281 String chatModeName , String customChatModeId , List <TodoItem > todos , String agentSlug ,
282282 String agentJobWorkspaceFolder ) {
283283 return createConversation (workDoneToken , message , files , currentFile , currentSelection , turns , activeModel ,
284- chatModeName , customChatModeId , todos , agentSlug , agentJobWorkspaceFolder , null , null );
284+ chatModeName , customChatModeId , todos , agentSlug , agentJobWorkspaceFolder , null , null ,
285+ LSPEclipseUtils .getWorkspaceFolders ());
285286 }
286287
287288 /**
288- * Create a conversation with the given parameters, including optional conversationId and restoreToTurnId for session
289- * restoration.
289+ * Create a conversation with the given parameters, including optional conversationId, restoreToTurnId for session
290+ * restoration, and optional workspace folders argument .
290291 */
291292 public CompletableFuture <ChatCreateResult > createConversation (String workDoneToken , String message ,
292293 List <IResource > files , IFile currentFile , Range currentSelection , List <Turn > turns , CopilotModel activeModel ,
293294 String chatModeName , String customChatModeId , List <TodoItem > todos , String agentSlug ,
294- String agentJobWorkspaceFolder , String conversationId , String restoreToTurnId ) {
295+ String agentJobWorkspaceFolder , String conversationId , String restoreToTurnId ,
296+ List <WorkspaceFolder > workspaceFolders ) {
297+
295298 boolean supportVision = activeModel .getCapabilities ().supports ().vision ();
296299 Either <String , List <ChatCompletionContentPart >> messageWithImages = ChatMessageUtils
297300 .createMessageWithImages (message , FileUtils .filterFilesFrom (files ), supportVision );
@@ -310,7 +313,7 @@ public CompletableFuture<ChatCreateResult> createConversation(String workDoneTok
310313
311314 if (StringUtils .isBlank (agentSlug )) {
312315 param .setWorkspaceFolder (PlatformUtils .getWorkspaceRootUri ());
313- param .setWorkspaceFolders (LSPEclipseUtils . getWorkspaceFolders () );
316+ param .setWorkspaceFolders (workspaceFolders == null ? List . of () : workspaceFolders );
314317 param .setTodoList (todos );
315318 } else {
316319 // Set agentSlug on the last turn (current user message) after history insertion
@@ -357,6 +360,19 @@ public CompletableFuture<ChatTurnResult> addConversationTurn(String workDoneToke
357360 String message , List <IResource > files , IFile currentFile , Range currentSelection , CopilotModel activeModel ,
358361 String chatModeName , String customChatModeId , List <TodoItem > todoList , String agentSlug ,
359362 String agentJobWorkspaceFolder ) {
363+ return addConversationTurn (workDoneToken , conversationId , message , files , currentFile , currentSelection ,
364+ activeModel , chatModeName , customChatModeId , todoList , agentSlug , agentJobWorkspaceFolder ,
365+ LSPEclipseUtils .getWorkspaceFolders ());
366+ }
367+
368+ /**
369+ * Create a conversation turn with the given parameters, including optional workspace folders argument.
370+ */
371+ public CompletableFuture <ChatTurnResult > addConversationTurn (String workDoneToken , String conversationId ,
372+ String message , List <IResource > files , IFile currentFile , Range currentSelection , CopilotModel activeModel ,
373+ String chatModeName , String customChatModeId , List <TodoItem > todoList , String agentSlug ,
374+ String agentJobWorkspaceFolder , List <WorkspaceFolder > workspaceFolders ) {
375+
360376 boolean supportVision = activeModel .getCapabilities ().supports ().vision ();
361377 Either <String , List <ChatCompletionContentPart >> messageWithImages = ChatMessageUtils
362378 .createMessageWithImages (message , FileUtils .filterFilesFrom (files ), supportVision );
@@ -370,7 +386,7 @@ public CompletableFuture<ChatTurnResult> addConversationTurn(String workDoneToke
370386
371387 if (StringUtils .isBlank (agentSlug )) {
372388 param .setWorkspaceFolder (PlatformUtils .getWorkspaceRootUri ());
373- param .setWorkspaceFolders (LSPEclipseUtils . getWorkspaceFolders () );
389+ param .setWorkspaceFolders (workspaceFolders == null ? List . of () : workspaceFolders );
374390 param .setTodoList (todoList );
375391 } else {
376392 param .setAgentSlug (agentSlug );
0 commit comments