diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | apheleia-formatters.el | 2 | ||||
| -rw-r--r-- | test/formatters/installers/r-styler.bash | 2 | ||||
| -rw-r--r-- | test/formatters/samplecode/r-styler/in.R | 15 | ||||
| -rw-r--r-- | test/formatters/samplecode/r-styler/out.R | 12 |
5 files changed, 32 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e5b83..43746aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog]. * [hurlfmt](https://hurl.dev) for hurl files. * [csharpier](https://github.com/belav/csharpier) for C#. * [taplo](https://taplo.tamasfe.dev/) for TOML. +* [styler](https://styler.r-lib.org/) for R. ## 4.4.1 (released 2025-05-13) ### Enhancements diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 581a9a1..e847716 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -174,6 +174,8 @@ (robotidy . ("robotidy" "--no-color" "-" (apheleia-formatters-indent nil "--indent") (apheleia-formatters-fill-column "--line-length"))) + (r-styler . ("R" "--no-echo" "--no-save" "--no-restore" "-e" + "styler::style_text(readLines(file('stdin')))")) (python3-json . ("python3" "-m" "json.tool" (apheleia-formatters-indent "--tab" "--indent"))) diff --git a/test/formatters/installers/r-styler.bash b/test/formatters/installers/r-styler.bash new file mode 100644 index 0000000..3e7f41d --- /dev/null +++ b/test/formatters/installers/r-styler.bash @@ -0,0 +1,2 @@ +apt-get install -y r-base-core +R --no-echo --no-save --no-restore -e "install.packages('styler')" diff --git a/test/formatters/samplecode/r-styler/in.R b/test/formatters/samplecode/r-styler/in.R new file mode 100644 index 0000000..5a00a8b --- /dev/null +++ b/test/formatters/samplecode/r-styler/in.R @@ -0,0 +1,15 @@ +{ + ((( + 2 + ))) + } + +{ +{ + call( + call1(2, 3), + { + sin(cos(pi)) + } ) + } +} diff --git a/test/formatters/samplecode/r-styler/out.R b/test/formatters/samplecode/r-styler/out.R new file mode 100644 index 0000000..988599b --- /dev/null +++ b/test/formatters/samplecode/r-styler/out.R @@ -0,0 +1,12 @@ +{ + ((( + 2 + ))) +} + +{{ call( + call1(2, 3), + { + sin(cos(pi)) + } +) }} |
