paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
18.02k stars 1.69k forks source link

Consider scanning for search blocks ignoring whitespace #517

Open mikehearn opened 5 months ago

mikehearn commented 5 months ago

I've seen Claude 3 Opus reformat code in search blocks - the code itself is identical except for formatting. Then the block fails to apply. It'd be good to scan for search blocks without paying attention to whitespace.

Example failed block:

 <<<<<<< SEARCH
     @CommandLine.Option(names = ["--disable-email-for-testing"], required = false, description = ["Whether to disable email sending. Only to be used for
 testing."])
     var disableEmail = false
 =======
     @CommandLine.Option(names = ["--disable-email-for-testing"], required = false, description = ["Whether to disable email sending. Only to be used for
 testing."])
     var disableEmail = false

     @CommandLine.Option(names = ["--keystore"], required = false, description = ["Path to the keystore file for SSL"])
     var keystorePath: Path? = null

     @CommandLine.Option(names = ["--keystore-password"], required = false, description = ["Password for the keystore file"])
     var keystorePassword: String? = null
 >>>>>>> REPLACE

Example working block:

 <<<<<<< SEARCH
     @CommandLine.Option(
         names = ["--disable-email-for-testing"],
         required = false,
         description = ["Whether to disable email sending. Only to be used for testing."]
     )
     var disableEmail = false
 =======
     @CommandLine.Option(
         names = ["--disable-email-for-testing"],
         required = false,
         description = ["Whether to disable email sending. Only to be used for testing."]
     )
     var disableEmail = false

     @CommandLine.Option(names = ["--keystore"], required = false, description = ["Path to the keystore file for SSL"])
     var keystorePath: Path? = null

     @CommandLine.Option(names = ["--keystore-password"], required = false, description = ["Password for the keystore file"])
     var keystorePassword: String? = null
 >>>>>>> REPLACE

I wouldn't have cared if it reformatted that to be one line, in the end.

paul-gauthier commented 5 months ago

This is a new thing, I've not seen other models full on reformat the code.