Closed statik closed 9 months ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
This should definitely be configurable, but we currently don't have much infrastructure for setting or communicating the preference.
Here's a quick brain dump of an idea:
We could use |>
as the default but have the Shiny server report the R version on startup. If using R < 4.1, we could update the shortcut to use %>%
. This would be handled via session$sendCustomMessage('learnr-r-version', R.version)
in the R side and a custom message handler on the client side (set via Shiny.addCustomMessageHandler('learnr-r-version', function(data) { ... }
).
We could then make this configurable in the YAML header of the tutorial. (I'd be tempted to have it be an argument to tutorial()
, but then we'd also want that argument to cover other shortcuts.) When rendering the tutorial, we'd add a Shiny pre-rendered chunk to the document that would encode this option, or choose based on R version.
So instead of sending the R version to the client, we'd read it on the R side and decide there which shortcut to use. But the communication pathway would be the same.
@statik thanks for this PR! I ended up going in a slightly different direction in #804 that allows the pipe to be set at the level of a tutorial or even at the level of a specific exercise. Let me know what you think!
This change updates the keyboard shortcuts in interactive tutorials to insert the native pipe instead of magrittr pipe.
If you would like this to be a configurable option, I'm happy to do more work to make it configurable - it wasn't obvious to me how to make this configurable at first.
I got some failures from
devtools::check()
but doubt those are related to my changes, I am unsure if I have my local dev environment correctly configured.PR task list:
devtools::document()