Caching

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(styler)

This is a developer vignette to explain how caching works and what we learned on the way. To use the caching feature, please have a look at the README.

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.



Try the styler package in your browser

Any scripts or data that you put into this service are public.

styler documentation built on Sept. 23, 2021, 5:07 p.m.