Skip to content

Commit cec844c

Browse files
committed
Addressing comments
1 parent c5a1466 commit cec844c

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

packages/core/src/codewhispererChat/clients/chat/v0/chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class ChatSession {
7979
public setTempFilePath(tempFilePath: string | undefined) {
8080
this._tempFilePath = tempFilePath
8181
}
82-
public addListOfReadFiles(filePath: string) {
82+
public addToReadFiles(filePath: string) {
8383
this._readFiles.push(filePath)
8484
}
8585
public clearListOfReadFiles() {

packages/core/src/codewhispererChat/view/messages/messageListener.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ export class UIMessageListener {
188188
})
189189
}
190190

191-
private processInsertCodeAtCursorPosition(msg: any) {
192-
this.referenceLogController.addReferenceLog(msg.codeReference, (msg.code as string) ?? '')
193-
this.chatControllerMessagePublishers.processInsertCodeAtCursorPosition.publish({
191+
private createCommonMessagePayload(msg: any) {
192+
return {
194193
command: msg.command,
195194
tabID: msg.tabID,
196195
messageId: msg.messageId,
@@ -202,7 +201,16 @@ export class UIMessageListener {
202201
codeBlockIndex: msg.codeBlockIndex,
203202
totalCodeBlocks: msg.totalCodeBlocks,
204203
codeBlockLanguage: msg.codeBlockLanguage,
205-
})
204+
}
205+
}
206+
private processInsertCodeAtCursorPosition(msg: any) {
207+
this.referenceLogController.addReferenceLog(msg.codeReference, (msg.code as string) ?? '')
208+
this.chatControllerMessagePublishers.processInsertCodeAtCursorPosition.publish(
209+
this.createCommonMessagePayload(msg)
210+
)
211+
}
212+
private processCodeWasCopiedToClipboard(msg: any) {
213+
this.chatControllerMessagePublishers.processCopyCodeToClipboard.publish(this.createCommonMessagePayload(msg))
206214
}
207215

208216
private processAcceptDiff(msg: any) {
@@ -221,22 +229,6 @@ export class UIMessageListener {
221229
})
222230
}
223231

224-
private processCodeWasCopiedToClipboard(msg: any) {
225-
this.chatControllerMessagePublishers.processCopyCodeToClipboard.publish({
226-
command: msg.command,
227-
tabID: msg.tabID,
228-
messageId: msg.messageId,
229-
userIntent: msg.userIntent,
230-
code: msg.code,
231-
insertionTargetType: msg.insertionTargetType,
232-
codeReference: msg.codeReference,
233-
eventId: msg.eventId,
234-
codeBlockIndex: msg.codeBlockIndex,
235-
totalCodeBlocks: msg.totalCodeBlocks,
236-
codeBlockLanguage: msg.codeBlockLanguage,
237-
})
238-
}
239-
240232
private processTabWasRemoved(msg: any) {
241233
this.chatControllerMessagePublishers.processTabClosedMessage.publish({
242234
tabID: msg.tabID,

0 commit comments

Comments
 (0)