Switch Fortran beautifier (using Emacs) to using Executables, other minor improvements
This commit is contained in:
parent
5648aa34a1
commit
bee7b2573a
|
@ -158,6 +158,27 @@ Options for Rscript executable.
|
||||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||||
3. Find the option "*Rscript*" and change it to your desired configuration.
|
3. Find the option "*Rscript*" and change it to your desired configuration.
|
||||||
|
|
||||||
|
##### [Emacs](#emacs)
|
||||||
|
|
||||||
|
**Namespace**: ``
|
||||||
|
|
||||||
|
**Key**: `emacs`
|
||||||
|
|
||||||
|
**Type**: `object`
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`Fortran Beautifier`](#fortran-beautifier)
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for Emacs 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 "*Emacs*" and change it to your desired configuration.
|
||||||
|
|
||||||
##### [PHP](#php)
|
##### [PHP](#php)
|
||||||
|
|
||||||
**Namespace**: ``
|
**Namespace**: ``
|
||||||
|
@ -183,7 +204,7 @@ Options for PHP executable.
|
||||||
|
|
||||||
**Namespace**: ``
|
**Namespace**: ``
|
||||||
|
|
||||||
**Key**: `php_cs_fixer`
|
**Key**: `php-cs-fixer`
|
||||||
|
|
||||||
**Type**: `object`
|
**Type**: `object`
|
||||||
|
|
||||||
|
@ -15873,6 +15894,27 @@ Path to the emacs script (Supported by Fortran Beautifier)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### [Emacs](#emacs)
|
||||||
|
|
||||||
|
**Namespace**: ``
|
||||||
|
|
||||||
|
**Key**: `emacs`
|
||||||
|
|
||||||
|
**Type**: `object`
|
||||||
|
|
||||||
|
**Supported Beautifiers**: [`Fortran Beautifier`](#fortran-beautifier)
|
||||||
|
|
||||||
|
**Description**:
|
||||||
|
|
||||||
|
Options for Emacs 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 "*Emacs*" and change it to your desired configuration.
|
||||||
|
|
||||||
|
|
||||||
### Gherkin formatter
|
### Gherkin formatter
|
||||||
|
|
||||||
|
@ -17733,7 +17775,7 @@ Options for PHP executable.
|
||||||
|
|
||||||
**Namespace**: ``
|
**Namespace**: ``
|
||||||
|
|
||||||
**Key**: `php_cs_fixer`
|
**Key**: `php-cs-fixer`
|
||||||
|
|
||||||
**Type**: `object`
|
**Type**: `object`
|
||||||
|
|
||||||
|
|
|
@ -185,8 +185,7 @@ buildOptionsForExecutables = function(beautifiers) {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
_.forEach(executables, (executable) => {
|
_.forEach(executables, (executable) => {
|
||||||
const { name, cmd, beautifiers } = executable;
|
const { name, cmd, beautifiers } = executable;
|
||||||
const sanitizedCmd = cmd.split('-').join('_');
|
const key = cmd;
|
||||||
const key = sanitizedCmd;
|
|
||||||
const option = {
|
const option = {
|
||||||
key: key,
|
key: key,
|
||||||
title: name,
|
title: name,
|
||||||
|
|
|
@ -26,7 +26,7 @@ module.exports = class Executable
|
||||||
throw new Error("The command (i.e. cmd property) is required for an Executable.")
|
throw new Error("The command (i.e. cmd property) is required for an Executable.")
|
||||||
@name = options.name
|
@name = options.name
|
||||||
@cmd = options.cmd
|
@cmd = options.cmd
|
||||||
@key = @cmd.split('-').join('_')
|
@key = @cmd
|
||||||
@homepage = options.homepage
|
@homepage = options.homepage
|
||||||
@installation = options.installation
|
@installation = options.installation
|
||||||
if options.version?
|
if options.version?
|
||||||
|
|
|
@ -16,10 +16,7 @@ module.exports = class R extends Beautifier
|
||||||
homepage: "https://github.com/yihui/formatR"
|
homepage: "https://github.com/yihui/formatR"
|
||||||
installation: "https://github.com/yihui/formatR"
|
installation: "https://github.com/yihui/formatR"
|
||||||
version: {
|
version: {
|
||||||
parse: (text) ->
|
parse: (text) -> text.match(/version (\d+\.\d+\.\d+) /)[1]
|
||||||
r = /version (\d\.\d\.\d) /
|
|
||||||
console.log("parse version", text, r, text.match(r))
|
|
||||||
text.match(r)[1]
|
|
||||||
runOptions: {
|
runOptions: {
|
||||||
returnStderr: true
|
returnStderr: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,17 @@ path = require("path")
|
||||||
module.exports = class FortranBeautifier extends Beautifier
|
module.exports = class FortranBeautifier extends Beautifier
|
||||||
name: "Fortran Beautifier"
|
name: "Fortran Beautifier"
|
||||||
link: "https://www.gnu.org/software/emacs/"
|
link: "https://www.gnu.org/software/emacs/"
|
||||||
isPreInstalled: false
|
executables: [
|
||||||
|
{
|
||||||
|
name: "Emacs"
|
||||||
|
cmd: "emacs"
|
||||||
|
homepage: "https://www.gnu.org/software/emacs/"
|
||||||
|
installation: "https://www.gnu.org/software/emacs/"
|
||||||
|
version: {
|
||||||
|
parse: (text) -> text.match(/Emacs (\d+\.\d+\.\d+)/)[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
Fortran: true
|
Fortran: true
|
||||||
|
@ -17,6 +27,7 @@ module.exports = class FortranBeautifier extends Beautifier
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
@debug('fortran-beautifier', options)
|
@debug('fortran-beautifier', options)
|
||||||
|
emacs = @exe("emacs")
|
||||||
|
|
||||||
emacs_path = options.emacs_path
|
emacs_path = options.emacs_path
|
||||||
emacs_script_path = options.emacs_script_path
|
emacs_script_path = options.emacs_script_path
|
||||||
|
@ -36,12 +47,13 @@ module.exports = class FortranBeautifier extends Beautifier
|
||||||
]
|
]
|
||||||
|
|
||||||
if emacs_path
|
if emacs_path
|
||||||
|
@deprecate("The \"emacs_path\" has been deprecated. Please switch to using the config with path \"Executables - Emacs - Path\" in Atom-Beautify package settings now.")
|
||||||
@run(emacs_path, args, {ignoreReturnCode: false})
|
@run(emacs_path, args, {ignoreReturnCode: false})
|
||||||
.then(=>
|
.then(=>
|
||||||
@readFile(tempFile)
|
@readFile(tempFile)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@run("emacs", args, {ignoreReturnCode: false})
|
emacs.run(args, {ignoreReturnCode: false})
|
||||||
.then(=>
|
.then(=>
|
||||||
@readFile(tempFile)
|
@readFile(tempFile)
|
||||||
)
|
)
|
||||||
|
|
|
@ -78,7 +78,7 @@ module.exports = class PHPCSFixer extends Beautifier
|
||||||
|
|
||||||
# Find php-cs-fixer.phar script
|
# Find php-cs-fixer.phar script
|
||||||
if options.cs_fixer_path
|
if options.cs_fixer_path
|
||||||
@deprecate("The \"cs_fixer_path\" has been deprecated. Please change to using the config with path \"Executables - PHP - Path\" in Atom-Beautify package settings.")
|
@deprecate("The \"cs_fixer_path\" has been deprecated. Please switch to using the config with path \"Executables - PHP-CS-Fixer - Path\" in Atom-Beautify package settings now.")
|
||||||
|
|
||||||
@Promise.all([
|
@Promise.all([
|
||||||
@which(options.cs_fixer_path) if options.cs_fixer_path
|
@which(options.cs_fixer_path) if options.cs_fixer_path
|
||||||
|
|
|
@ -9130,6 +9130,25 @@
|
||||||
"order": -1,
|
"order": -1,
|
||||||
"description": "Configure executables used by beautifiers.",
|
"description": "Configure executables used by beautifiers.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"emacs": {
|
||||||
|
"key": "emacs",
|
||||||
|
"title": "Emacs",
|
||||||
|
"type": "object",
|
||||||
|
"collapsed": true,
|
||||||
|
"description": "Options for Emacs executable.",
|
||||||
|
"beautifiers": [
|
||||||
|
"Fortran Beautifier"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"key": "path",
|
||||||
|
"title": "Executable Path",
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "Absolute path to the \"emacs\" executable."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"php": {
|
"php": {
|
||||||
"key": "php",
|
"key": "php",
|
||||||
"title": "PHP",
|
"title": "PHP",
|
||||||
|
@ -9149,8 +9168,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"php_cs_fixer": {
|
"php-cs-fixer": {
|
||||||
"key": "php_cs_fixer",
|
"key": "php-cs-fixer",
|
||||||
"title": "PHP-CS-Fixer",
|
"title": "PHP-CS-Fixer",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"collapsed": true,
|
"collapsed": true,
|
||||||
|
|
Loading…
Reference in New Issue