Cody wants to insert a change to the bottom of the file, but that file doesn't have an empty final line
This uncovered two aspects that I've fixed here:
Chat responses don't typically include line spacing, but we do need it here. I've added logic to manually inject a whitespace line if the final line is non-empty.
The responseTransformer for the add command doesn't work effectively. New lines are valuable information here that the LLM is more likely to provide, as we're essentially asking it to continue from the previous cursor position with an instruction.
Test plan
Create edits with the add intent, check that they appear correctly
Create smart applies that add to the bottom of a file with a non-empty final line, check it appears correctly
closes CODY-3243
Description
Initially reported here: https://sourcegraph.slack.com/archives/C05MW2TMYAV/p1723448811005809
Fixes a bug with Smart Apply where:
insert
a change to the bottom of the file, but that file doesn't have an empty final lineThis uncovered two aspects that I've fixed here:
responseTransformer
for theadd
command doesn't work effectively. New lines are valuable information here that the LLM is more likely to provide, as we're essentially asking it to continue from the previous cursor position with an instruction.Test plan
add
intent, check that they appear correctly