I tried to achieve this in the past, I found that there is no way to preserve the state of the compiled code. Since then, I have switched to using Netbeans for the languages I work in and have not regretted it.
I would suggest that smooth state preservation is something necessary only in large coding projects, and in this case it probably is not ideal (therefore why this has not been implemented yet).
source share