Default new document trick & help page update

I attempted to make a new default stan document which would open whenever I opened a new stan file in RStudio. I followed the directions at RStudio User Guide - Custom Settings (for a Mac). Specifically, I added a file "default.stan" to the terminal directory in the Mac directory path (I think I had to create this directory myself).

The new default did not work. The original default document always opened. So to start with, the help page could use updating.

On a whim, I looked "inside" the RStudio application to search for where its default stan document is. Using "Show Package Contents" from the right-click menu, I found this document at "Contents/Resources/app/resources/templates/stan.stan".

Based on that filename, I then changed the name of my original file to "stan.stan". This worked!

There are many other files in the internal RStudio directory, those mentioned on the help page but also many others of different language types. I encourage folks to try this same trick if they also find the help page advice ineffective.

I do not know where the equivalent default directory is in Windows, but I suspect the same trick would apply. I also encourage an update to the help page.

Version info:
RStudio 2024.04.2+764 "Chocolate Cosmos" Release (e4392fc9ddc21961fd1d0efd47484b43f07a4177, 2024-06-05) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2024.04.2+764 Chrome/120.0.6099.291 Electron/28.3.1 Safari/537.36, Quarto 1.4.554 (/Applications/quarto/bin/quarto)


Edit 26 June: Fixed internal RStudio path

1 Like

Thanks for sharing your findings @JohnnyZoom! Would you mind opening an issue for this on the GitHub repo? While it looks like you found a workaround, if the instructions on our docs don't actually work then we either have a bug or a docfix that's needed :slight_smile:


I have opened a new report for this issue here.

1 Like