@@ -188,9 +188,8 @@ export class UIMessageListener {
188
188
} )
189
189
}
190
190
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 {
194
193
command : msg . command ,
195
194
tabID : msg . tabID ,
196
195
messageId : msg . messageId ,
@@ -202,7 +201,16 @@ export class UIMessageListener {
202
201
codeBlockIndex : msg . codeBlockIndex ,
203
202
totalCodeBlocks : msg . totalCodeBlocks ,
204
203
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 ) )
206
214
}
207
215
208
216
private processAcceptDiff ( msg : any ) {
@@ -221,22 +229,6 @@ export class UIMessageListener {
221
229
} )
222
230
}
223
231
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
-
240
232
private processTabWasRemoved ( msg : any ) {
241
233
this . chatControllerMessagePublishers . processTabClosedMessage . publish ( {
242
234
tabID : msg . tabID ,
0 commit comments