@@ -13,6 +13,7 @@ import {
1313 type NewFileInfo ,
1414 type SessionState ,
1515 type SessionStateConfig ,
16+ UpdateFilesPathsParams ,
1617} from '../types'
1718import { ConversationIdNotFoundError } from '../errors'
1819import { referenceLogText } from '../constants'
@@ -153,18 +154,13 @@ export class Session {
153154 return resp . interaction
154155 }
155156
156- public async updateFilesPaths (
157- tabID : string ,
158- filePaths : NewFileInfo [ ] ,
159- deletedFiles : DeletedFileInfo [ ] ,
160- messageId : string ,
161- disableFileActions : boolean = false
162- ) {
157+ public async updateFilesPaths ( params : UpdateFilesPathsParams ) {
158+ const { tabID, filePaths, deletedFiles, messageId, disableFileActions = false } = params
163159 this . messenger . updateFileComponent ( tabID , filePaths , deletedFiles , messageId , disableFileActions )
164160 if ( [ ...filePaths , ...deletedFiles ] . some ( ( file ) => file . rejected || file . changeApplied ) ) {
165- await this . updateChatAnswer ( tabID , 'Accept remaining changes' )
161+ await this . updateChatAnswer ( tabID , i18n ( 'AWS.amazonq.featureDev.pillText.acceptRemainingChanges' ) )
166162 } else {
167- await this . updateChatAnswer ( tabID , 'Accept all changes' )
163+ await this . updateChatAnswer ( tabID , i18n ( 'AWS.amazonq.featureDev.pillText.acceptAllChanges' ) )
168164 }
169165 }
170166
@@ -196,21 +192,23 @@ export class Session {
196192 }
197193
198194 public async insertChanges ( ) {
199- const newFilePaths = this . state . filePaths ?. filter ( ( i ) => ! i . rejected && ! i . changeApplied ) ?? [ ]
195+ const newFilePaths =
196+ this . state . filePaths ?. filter ( ( filePath ) => ! filePath . rejected && ! filePath . changeApplied ) ?? [ ]
200197 await this . insertNewFiles ( newFilePaths )
201198
202- const deletedFiles = this . state . deletedFiles ?. filter ( ( i ) => ! i . rejected && ! i . changeApplied ) ?? [ ]
199+ const deletedFiles =
200+ this . state . deletedFiles ?. filter ( ( deletedFile ) => ! deletedFile . rejected && ! deletedFile . changeApplied ) ?? [ ]
203201 await this . applyDeleteFiles ( deletedFiles )
204202
205203 await this . insertCodeReferenceLogs ( this . state . references ?? [ ] )
206204
207205 if ( this . _codeResultMessageId ) {
208- await this . updateFilesPaths (
209- this . state . tabID ,
210- this . state . filePaths ?? [ ] ,
211- this . state . deletedFiles ?? [ ] ,
212- this . _codeResultMessageId
213- )
206+ await this . updateFilesPaths ( {
207+ tabID : this . state . tabID ,
208+ filePaths : this . state . filePaths ?? [ ] ,
209+ deletedFiles : this . state . deletedFiles ?? [ ] ,
210+ messageId : this . _codeResultMessageId ,
211+ } )
214212 }
215213 }
216214
@@ -247,13 +245,13 @@ export class Session {
247245 return
248246 }
249247
250- await this . updateFilesPaths (
251- this . state . tabID ,
252- this . state . filePaths ?? [ ] ,
253- this . state . deletedFiles ?? [ ] ,
254- this . _codeResultMessageId ,
255- true
256- )
248+ await this . updateFilesPaths ( {
249+ tabID : this . state . tabID ,
250+ filePaths : this . state . filePaths ?? [ ] ,
251+ deletedFiles : this . state . deletedFiles ?? [ ] ,
252+ messageId : this . _codeResultMessageId ,
253+ disableFileActions : true ,
254+ } )
257255 this . _codeResultMessageId = undefined
258256 }
259257
0 commit comments