In RStudio it´s possible to autoformat R Code with CTRL+SHIFT+A (e.g. see this answer). Now my question is, how to autoformat javascript code in RStudio (e.g. if you are working on a shiny app).
Asked
Active
Viewed 173 times
0
-
Auto-formatting of JavaScript code has not yet been implemented in RStudio -- you could consider filing a [feature request](https://github.com/rstudio/rstudio/issues). – Kevin Ushey Feb 25 '19 at 06:33
1 Answers
0
The prettifyAddins package I've just made provides two RStudio addins for JavaScript files and more: an addin which only reindents the code and an addin which prettifies the code, e.g. it adds semi-colons when they are missing. I will submit it to CRAN soon.
Update
I updated prettifyAddins
. It has now addins using the V8
package, and Shiny is not used for these addins, the prettified code directly replaces the current code.
Another possibility is my (freshly built) package aceEditor. It opens the Ace editor in the viewer pane of RStudio:
This provides a second source editor in RStudio. And many languages are supported.

Stéphane Laurent
- 75,186
- 15
- 119
- 225
-
-
@Manuel The R version has no importance, but you need a not too old version of RStudio. – Stéphane Laurent Sep 15 '20 at 19:33