Caching

library(styler)

This is a developer vignette to explain how caching works and what we learned on the way.

The main caching features were implemented in the following two pull requests:

function() {
  # a comment
  x <- 2 # <- change this line
}

another(call)

While #538 also required a lot of thought, this is not necessarily visible in the diff. The main challenge was to figure out how the caching should work conceptually and where we best insert the functionality as well as how to make caching work for edge cases like trailing blank lines etc. For details on the conceptual side and requirements, see #538.

In comparison, the diff in #578 is much larger. We can walk through the main changes introduced here:

For more detailed explanation and documentation, please consult the help files of the internals.