Skip to content

Commit 00257c4

Browse files
authored
Merge pull request aws#6854 from ctlai95/workspace-folders
feat(chat): pass workspace folders to IDE context
2 parents abd074f + 735de4e commit 00257c4

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { ChatTriggerType, TriggerPayload } from '../model'
1515
import { undefinedIfEmpty } from '../../../../shared/utilities/textUtilities'
1616
import { tools } from '../../../constants'
17+
import vscode from 'vscode'
1718

1819
const fqnNameSizeDownLimit = 1
1920
const fqnNameSizeUpLimit = 256
@@ -116,7 +117,7 @@ export function triggerPayloadToChatRequest(triggerPayload: TriggerPayload): { c
116117
cursorState,
117118
relevantDocuments,
118119
useRelevantDocuments,
119-
// TODO: Need workspace folders here after model update.
120+
workspaceFolders: vscode.workspace.workspaceFolders?.map(({ uri }) => uri.fsPath) ?? [],
120121
},
121122
additionalContext: triggerPayload.additionalContents,
122123
tools,

src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
100100
* },
101101
* ],
102102
* useRelevantDocuments: true || false,
103+
* workspaceFolders: [ // WorkspaceFolderList
104+
* "STRING_VALUE",
105+
* ],
103106
* },
104107
* shellState: { // ShellState
105108
* shellName: "STRING_VALUE", // required
@@ -287,6 +290,9 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
287290
* },
288291
* ],
289292
* useRelevantDocuments: true || false,
293+
* workspaceFolders: [
294+
* "STRING_VALUE",
295+
* ],
290296
* },
291297
* shellState: {
292298
* shellName: "STRING_VALUE", // required

src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
100100
* },
101101
* ],
102102
* useRelevantDocuments: true || false,
103+
* workspaceFolders: [ // WorkspaceFolderList
104+
* "STRING_VALUE",
105+
* ],
103106
* },
104107
* shellState: { // ShellState
105108
* shellName: "STRING_VALUE", // required
@@ -287,6 +290,9 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
287290
* },
288291
* ],
289292
* useRelevantDocuments: true || false,
293+
* workspaceFolders: [
294+
* "STRING_VALUE",
295+
* ],
290296
* },
291297
* shellState: {
292298
* shellName: "STRING_VALUE", // required

src.gen/@amzn/codewhisperer-streaming/src/commands/SendMessageCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
101101
* },
102102
* ],
103103
* useRelevantDocuments: true || false,
104+
* workspaceFolders: [ // WorkspaceFolderList
105+
* "STRING_VALUE",
106+
* ],
104107
* },
105108
* shellState: { // ShellState
106109
* shellName: "STRING_VALUE", // required
@@ -288,6 +291,9 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
288291
* },
289292
* ],
290293
* useRelevantDocuments: true || false,
294+
* workspaceFolders: [
295+
* "STRING_VALUE",
296+
* ],
291297
* },
292298
* shellState: {
293299
* shellName: "STRING_VALUE", // required

src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,12 @@ export interface EditorState {
12701270
* @public
12711271
*/
12721272
useRelevantDocuments?: boolean | undefined;
1273+
1274+
/**
1275+
* Represents IDE provided list of workspace folders
1276+
* @public
1277+
*/
1278+
workspaceFolders?: (string)[] | undefined;
12731279
}
12741280

12751281
/**
@@ -1289,6 +1295,9 @@ export const EditorStateFilterSensitiveLog = (obj: EditorState): any => ({
12891295
RelevantTextDocumentFilterSensitiveLog(item)
12901296
)
12911297
}),
1298+
...(obj.workspaceFolders && { workspaceFolders:
1299+
SENSITIVE_STRING
1300+
}),
12921301
})
12931302

12941303
/**

src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,8 @@ const de_CommandError = async(
10891089

10901090
// se_UserSettings omitted.
10911091

1092+
// se_WorkspaceFolderList omitted.
1093+
10921094
// se_WorkspaceState omitted.
10931095

10941096
// de_AssistantResponseEvent omitted.

0 commit comments

Comments
 (0)