@@ -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