From 1bc8d13f93ae043ac411f9ffab17d77ba8a984eb Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Tue, 9 Aug 2016 16:06:26 +0200 Subject: [PATCH 01/11] first try adding r to atom-beautify --- README.md | 1 + .../nested-jsbeautifyrc/r/original/test.r | 16 +++++++++++++ package.json | 6 ++++- src/beautifiers/index.coffee | 1 + src/beautifiers/r-beautifier/index.coffee | 24 +++++++++++++++++++ src/beautifiers/r-beautifier/r-beautifier.r | 3 +++ src/languages/index.coffee | 1 + src/languages/r.coffee | 23 ++++++++++++++++++ 8 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 examples/nested-jsbeautifyrc/r/original/test.r create mode 100644 src/beautifiers/r-beautifier/index.coffee create mode 100644 src/beautifiers/r-beautifier/r-beautifier.r create mode 100644 src/languages/r.coffee diff --git a/README.md b/README.md index f7cda69..37fc3a5 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | +| R | `R` |`.r` | [`R`](https://cran.r-project.org/) (Default) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | | Sass | `Sass` |`.sass` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | SCSS | `SCSS` |`.scss` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | diff --git a/examples/nested-jsbeautifyrc/r/original/test.r b/examples/nested-jsbeautifyrc/r/original/test.r new file mode 100644 index 0000000..0fb58f6 --- /dev/null +++ b/examples/nested-jsbeautifyrc/r/original/test.r @@ -0,0 +1,16 @@ +# a single line of comments is preserved +1+1 + +if(TRUE){ +x=1 # inline comments +}else{ +x=2;print('Oh no... ask the right bracket to go away!')} +1*3 # one space before this comment will become two! +2+2+2 # 'short comments' + +# only 'single quotes' are allowed in comments +df=data.frame(y=rnorm(100),x1=rnorm(100),x2=rnorm(100)) +lm(y~x1+x2, data=df) +1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 ## comments after a long line + +## here is a long long long long long long long long long long long long long long long long long long long long comment diff --git a/package.json b/package.json index 84e789a..bacb986 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,10 @@ { "name": "Arman Yessenamanov", "url": "https://github.com/yesenarman" + }, + { + "name": "Sebastian DiLorenzo", + "url": "https://github.com/Sebastian-D" } ], "engines": { @@ -270,4 +274,4 @@ "lint": "coffeelint src/ spec/", "code-docs": "codo && open docs/code/index.html" } -} \ No newline at end of file +} diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 0d29b66..a9aab91 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -69,6 +69,7 @@ module.exports = class Beautifiers extends EventEmitter 'yapf' 'erl_tidy' 'marko-beautifier' + 'r-beautifier' ] ### diff --git a/src/beautifiers/r-beautifier/index.coffee b/src/beautifiers/r-beautifier/index.coffee new file mode 100644 index 0000000..e99a779 --- /dev/null +++ b/src/beautifiers/r-beautifier/index.coffee @@ -0,0 +1,24 @@ +### +Requires [formatR](https://github.com/yihui/formatR) +### +path = require("path") + +"use strict" +Beautifier = require('../beautifier') + +module.exports = class R extends Beautifier + name: "R beautifier" + link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/r-beautifier/r-beautifier.r" + + options: { + R: true + } + + beautify: (text, language, options) -> + r_beautifier = path.resolve(__dirname, "r-beautifier.r") + @run("Rscript", [ + r_beautifier, + @tempFile("input", text), + '>', + @tempFile("input", text) + ]) diff --git a/src/beautifiers/r-beautifier/r-beautifier.r b/src/beautifiers/r-beautifier/r-beautifier.r new file mode 100644 index 0000000..4138641 --- /dev/null +++ b/src/beautifiers/r-beautifier/r-beautifier.r @@ -0,0 +1,3 @@ +library(formatR) +file <- commandArgs(trailingOnly = TRUE)[1] +tidy_source(text = readLines(file)) diff --git a/src/languages/index.coffee b/src/languages/index.coffee index 027488b..7e79304 100644 --- a/src/languages/index.coffee +++ b/src/languages/index.coffee @@ -51,6 +51,7 @@ module.exports = class Languages "php" "puppet" "python" + "r" "riotjs" "ruby" "rust" diff --git a/src/languages/r.coffee b/src/languages/r.coffee new file mode 100644 index 0000000..b0e8a77 --- /dev/null +++ b/src/languages/r.coffee @@ -0,0 +1,23 @@ +module.exports = { + + name: "R" + namespace: "r" + + ### + Supported Grammars + ### + grammars: [ + "R" +] + + ### + Supported extensions + ### + extensions: [ + "r" + "R" + ] + + options: [] + +} From 0374217846736050e9a93c8199c7a32d9d70cdb9 Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Wed, 10 Aug 2016 10:42:36 +0200 Subject: [PATCH 02/11] small readme changes --- README.md | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37fc3a5..3a39ed6 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | -| R | `R` |`.r` | [`R`](https://cran.r-project.org/) (Default) | +| R | `R` |`.r` | [`formatR`](https://github.com/yihui/formatR) (Default) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | | Sass | `Sass` |`.sass` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | SCSS | `SCSS` |`.scss` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | diff --git a/package.json b/package.json index bacb986..1680102 100644 --- a/package.json +++ b/package.json @@ -251,6 +251,7 @@ "pretty diff", "pug beautify", "puppet-lint", + "r", "remark", "rubocop", "ruby beautify", From 2c6d6b613b1cff63645fb125c240e5c2a8a42d4e Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Wed, 10 Aug 2016 15:00:38 +0200 Subject: [PATCH 03/11] afaik a working version of atom-beautify with r language implemented! Includes examples --- README.md | 6 +- docs/options.md | 622 +++++++++++++----- .../nested-jsbeautifyrc/r/expected/test.r | 20 + package.json | 5 +- 4 files changed, 480 insertions(+), 173 deletions(-) create mode 100644 examples/nested-jsbeautifyrc/r/expected/test.r diff --git a/README.md b/README.md index 3a39ed6..fe4107f 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | Elm | `Elm` |`.elm` | [`elm-format`](https://github.com/avh4/elm-format) (Default) | | ERB | `HTML (Ruby - ERB)`, `HTML (Rails)` |`.erb` | [`HTML Beautifier`](https://github.com/threedaymonk/htmlbeautifier), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Erlang | `Erlang` |`.erl` | [`erl_tidy`](http://erlang.org/doc/man/erl_tidy.html) (Default) | -| Fortran | `Fortran - Modern` |`.f90` | [`Fortran Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/fortran-beautifier/emacs-fortran-formating-script.lisp) (Default) | +| Fortran | `Fortran - Modern` |`.f90`, `.F90` | [`Fortran Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/fortran-beautifier/emacs-fortran-formating-script.lisp) (Default) | | gherkin | `Gherkin` |`.feature` | [`Gherkin formatter`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee) (Default) | | Go | `Go` |`.go` | [`gofmt`](https://golang.org/cmd/gofmt/) (Default) | | Handlebars | `Handlebars`, `HTML (Handlebars)` |`.hbs`, `.handlebars` | [`JS Beautify`](https://github.com/beautify-web/js-beautify) (Default), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | @@ -87,9 +87,9 @@ See [all supported options in the documentation at `docs/options.md`](https://g | PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) | | Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) | | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | +| R | `R` |`.r`, `.R` | [`R beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/r-beautifier/r-beautifier.r) (Default) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | -| R | `R` |`.r` | [`formatR`](https://github.com/yihui/formatR) (Default) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | | Sass | `Sass` |`.sass` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | SCSS | `SCSS` |`.scss` | [`CSScomb`](https://github.com/csscomb/csscomb.js), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | @@ -102,7 +102,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | TypeScript | `TypeScript` |`.ts` | [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) (Default) | | Vala | `Vala` |`.vala`, `.vapi` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | | Visualforce | `Visualforce` |`.page` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | -| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | +| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | XTemplate | `XTemplate` |`.xtemplate` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | ## Usage diff --git a/docs/options.md b/docs/options.md index 7fa34f9..7729cdc 100644 --- a/docs/options.md +++ b/docs/options.md @@ -3232,7 +3232,7 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -3249,36 +3249,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -3765,7 +3796,7 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -3782,36 +3813,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -6725,7 +6787,7 @@ Preserve line-breaks (Supported by Marko Beautifier) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -6742,36 +6804,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by M "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -7189,7 +7282,7 @@ Preserve line-breaks (Supported by JS Beautify) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -7206,36 +7299,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -8118,6 +8242,75 @@ sort imports (requires isort installed) (Supported by autopep8) } ``` +#### [R](#r) + +**Supported Beautifiers**: [`R beautifier`](#r-beautifier) + +| Option | R beautifier | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | + +**Description**: + +Options for language R + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable R Beautification + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration. + +##### [Default Beautifier](#default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `R beautifier` + +**Type**: `string` + +**Enum**: `R beautifier` + +**Description**: + +Default Beautifier to be used for R + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Default Beautifier*" and change it to your desired configuration. + +##### [Beautify On Save](#beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify R files on save + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Beautify On Save*" and change it to your desired configuration. + #### [Riot.js](#riot.js) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -11757,7 +11950,7 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -11774,36 +11967,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -13088,7 +13312,7 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -13105,36 +13329,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", @@ -13951,7 +14206,7 @@ Number of line-breaks to be preserved in one chunk (Supported by Marko Beautifie **Key**: `unformatted` -**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` **Type**: `array` @@ -13968,36 +14223,67 @@ List of tags (defaults to inline) that should not be reformatted (Supported by M "html": { "unformatted": [ "a", - "span", - "img", - "bdo", - "em", - "strong", - "dfn", - "code", - "samp", - "kbd", - "var", - "cite", "abbr", - "acronym", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", "sub", "sup", - "tt", - "i", - "b", - "big", - "small", + "svg", + "template", + "textarea", + "time", "u", - "s", - "strike", - "font", - "ins", - "del", - "pre", + "var", + "video", + "wbr", + "text", + "acronym", "address", + "big", "dt", + "ins", + "small", + "strike", + "tt", + "pre", "h1", "h2", "h3", diff --git a/examples/nested-jsbeautifyrc/r/expected/test.r b/examples/nested-jsbeautifyrc/r/expected/test.r new file mode 100644 index 0000000..f9a08b8 --- /dev/null +++ b/examples/nested-jsbeautifyrc/r/expected/test.r @@ -0,0 +1,20 @@ +# a single line of comments is preserved +1 + 1 + +if (TRUE) { + x = 1 # inline comments +} else { + x = 2 + print("Oh no... ask the right bracket to go away!") +} +1 * 3 # one space before this comment will become two! +2 + 2 + 2 # 'short comments' + +# only 'single quotes' are allowed in comments +df = data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100)) +lm(y ~ x1 + x2, data = df) +1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 ## comments after a long line + +## here is a long long long long long long long long long long long long long long +## long long long long long long comment diff --git a/package.json b/package.json index 1680102..c742745 100644 --- a/package.json +++ b/package.json @@ -262,7 +262,8 @@ "typescript formatter", "yapf", "erl_tidy", - "marko beautifier" + "marko beautifier", + "r beautifier" ], "devDependencies": { "coffeelint": "^1.10.1", @@ -275,4 +276,4 @@ "lint": "coffeelint src/ spec/", "code-docs": "codo && open docs/code/index.html" } -} +} \ No newline at end of file From dd817333292dd18464a5df9b8327eef6fe755080 Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Wed, 10 Aug 2016 15:26:32 +0200 Subject: [PATCH 04/11] added code to r-beautifier.r that installs formatR if the package does not exist. --- src/beautifiers/r-beautifier/r-beautifier.r | 1 + 1 file changed, 1 insertion(+) diff --git a/src/beautifiers/r-beautifier/r-beautifier.r b/src/beautifiers/r-beautifier/r-beautifier.r index 4138641..f93525c 100644 --- a/src/beautifiers/r-beautifier/r-beautifier.r +++ b/src/beautifiers/r-beautifier/r-beautifier.r @@ -1,3 +1,4 @@ +if(!("formatR" %in% installed.packages()[,"Package"])) install.packages("formatR",repos='http://cran.us.r-project.org') library(formatR) file <- commandArgs(trailingOnly = TRUE)[1] tidy_source(text = readLines(file)) From 7da7b1cf0ec6a6faccc6de51f00d40a506a6cdab Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Thu, 11 Aug 2016 14:58:22 +0200 Subject: [PATCH 05/11] changing name to formatR, changing link to formatRs github, attempting to create insert_size option. --- src/beautifiers/r-beautifier/index.coffee | 5 +++-- src/beautifiers/r-beautifier/r-beautifier.r | 5 +++-- src/languages/r.coffee | 16 ++++++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/beautifiers/r-beautifier/index.coffee b/src/beautifiers/r-beautifier/index.coffee index e99a779..3f7b688 100644 --- a/src/beautifiers/r-beautifier/index.coffee +++ b/src/beautifiers/r-beautifier/index.coffee @@ -7,8 +7,8 @@ path = require("path") Beautifier = require('../beautifier') module.exports = class R extends Beautifier - name: "R beautifier" - link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/r-beautifier/r-beautifier.r" + name: "formatR" + link: "https://github.com/yihui/formatR" options: { R: true @@ -18,6 +18,7 @@ module.exports = class R extends Beautifier r_beautifier = path.resolve(__dirname, "r-beautifier.r") @run("Rscript", [ r_beautifier, + options.indent_size, @tempFile("input", text), '>', @tempFile("input", text) diff --git a/src/beautifiers/r-beautifier/r-beautifier.r b/src/beautifiers/r-beautifier/r-beautifier.r index f93525c..6e3756f 100644 --- a/src/beautifiers/r-beautifier/r-beautifier.r +++ b/src/beautifiers/r-beautifier/r-beautifier.r @@ -1,4 +1,5 @@ if(!("formatR" %in% installed.packages()[,"Package"])) install.packages("formatR",repos='http://cran.us.r-project.org') library(formatR) -file <- commandArgs(trailingOnly = TRUE)[1] -tidy_source(text = readLines(file)) +indent_size <- commandArgs(trailingOnly = TRUE)[1] +file <- commandArgs(trailingOnly = TRUE)[2] +tidy_source(text = readLines(file), indent = indent_size) diff --git a/src/languages/r.coffee b/src/languages/r.coffee index b0e8a77..8fe6330 100644 --- a/src/languages/r.coffee +++ b/src/languages/r.coffee @@ -1,3 +1,11 @@ +# Get Atom defaults +scope = ['text.html'] +tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4 +softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true +defaultIndentSize = (if softTabs then tabLength else 1) +defaultIndentChar = (if softTabs then " " else "\t") +defaultIndentWithTabs = not softTabs + module.exports = { name: "R" @@ -18,6 +26,10 @@ module.exports = { "R" ] - options: [] - + options: + indent_size: + type: 'integer' + default: defaultIndentSize + description: "Indentation size/length" + } From fc846d3f4c5f80722c37c09a1fe7b1bdce712d3e Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Wed, 24 Aug 2016 11:44:30 +0200 Subject: [PATCH 06/11] adding R installation to travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index b91ab6b..fc8e5ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,6 +96,9 @@ before_install: - pip install --upgrade sqlparse # Java, C, C++, C#, Objective-C, D, Pawn, Vala - brew install uncrustify + # R + - brew tap homebrew/science + - brew install r # PHP - brew tap homebrew/homebrew-php - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then From 32daae825f4c3f3ff5dea4df2c3ea03ca2bd2179 Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Wed, 24 Aug 2016 17:05:58 +0200 Subject: [PATCH 07/11] fixed settings and travis missing bracket --- README.md | 5 ++--- package.json | 7 +++++-- src/beautifiers/r-beautifier/index.coffee | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 52d1c32..ea21b95 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) | | Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) | | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | -| R | `R` |`.r`, `.R` | [`R beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/r-beautifier/r-beautifier.r) (Default) | +| R | `R` |`.r`, `.R` | [`R beautifier`](https://github.com/yihui/formatR) (Default) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | @@ -102,8 +102,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | TypeScript | `TypeScript` |`.ts` | [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) (Default) | | Vala | `Vala` |`.vala`, `.vapi` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | | Visualforce | `Visualforce` |`.page` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | -| Vue | `Vue Component` |`.vue` | `Vue Beautifier` (Default) | -| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | +| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | XTemplate | `XTemplate` |`.xtemplate` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | ## Usage diff --git a/package.json b/package.json index 65b72b6..93a36ed 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "name": "Sebastian DiLorenzo", "url": "https://github.com/Sebastian-D" }, + { "name": "Émile Bergeron", "url": "https://github.com/emileber" } @@ -266,7 +267,9 @@ "yapf", "erl_tidy", "marko beautifier", - "r beautifier" + "r beautifier", + "vue", + "vue beautifier" ], "devDependencies": { "coffeelint": "^1.10.1", @@ -279,4 +282,4 @@ "lint": "coffeelint src/ spec/", "code-docs": "codo && open docs/code/index.html" } -} +} \ No newline at end of file diff --git a/src/beautifiers/r-beautifier/index.coffee b/src/beautifiers/r-beautifier/index.coffee index 3f7b688..7b7ebb6 100644 --- a/src/beautifiers/r-beautifier/index.coffee +++ b/src/beautifiers/r-beautifier/index.coffee @@ -7,7 +7,7 @@ path = require("path") Beautifier = require('../beautifier') module.exports = class R extends Beautifier - name: "formatR" + name: "R beautifier" link: "https://github.com/yihui/formatR" options: { From 9d31e3bb6d8246d2d766fecbf6054bcd86c29a24 Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Thu, 25 Aug 2016 09:55:05 +0200 Subject: [PATCH 08/11] Added namechanges to formatR as per Glavins suggestion. Hopefully fixed example (old default was 2 tabs rather than 4) --- README.md | 1 + docs/options.md | 967 ++++++++++++++++++ .../nested-jsbeautifyrc/r/expected/test.r | 8 +- src/beautifiers/formatR/index.coffee | 25 + .../{r-beautifier => formatR}/r-beautifier.r | 0 src/beautifiers/index.coffee | 2 +- src/beautifiers/r-beautifier/index.coffee | 2 +- 7 files changed, 999 insertions(+), 6 deletions(-) create mode 100644 src/beautifiers/formatR/index.coffee rename src/beautifiers/{r-beautifier => formatR}/r-beautifier.r (100%) diff --git a/README.md b/README.md index ea21b95..1bea3b2 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | TypeScript | `TypeScript` |`.ts` | [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) (Default) | | Vala | `Vala` |`.vala`, `.vapi` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) | | Visualforce | `Visualforce` |`.page` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | +| Vue | `Vue Component` |`.vue` | `Vue Beautifier` (Default) | | XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | XTemplate | `XTemplate` |`.xtemplate` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | diff --git a/docs/options.md b/docs/options.md index 7729cdc..0ca852f 100644 --- a/docs/options.md +++ b/docs/options.md @@ -8251,6 +8251,7 @@ sort imports (requires isort installed) (Supported by autopep8) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | +| `indent_size` | :white_check_mark: | **Description**: @@ -8311,6 +8312,32 @@ Automatically beautify R files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Indent size](#indent-size) + +**Namespace**: `r` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`R beautifier`](#r-beautifier) + +**Description**: + +Indentation size/length (Supported by R beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "r": { + "indent_size": 4 + } +} +``` + #### [Riot.js](#riot.js) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -11624,6 +11651,501 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) } ``` +#### [Vue](#vue) + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +| Option | Vue Beautifier | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | +| `brace_style` | :white_check_mark: | +| `end_with_newline` | :white_check_mark: | +| `extra_liners` | :white_check_mark: | +| `indent_char` | :white_check_mark: | +| `indent_inner_html` | :white_check_mark: | +| `indent_scripts` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `max_preserve_newlines` | :white_check_mark: | +| `preserve_newlines` | :white_check_mark: | +| `unformatted` | :white_check_mark: | +| `wrap_attributes` | :white_check_mark: | +| `wrap_attributes_indent_size` | :white_check_mark: | +| `wrap_line_length` | :white_check_mark: | + +**Description**: + +Options for language Vue + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable Vue Beautification + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration. + +##### [Default Beautifier](#default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `Vue Beautifier` + +**Type**: `string` + +**Enum**: `Vue Beautifier` + +**Description**: + +Default Beautifier to be used for Vue + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Default Beautifier*" and change it to your desired configuration. + +##### [Beautify On Save](#beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify Vue files on save + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Beautify On Save*" and change it to your desired configuration. + +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `html` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +End output with newline (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `html` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation character (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_char": " " + } +} +``` + +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent and sections. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[keep|separate|normal] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `html` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation size/length (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_size": 4 + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve line-breaks (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `html` + +**Key**: `wrap_line_length` + +**Default**: `250` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Maximum characters per line (0 disables) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_line_length": 250 + } +} +``` + #### [XML](#xml) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) @@ -14937,6 +15459,35 @@ Indentation character (Supported by Pug Beautify) ``` +### R beautifier + +##### [Indent size](#indent-size) + +**Namespace**: `r` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`R beautifier`](#r-beautifier) + +**Description**: + +Indentation size/length (Supported by R beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "r": { + "indent_size": 4 + } +} +``` + + ### Remark ##### [Gfm](#gfm) @@ -15626,6 +16177,422 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) ``` +### Vue Beautifier + +##### [Indent inner html](#indent-inner-html) + +**Namespace**: `html` + +**Key**: `indent_inner_html` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent and sections. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_inner_html": false + } +} +``` + +##### [Indent size](#indent-size) + +**Namespace**: `html` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation size/length (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_size": 4 + } +} +``` + +##### [Indent char](#indent-char) + +**Namespace**: `html` + +**Key**: `indent_char` + +**Default**: ` ` + +**Type**: `string` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indentation character (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_char": " " + } +} +``` + +##### [Brace style](#brace-style) + +**Namespace**: `html` + +**Key**: `brace_style` + +**Default**: `collapse` + +**Type**: `string` + +**Enum**: `collapse` `expand` `end-expand` `none` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[collapse|expand|end-expand|none] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "brace_style": "collapse" + } +} +``` + +##### [Indent scripts](#indent-scripts) + +**Namespace**: `html` + +**Key**: `indent_scripts` + +**Default**: `normal` + +**Type**: `string` + +**Enum**: `keep` `separate` `normal` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +[keep|separate|normal] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "indent_scripts": "normal" + } +} +``` + +##### [Wrap line length](#wrap-line-length) + +**Namespace**: `html` + +**Key**: `wrap_line_length` + +**Default**: `250` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Maximum characters per line (0 disables) (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_line_length": 250 + } +} +``` + +##### [Wrap attributes](#wrap-attributes) + +**Namespace**: `html` + +**Key**: `wrap_attributes` + +**Default**: `auto` + +**Type**: `string` + +**Enum**: `auto` `force` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Wrap attributes to new lines [auto|force] (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes": "auto" + } +} +``` + +##### [Wrap attributes indent size](#wrap-attributes-indent-size) + +**Namespace**: `html` + +**Key**: `wrap_attributes_indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Indent wrapped attributes to after N characters (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "wrap_attributes_indent_size": 4 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Preserve line-breaks (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "small", + "strike", + "tt", + "pre", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ] + } +} +``` + +##### [End with newline](#end-with-newline) + +**Namespace**: `html` + +**Key**: `end_with_newline` + +**Type**: `boolean` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +End output with newline (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "extra_liners": [ + "head", + "body", + "/html" + ] + } +} +``` + + ### autopep8 ##### [Max line length](#max-line-length) diff --git a/examples/nested-jsbeautifyrc/r/expected/test.r b/examples/nested-jsbeautifyrc/r/expected/test.r index f9a08b8..5a6651c 100644 --- a/examples/nested-jsbeautifyrc/r/expected/test.r +++ b/examples/nested-jsbeautifyrc/r/expected/test.r @@ -2,10 +2,10 @@ 1 + 1 if (TRUE) { - x = 1 # inline comments + x = 1 # inline comments } else { - x = 2 - print("Oh no... ask the right bracket to go away!") + x = 2 + print("Oh no... ask the right bracket to go away!") } 1 * 3 # one space before this comment will become two! 2 + 2 + 2 # 'short comments' @@ -14,7 +14,7 @@ if (TRUE) { df = data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100)) lm(y ~ x1 + x2, data = df) 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + - 1 + 1 ## comments after a long line + 1 + 1 ## comments after a long line ## here is a long long long long long long long long long long long long long long ## long long long long long long comment diff --git a/src/beautifiers/formatR/index.coffee b/src/beautifiers/formatR/index.coffee new file mode 100644 index 0000000..7b7ebb6 --- /dev/null +++ b/src/beautifiers/formatR/index.coffee @@ -0,0 +1,25 @@ +### +Requires [formatR](https://github.com/yihui/formatR) +### +path = require("path") + +"use strict" +Beautifier = require('../beautifier') + +module.exports = class R extends Beautifier + name: "R beautifier" + link: "https://github.com/yihui/formatR" + + options: { + R: true + } + + beautify: (text, language, options) -> + r_beautifier = path.resolve(__dirname, "r-beautifier.r") + @run("Rscript", [ + r_beautifier, + options.indent_size, + @tempFile("input", text), + '>', + @tempFile("input", text) + ]) diff --git a/src/beautifiers/r-beautifier/r-beautifier.r b/src/beautifiers/formatR/r-beautifier.r similarity index 100% rename from src/beautifiers/r-beautifier/r-beautifier.r rename to src/beautifiers/formatR/r-beautifier.r diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 8df4b7a..9a4a049 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -70,7 +70,7 @@ module.exports = class Beautifiers extends EventEmitter 'yapf' 'erl_tidy' 'marko-beautifier' - 'r-beautifier' + 'formatR' ] ### diff --git a/src/beautifiers/r-beautifier/index.coffee b/src/beautifiers/r-beautifier/index.coffee index 7b7ebb6..3f7b688 100644 --- a/src/beautifiers/r-beautifier/index.coffee +++ b/src/beautifiers/r-beautifier/index.coffee @@ -7,7 +7,7 @@ path = require("path") Beautifier = require('../beautifier') module.exports = class R extends Beautifier - name: "R beautifier" + name: "formatR" link: "https://github.com/yihui/formatR" options: { From 3573d8aa7a959c171a1a54ee335a0927c9e7a08b Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Thu, 25 Aug 2016 16:53:27 +0200 Subject: [PATCH 09/11] re adding expected test.r after hopefully solving bug --- examples/nested-jsbeautifyrc/r/expected/test.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nested-jsbeautifyrc/r/expected/test.r b/examples/nested-jsbeautifyrc/r/expected/test.r index 5a6651c..fb35dd2 100644 --- a/examples/nested-jsbeautifyrc/r/expected/test.r +++ b/examples/nested-jsbeautifyrc/r/expected/test.r @@ -13,7 +13,7 @@ if (TRUE) { # only 'single quotes' are allowed in comments df = data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100)) lm(y ~ x1 + x2, data = df) -1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + +1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 ## comments after a long line ## here is a long long long long long long long long long long long long long long From f748204e55b7e2c89411b82656369facdce2cda1 Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Fri, 2 Sep 2016 11:15:30 +0200 Subject: [PATCH 10/11] deleting r-beautifier folder, changing name of r-beautifier.r to formatR.r, changing name to formatR in index.coffee, generating docs. --- README.md | 2 +- docs/options.md | 125 ++++++++++++++++++ package.json | 5 +- .../formatR/{r-beautifier.r => formatR.r} | 0 src/beautifiers/formatR/index.coffee | 4 +- src/beautifiers/r-beautifier/index.coffee | 25 ---- 6 files changed, 131 insertions(+), 30 deletions(-) rename src/beautifiers/formatR/{r-beautifier.r => formatR.r} (100%) delete mode 100644 src/beautifiers/r-beautifier/index.coffee diff --git a/README.md b/README.md index ae32105..4c8173f 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g | PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) | | Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) | | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | -| R | `R` |`.r`, `.R` | [`R beautifier`](https://github.com/yihui/formatR) (Default) | +| R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | diff --git a/docs/options.md b/docs/options.md index 623f7af..9742236 100644 --- a/docs/options.md +++ b/docs/options.md @@ -8242,6 +8242,102 @@ sort imports (requires isort installed) (Supported by autopep8) } ``` +#### [R](#r) + +**Supported Beautifiers**: [`formatR`](#formatr) + +| Option | formatR | +| --- | --- | +| `disabled` | :white_check_mark: | +| `default_beautifier` | :white_check_mark: | +| `beautify_on_save` | :white_check_mark: | +| `indent_size` | :white_check_mark: | + +**Description**: + +Options for language R + +##### [Disable Beautifying Language](#disable-beautifying-language) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Disable R Beautification + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration. + +##### [Default Beautifier](#default-beautifier) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Default**: `formatR` + +**Type**: `string` + +**Enum**: `formatR` + +**Description**: + +Default Beautifier to be used for R + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Default Beautifier*" and change it to your desired configuration. + +##### [Beautify On Save](#beautify-on-save) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `boolean` + +**Description**: + +Automatically beautify R files on save + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*Beautify On Save*" and change it to your desired configuration. + +##### [Indent size](#indent-size) + +**Namespace**: `r` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`formatR`](#formatr) + +**Description**: + +Indentation size/length (Supported by formatR) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "r": { + "indent_size": 4 + } +} +``` + #### [Riot.js](#riot.js) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) @@ -16338,6 +16434,35 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by C ``` +### formatR + +##### [Indent size](#indent-size) + +**Namespace**: `r` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`formatR`](#formatr) + +**Description**: + +Indentation size/length (Supported by formatR) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "r": { + "indent_size": 4 + } +} +``` + + ### rustfmt ##### [Rustfmt path](#rustfmt-path) diff --git a/package.json b/package.json index 5d7528c..187c22a 100644 --- a/package.json +++ b/package.json @@ -270,7 +270,8 @@ "r beautifier", "vue", "vue beautifier", - "sassconvert" + "sassconvert", + "formatr" ], "devDependencies": { "coffeelint": "^1.10.1", @@ -283,4 +284,4 @@ "lint": "coffeelint src/ spec/", "code-docs": "codo && open docs/code/index.html" } -} +} \ No newline at end of file diff --git a/src/beautifiers/formatR/r-beautifier.r b/src/beautifiers/formatR/formatR.r similarity index 100% rename from src/beautifiers/formatR/r-beautifier.r rename to src/beautifiers/formatR/formatR.r diff --git a/src/beautifiers/formatR/index.coffee b/src/beautifiers/formatR/index.coffee index 7b7ebb6..7bfcee3 100644 --- a/src/beautifiers/formatR/index.coffee +++ b/src/beautifiers/formatR/index.coffee @@ -7,7 +7,7 @@ path = require("path") Beautifier = require('../beautifier') module.exports = class R extends Beautifier - name: "R beautifier" + name: "formatR" link: "https://github.com/yihui/formatR" options: { @@ -15,7 +15,7 @@ module.exports = class R extends Beautifier } beautify: (text, language, options) -> - r_beautifier = path.resolve(__dirname, "r-beautifier.r") + r_beautifier = path.resolve(__dirname, "formatR.r") @run("Rscript", [ r_beautifier, options.indent_size, diff --git a/src/beautifiers/r-beautifier/index.coffee b/src/beautifiers/r-beautifier/index.coffee deleted file mode 100644 index 3f7b688..0000000 --- a/src/beautifiers/r-beautifier/index.coffee +++ /dev/null @@ -1,25 +0,0 @@ -### -Requires [formatR](https://github.com/yihui/formatR) -### -path = require("path") - -"use strict" -Beautifier = require('../beautifier') - -module.exports = class R extends Beautifier - name: "formatR" - link: "https://github.com/yihui/formatR" - - options: { - R: true - } - - beautify: (text, language, options) -> - r_beautifier = path.resolve(__dirname, "r-beautifier.r") - @run("Rscript", [ - r_beautifier, - options.indent_size, - @tempFile("input", text), - '>', - @tempFile("input", text) - ]) From 507a712b398fca316d999f74ef88a52b2a13dd1a Mon Sep 17 00:00:00 2001 From: Sebastian DiLorenzo Date: Fri, 2 Sep 2016 11:28:28 +0200 Subject: [PATCH 11/11] removing 'r beautifier' line from package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 187c22a..d13912d 100644 --- a/package.json +++ b/package.json @@ -267,7 +267,6 @@ "yapf", "erl_tidy", "marko beautifier", - "r beautifier", "vue", "vue beautifier", "sassconvert", @@ -284,4 +283,4 @@ "lint": "coffeelint src/ spec/", "code-docs": "codo && open docs/code/index.html" } -} \ No newline at end of file +}