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.
|
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)
|
##### [PHP](#php)
|
||||||
|
|
||||||
**Namespace**: ``
|
**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
|
### pybeautifier
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,32 @@ Beautifier = require('../beautifier')
|
||||||
module.exports = class R extends Beautifier
|
module.exports = class R extends Beautifier
|
||||||
name: "formatR"
|
name: "formatR"
|
||||||
link: "https://github.com/yihui/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: {
|
options: {
|
||||||
R: true
|
R: true
|
||||||
}
|
}
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
|
rScript = @exe("Rscript")
|
||||||
r_beautifier = path.resolve(__dirname, "formatR.r")
|
r_beautifier = path.resolve(__dirname, "formatR.r")
|
||||||
@run("Rscript", [
|
rScript.run([
|
||||||
r_beautifier,
|
r_beautifier,
|
||||||
options.indent_size,
|
options.indent_size,
|
||||||
@tempFile("input", text),
|
@tempFile("input", text),
|
||||||
|
|
|
@ -9186,6 +9186,25 @@
|
||||||
"description": "Absolute path to the \"phpcbf\" executable."
|
"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