Had the same thought!
The OpenAI API has davinci-codex, which could probably be trained for refactoring, but it's private beta...
I think this is potentially a great use case, especially "code cleanup" tasks. Train it on several examples of messy code and clean code. I think it would have good results.
Re:The Inherent Limitations of GPT-3
by ganeshkrishnan on Monday November 29, 2021 @10:50PM
(#29388747)
At least for Java, it can't do that. It only adds new code below the one you are typing. You can add a comment and it tries to "code" that comment.
Or more general. E.g. I'm in an graphics editor and move one shape so it touches a line, then another shape in the same way, can an AI understand what I'm trying to do and make all the shapes touch the line?