How to learn more about how RStudio works

I'm really interested in learning more about how the RStudio IDE works and am not sure where I should start.

I cloned the repo and poked around a little bit but I'm way out of my depth. If I want to hack a bit to see if there's an add in or some other thing I can contribute--where should I start?

Thanks!

edit:

  • I didn't realize add-ins were just R functions--to clarify, I'm trying to learn more about how RStudio is put together and how it works. Like, if the IDE were LEGOs, how is it built and why does it work?
  • @jcblum suggested to check out Ace, which RStudio depends on, thanks :+1:

@jonathan shared this:

  • RStudio is basically a client/server app.
  • The client is a Web app written using GWT. You'll see lots of Java in the repo; it's all transpiled to JavaScript.
  • The server is all C++, and makes heavy use of asynchronous and functional utilities supplied by Boost.
  • All of the communication between the client and server occurs via JSON-RPC. If you go to Help | Diagnostics | Request Log you'll see a neat visualization of the chatter between the client and server. Reading this will help you understand how the two pieces work together.
  • The piece that's the most interesting for you (probably) and offers the most opportunities for experimentation and extension is the R Session module, which binds to R itself by loading it as a shared library and wiring up callbacks. This module is called rsession and can be found in src/cpp/session.
5 Likes

On the specific topic of Addins, there's a whole site for that :grin:
https://rstudio.github.io/rstudioaddins/

1 Like

Thanks for the link! I didn't realize these were just R functions :man_facepalming:

I'm more interested in understanding how the app works, how to change little things in the appearance and look, how the menus work, how the other dependencies work together, how R is woven into things, etc.

Getting an idea of where I should start would help me.

There are definitely plenty of people here better positioned than me to answer those questions, but one place to start might be learning about the Ace code editor that powers the editing parts of the IDE:
https://ace.c9.io

3 Likes

That's already a helpful place to start @jcblum :raised_hands:

Thanks!

1 Like

Are you trying to achieve something specific? Or are you just curious about how things work?

We should really have some better docs on the repo's wiki page showing what the major portions are and how they fit together. Here's a quick overview to help you start exploring:

  • RStudio is basically a client/server app.
  • The client is a Web app written using GWT. You'll see lots of Java in the repo; it's all transpiled to JavaScript.
  • The server is all C++, and makes heavy use of asynchronous and functional utilities supplied by Boost.
  • All of the communication between the client and server occurs via JSON-RPC. If you go to Help | Diagnostics | Request Log you'll see a neat visualization of the chatter between the client and server. Reading this will help you understand how the two pieces work together.
  • The piece that's the most interesting for you (probably) and offers the most opportunities for experimentation and extension is the R Session module, which binds to R itself by loading it as a shared library and wiring up callbacks. This module is called rsession and can be found in src/cpp/session.

Happy spelunking! We welcome PRs, questions, and the like. :slight_smile:

7 Likes

Thanks for this @jonathan :pray:

I'm just curious about how things work--I think it started when I tried to see if I could change the IDE theme colors to match my syntax highlighting and when I cloned RStudio and started poking around the structure of the repo, names of those css files, and code was so different and unfamiliar that I asked myself, "how does this even all work!?!?" This kind of started my thinking about it a bit more and why I asked here since I know there's a lot happening under the hood.

I appreciate you taking the time to highlight the important parts!