changing name to formatR, changing link to formatRs github, attempting to create insert_size option.

This commit is contained in:
Sebastian DiLorenzo 2016-08-11 14:58:22 +02:00
parent dd81733329
commit 7da7b1cf0e
3 changed files with 20 additions and 6 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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"
}