See #1980. Improve VHDL beautifier based on PR review

This commit is contained in:
Glavin Wiechert 2018-03-01 21:10:48 -04:00
parent 9a761f7957
commit c8e5baf53f
5 changed files with 36 additions and 108 deletions

View File

@ -137,6 +137,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
| Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):<br/>1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`<br/><br/>:bookmark_tabs: Manually:<br/>1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify<br/> |
| VHDL Beautifier | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:<br/>1. Install [Emacs (`emacs`)](https://www.gnu.org/software/emacs/) by following https://www.gnu.org/software/emacs/<br/> |
| Vue Beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| yapf | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/google/yapf and follow the instructions. |
@ -209,6 +210,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
| UX Markup | `UX` |`.ux` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
| Vala | `Vala` |`.vala`, `.vapi` | **[`Uncrustify`](https://github.com/uncrustify/uncrustify)** |
| Verilog | `Verilog` |`.svh`, `.v`, `.sv` | **[`Emacs Verilog Mode`](https://www.veripool.org/projects/verilog-mode/)** |
| VHDL | `VHDL 2008` |`.vhd`, `.VHD` | **[`VHDL Beautifier`](https://www.gnu.org/software/emacs/)** |
| Visualforce | `Visualforce` |`.page` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
| Vue | `Vue Component` |`.vue` | **[`Vue Beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee)**, [`Prettier`](https://github.com/prettier/prettier) |
| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp`, `.plist`, `.recipe`, `.config` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`JS Beautify`](https://github.com/beautify-web/js-beautify) |

View File

@ -13219,21 +13219,20 @@ Path to emacs init.el script with formatting settings. (Leave blank to use defau
}
```
#### [Vhdl](#vhdl)
#### [VHDL](#vhdl)
**Supported Beautifiers**: [`Vhdl Beautifier`](#vhdl-beautifier)
**Supported Beautifiers**: [`VHDL Beautifier`](#vhdl-beautifier)
| Option | Vhdl Beautifier |
| Option | VHDL Beautifier |
| --- | --- |
| `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
| `emacs_path` | :white_check_mark: |
| `emacs_script_path` | :white_check_mark: |
**Description**:
Options for language Vhdl
Options for language VHDL
##### [Disable Beautifying Language](#disable-beautifying-language)
@ -13243,7 +13242,7 @@ Options for language Vhdl
**Description**:
Disable Vhdl Beautification
Disable VHDL Beautification
**How to Configure**
@ -13256,15 +13255,15 @@ Disable Vhdl Beautification
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Default**: `Vhdl Beautifier`
**Default**: `VHDL Beautifier`
**Type**: `string`
**Enum**: `Vhdl Beautifier`
**Enum**: `VHDL Beautifier`
**Description**:
Default Beautifier to be used for Vhdl
Default Beautifier to be used for VHDL
**How to Configure**
@ -13281,7 +13280,7 @@ Default Beautifier to be used for Vhdl
**Description**:
Automatically beautify Vhdl files on save
Automatically beautify VHDL files on save
**How to Configure**
@ -13290,30 +13289,6 @@ Automatically beautify Vhdl files on save
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
##### [Emacs path](#emacs-path)
**Namespace**: `vhdl`
**Key**: `emacs_path`
**Type**: `string`
**Supported Beautifiers**: [`Vhdl Beautifier`](#vhdl-beautifier)
**Description**:
Path to the `emacs` executable (Supported by Vhdl Beautifier)
**Example `.jsbeautifyrc` Configuration**
```json
{
"vhdl": {
"emacs_path": ""
}
}
```
##### [Emacs script path](#emacs-script-path)
**Namespace**: `vhdl`
@ -13322,11 +13297,11 @@ Path to the `emacs` executable (Supported by Vhdl Beautifier)
**Type**: `string`
**Supported Beautifiers**: [`Vhdl Beautifier`](#vhdl-beautifier)
**Supported Beautifiers**: [`VHDL Beautifier`](#vhdl-beautifier)
**Description**:
Path to the emacs script (Supported by Vhdl Beautifier)
Path to the emacs script (Supported by VHDL Beautifier)
**Example `.jsbeautifyrc` Configuration**
@ -18045,31 +18020,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
```
### Vhdl Beautifier
##### [Emacs path](#emacs-path)
**Namespace**: `vhdl`
**Key**: `emacs_path`
**Type**: `string`
**Supported Beautifiers**: [`Vhdl Beautifier`](#vhdl-beautifier)
**Description**:
Path to the `emacs` executable (Supported by Vhdl Beautifier)
**Example `.jsbeautifyrc` Configuration**
```json
{
"vhdl": {
"emacs_path": ""
}
}
```
### VHDL Beautifier
##### [Emacs script path](#emacs-script-path)
@ -18079,11 +18030,11 @@ Path to the `emacs` executable (Supported by Vhdl Beautifier)
**Type**: `string`
**Supported Beautifiers**: [`Vhdl Beautifier`](#vhdl-beautifier)
**Supported Beautifiers**: [`VHDL Beautifier`](#vhdl-beautifier)
**Description**:
Path to the emacs script (Supported by Vhdl Beautifier)
Path to the emacs script (Supported by VHDL Beautifier)
**Example `.jsbeautifyrc` Configuration**

View File

@ -7,7 +7,7 @@ Beautifier = require('../beautifier')
path = require("path")
module.exports = class VhdlBeautifier extends Beautifier
name: "Vhdl Beautifier"
name: "VHDL Beautifier"
link: "https://www.gnu.org/software/emacs/"
executables: [
{
@ -22,14 +22,15 @@ module.exports = class VhdlBeautifier extends Beautifier
]
options: {
Vhdl: true
VHDL: {
emacs_script_path: true
}
}
beautify: (text, language, options) ->
@debug('vhdl-beautifier', options)
emacs = @exe("emacs")
emacs_path = options.emacs_path
emacs_script_path = options.emacs_script_path
if not emacs_script_path
@ -46,14 +47,7 @@ module.exports = class VhdlBeautifier extends Beautifier
tempFile = @tempFile("temp", text)
]
if emacs_path
@deprecateOptionForExecutable("Emacs", "emacs_path", "Path")
@run(emacs_path, args, {ignoreReturnCode: false})
.then(=>
@readFile(tempFile)
)
else
emacs.run(args, {ignoreReturnCode: false})
.then(=>
@readFile(tempFile)
)
emacs.run(args, {ignoreReturnCode: false})
.then(=>
@readFile(tempFile)
)

View File

@ -1,6 +1,6 @@
module.exports = {
name: "Vhdl"
name: "VHDL"
namespace: "vhdl"
###
@ -22,11 +22,6 @@ module.exports = {
###
options:
# JavaScript
emacs_path:
type: 'string'
default: ""
description: "Path to the `emacs` executable"
emacs_script_path:
type: 'string'
default: ""

View File

@ -8193,12 +8193,12 @@
}
},
"vhdl": {
"title": "Vhdl",
"title": "VHDL",
"type": "object",
"description": "Options for language Vhdl",
"description": "Options for language VHDL",
"collapsed": true,
"beautifiers": [
"Vhdl Beautifier"
"VHDL Beautifier"
],
"grammars": [
"VHDL 2008"
@ -8208,31 +8208,17 @@
"VHD"
],
"properties": {
"emacs_path": {
"type": "string",
"default": "",
"description": "Path to the `emacs` executable (Supported by Vhdl Beautifier)",
"title": "Emacs path",
"beautifiers": [
"Vhdl Beautifier"
],
"key": "emacs_path",
"language": {
"name": "Vhdl",
"namespace": "vhdl"
}
},
"emacs_script_path": {
"type": "string",
"default": "",
"description": "Path to the emacs script (Supported by Vhdl Beautifier)",
"description": "Path to the emacs script (Supported by VHDL Beautifier)",
"title": "Emacs script path",
"beautifiers": [
"Vhdl Beautifier"
"VHDL Beautifier"
],
"key": "emacs_script_path",
"language": {
"name": "Vhdl",
"name": "VHDL",
"namespace": "vhdl"
}
},
@ -8241,16 +8227,16 @@
"order": -3,
"type": "boolean",
"default": false,
"description": "Disable Vhdl Beautification"
"description": "Disable VHDL Beautification"
},
"default_beautifier": {
"title": "Default Beautifier",
"order": -2,
"type": "string",
"default": "Vhdl Beautifier",
"description": "Default Beautifier to be used for Vhdl",
"default": "VHDL Beautifier",
"description": "Default Beautifier to be used for VHDL",
"enum": [
"Vhdl Beautifier"
"VHDL Beautifier"
]
},
"beautify_on_save": {
@ -8258,7 +8244,7 @@
"order": -1,
"type": "boolean",
"default": false,
"description": "Automatically beautify Vhdl files on save"
"description": "Automatically beautify VHDL files on save"
}
}
},