I imagine ChatGPT has so much trouble 'completing' code snippets you give it because a lot of the training data is from forums, where its custom to provide the entire solution with your improvement made, rather than just the change.