aider icon indicating copy to clipboard operation
aider copied to clipboard

Consider scanning for search blocks ignoring whitespace

Open mikehearn opened this issue 1 year ago • 3 comments

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.

mikehearn avatar Mar 27 '24 19:03 mikehearn

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

paul-gauthier avatar Apr 11 '24 17:04 paul-gauthier