Switch Uncrustify to using Exectuables

This commit is contained in:
Glavin Wiechert 2017-06-01 02:59:55 -03:00
parent cefa7afa6b
commit 9144df29a1
3 changed files with 74 additions and 4 deletions

View File

@ -242,6 +242,27 @@ Options for PHPCBF 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 "*PHPCBF*" and change it to your desired configuration. 3. Find the option "*PHPCBF*" and change it to your desired configuration.
##### [Uncrustify](#uncrustify)
**Namespace**: ``
**Key**: `uncrustify`
**Type**: `object`
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
**Description**:
Options for Uncrustify 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 "*Uncrustify*" and change it to your desired configuration.
#### [Apex](#apex) #### [Apex](#apex)
**Supported Beautifiers**: [`Uncrustify`](#uncrustify) **Supported Beautifiers**: [`Uncrustify`](#uncrustify)
@ -19072,6 +19093,27 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
} }
``` ```
##### [Uncrustify](#uncrustify)
**Namespace**: ``
**Key**: `uncrustify`
**Type**: `object`
**Supported Beautifiers**: [`Uncrustify`](#uncrustify)
**Description**:
Options for Uncrustify 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 "*Uncrustify*" and change it to your desired configuration.
### Vue Beautifier ### Vue Beautifier

View File

@ -11,7 +11,17 @@ _ = require('lodash')
module.exports = class Uncrustify extends Beautifier module.exports = class Uncrustify extends Beautifier
name: "Uncrustify" name: "Uncrustify"
link: "https://github.com/uncrustify/uncrustify" link: "https://github.com/uncrustify/uncrustify"
isPreInstalled: false executables: [
{
name: "Uncrustify"
cmd: "uncrustify"
homepage: "http://uncrustify.sourceforge.net/"
installation: "https://github.com/uncrustify/uncrustify"
version: {
parse: (text) -> text.match(/uncrustify (\d+\.\d+)/)[1] + ".0"
}
}
]
options: { options: {
Apex: true Apex: true
@ -27,6 +37,7 @@ module.exports = class Uncrustify extends Beautifier
} }
beautify: (text, language, options) -> beautify: (text, language, options) ->
uncrustify = @exe("uncrustify")
# console.log('uncrustify.beautify', language, options) # console.log('uncrustify.beautify', language, options)
return new @Promise((resolve, reject) -> return new @Promise((resolve, reject) ->
configPath = options.configPath configPath = options.configPath
@ -50,8 +61,6 @@ module.exports = class Uncrustify extends Beautifier
reject(new Error("No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify.")) reject(new Error("No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify."))
) )
.then((configPath) => .then((configPath) =>
# Select Uncrustify language # Select Uncrustify language
lang = "C" # Default is C lang = "C" # Default is C
switch language switch language
@ -76,7 +85,7 @@ module.exports = class Uncrustify extends Beautifier
when "Arduino" when "Arduino"
lang = "CPP" lang = "CPP"
@run("uncrustify", [ uncrustify.run([
"-c" "-c"
configPath configPath
"-f" "-f"

View File

@ -9130,6 +9130,25 @@
"order": -1, "order": -1,
"description": "Configure executables used by beautifiers.", "description": "Configure executables used by beautifiers.",
"properties": { "properties": {
"uncrustify": {
"key": "uncrustify",
"title": "Uncrustify",
"type": "object",
"collapsed": true,
"description": "Options for Uncrustify executable.",
"beautifiers": [
"Uncrustify"
],
"properties": {
"path": {
"key": "path",
"title": "Executable Path",
"type": "string",
"default": "",
"description": "Absolute path to the \"uncrustify\" executable."
}
}
},
"emacs": { "emacs": {
"key": "emacs", "key": "emacs",
"title": "Emacs", "title": "Emacs",