Saving tabs upon closing Project

I have just started using Projects and managed to retrieve the workspace, history etc from a previous session (using Open Project). However, I cannot get my new session to open the tabs (and preferably save the window view) from the previous session (I do know it is possible though). I can I get that to work?

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.5.0

If you go to RStudio >> Preferences do you have "Restore previously open source documents at startup" selected? (It's the second radio button in the screenshot below)

Also, what version of RStudio are you running?

Thank you very much, that works. I was searching for this option in the Project Options but missed this.

Do you know whether it is also possible to save 1) the folding of open source documents, and 2) the packages that are attached in the current Project?

With regards to 2), I am aware of the possibility to save a .Rprofile file that allows for attaching packages when opening a Project, but it would be much more handy to be able to go to the exact 'state' of attached packages in the last session.

Thanks for your help!

I don't know about saving the folding of the open source docs. That might be something for which you could submit a feature request (see RStudio IDE Guide: Writing Good Feature Requests).

It's generally speaking not a good practice to count on packages being attached from session to session. You're usually better-served by saving a script of what you're doing so that you can return to the "state" of those packages, if you're referring to ~the order in which they're attached. You can save your workspace by switching that dropdown from "Never" to "Ask" or "Always." If you're talking about "state" of packages in terms of package versions, then that's a whole different matter, with varied solutions depending on your goals.