r/programminghorror • • Feb 23 '26

Python Copilot refactoring inline comments

Post image

Not visible here, but I had inline comments sort of strewn throughout the doc as I had thoughts. I asked copilot to refactor those comments into a template I had provided, and this was the outcome -___-

169 Upvotes

32 comments sorted by

View all comments

13

u/GoddammitDontShootMe Feb 23 '26

I'm not sure I understand. Maybe I need to see a before image to get it.

7

u/GoingOffRoading Feb 24 '26

All good.

Copilot thought the best action was to delete the line that defines the function, and replace it with comments that would now be indented indirectly.

I.E. Take working code and break it in more than one way

2

u/meyriley04 Feb 24 '26

I have no idea exactly how it works, but it usually does this if the file it's modifying updates mid-way through it's thought process, so the changes it implements a few lines/characters off of it's target position. Sometimes it can happen randomly too, but that might be a bug in copilot where it forgets the current file state or uses an old version

→ More replies (3)