I am using TMB:::setupRStudio() , and I must admit that the compiler sometimes hang for me as well.
However, I had not made the connection to TMB:::setupRStudio() , so that is useful to know.
I tried to include the code you quoted, and it does not cause problems for me (in fact I have
not seen any pattern in what is causing the compiler to hang).
I am inclined to wait and see if the problem goes away in future versions of Rstudio.