Switch formatR to using Executables
This commit is contained in:
parent
dca093cd41
commit
01df888aae
|
@ -137,6 +137,27 @@ Supported options for each language.
|
|||
|
||||
Configure executables used by beautifiers.
|
||||
|
||||
##### [Rscript](#rscript)
|
||||
|
||||
**Namespace**: ``
|
||||
|
||||
**Key**: `Rscript`
|
||||
|
||||
**Type**: `object`
|
||||
|
||||
**Supported Beautifiers**: [`formatR`](#formatr)
|
||||
|
||||
**Description**:
|
||||
|
||||
Options for Rscript executable.
|
||||
|
||||
**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 "*Rscript*" and change it to your desired configuration.
|
||||
|
||||
##### [PHP](#php)
|
||||
|
||||
**Namespace**: ``
|
||||
|
@ -20123,6 +20144,27 @@ Indentation size/length (Supported by formatR)
|
|||
}
|
||||
```
|
||||
|
||||
##### [Rscript](#rscript)
|
||||
|
||||
**Namespace**: ``
|
||||
|
||||
**Key**: `Rscript`
|
||||
|
||||
**Type**: `object`
|
||||
|
||||
**Supported Beautifiers**: [`formatR`](#formatr)
|
||||
|
||||
**Description**:
|
||||
|
||||
Options for Rscript executable.
|
||||
|
||||
**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 "*Rscript*" and change it to your desired configuration.
|
||||
|
||||
|
||||
### pybeautifier
|
||||
|
||||
|
|
|
@ -9,18 +9,35 @@ Beautifier = require('../beautifier')
|
|||
module.exports = class R extends Beautifier
|
||||
name: "formatR"
|
||||
link: "https://github.com/yihui/formatR"
|
||||
isPreInstalled: false
|
||||
executables: [
|
||||
{
|
||||
name: "Rscript"
|
||||
cmd: "Rscript"
|
||||
homepage: "https://github.com/yihui/formatR"
|
||||
installation: "https://github.com/yihui/formatR"
|
||||
version: {
|
||||
parse: (text) ->
|
||||
r = /version (\d\.\d\.\d) /
|
||||
console.log("parse version", text, r, text.match(r))
|
||||
text.match(r)[1]
|
||||
runOptions: {
|
||||
returnStderr: true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
options: {
|
||||
R: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
rScript = @exe("Rscript")
|
||||
r_beautifier = path.resolve(__dirname, "formatR.r")
|
||||
@run("Rscript", [
|
||||
rScript.run([
|
||||
r_beautifier,
|
||||
options.indent_size,
|
||||
@tempFile("input", text),
|
||||
'>',
|
||||
@tempFile("input", text)
|
||||
])
|
||||
])
|
||||
|
|
|
@ -9186,6 +9186,25 @@
|
|||
"description": "Absolute path to the \"phpcbf\" executable."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Rscript": {
|
||||
"key": "Rscript",
|
||||
"title": "Rscript",
|
||||
"type": "object",
|
||||
"collapsed": true,
|
||||
"description": "Options for Rscript executable.",
|
||||
"beautifiers": [
|
||||
"formatR"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"key": "path",
|
||||
"title": "Executable Path",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "Absolute path to the \"Rscript\" executable."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue