@@ -157,16 +157,7 @@ export class Session {
157157 public async updateFilesPaths ( params : UpdateFilesPathsParams ) {
158158 const { tabID, filePaths, deletedFiles, messageId, disableFileActions = false } = params
159159 this . messenger . updateFileComponent ( tabID , filePaths , deletedFiles , messageId , disableFileActions )
160- const allFiles = [ ...filePaths , ...deletedFiles ]
161- if ( allFiles . some ( ( file ) => file . rejected || file . changeApplied ) ) {
162- if ( allFiles . every ( ( file ) => file . rejected || file . changeApplied ) ) {
163- await this . updateChatAnswer ( tabID , i18n ( 'AWS.amazonq.featureDev.pillText.continue' ) )
164- } else {
165- await this . updateChatAnswer ( tabID , i18n ( 'AWS.amazonq.featureDev.pillText.acceptRemainingChanges' ) )
166- }
167- } else {
168- await this . updateChatAnswer ( tabID , i18n ( 'AWS.amazonq.featureDev.pillText.acceptAllChanges' ) )
169- }
160+ await this . updateChatAnswer ( tabID , this . getInsertCodePillText ( [ ...filePaths , ...deletedFiles ] ) )
170161 }
171162
172163 public async updateChatAnswer ( tabID : string , insertCodePillText : string ) {
@@ -272,6 +263,16 @@ export class Session {
272263 this . _acceptCodeTelemetrySent = sent
273264 }
274265
266+ public getInsertCodePillText ( files : Array < NewFileInfo | DeletedFileInfo > ) {
267+ if ( files . every ( ( file ) => file . rejected || file . changeApplied ) ) {
268+ return i18n ( 'AWS.amazonq.featureDev.pillText.continue' )
269+ }
270+ if ( files . some ( ( file ) => file . rejected || file . changeApplied ) ) {
271+ return i18n ( 'AWS.amazonq.featureDev.pillText.acceptRemainingChanges' )
272+ }
273+ return i18n ( 'AWS.amazonq.featureDev.pillText.acceptAllChanges' )
274+ }
275+
275276 get state ( ) {
276277 if ( ! this . _state ) {
277278 throw new Error ( "State should be initialized before it's read" )
0 commit comments