Merge pull request #1330 from guyskk/master
Add option to disable the loading notification && Add pybeautifier
This commit is contained in:
commit
053012e48c
|
@ -155,7 +155,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
|
|||
| Perl | `Perl`, `Perl 6` |`.pl` | [`Perltidy`](http://perltidy.sourceforge.net/) (Default) |
|
||||
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (Default), [`PHPCBF`](http://php.net/manual/en/install.php), [`hh_format`](http://hhvm.com/) |
|
||||
| Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) |
|
||||
| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) |
|
||||
| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`pybeautifier`](https://github.com/guyskk/pybeautifier), [`yapf`](https://github.com/google/yapf) |
|
||||
| R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) |
|
||||
| Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
|
||||
| Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) |
|
||||
|
|
417
docs/options.md
417
docs/options.md
|
@ -10573,6 +10573,21 @@ Path to custom CSScomb config file, used in absense of a `.csscomb.json` or `.cs
|
|||
}
|
||||
```
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier) [`yapf`](#yapf)
|
||||
|
||||
| Option | autopep8 | pybeautifier | yapf |
|
||||
| --- | --- | --- | --- |
|
||||
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| `formater` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `ignore` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `indent_size` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `max_line_length` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `multi_line_output` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `sort_imports` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| `style_config` | :white_check_mark: | :white_check_mark: | :x: |
|
||||
|
||||
##### [Convert quotes](#convert-quotes)
|
||||
|
||||
**Namespace**: `css`
|
||||
|
@ -10609,6 +10624,8 @@ Convert the quote characters delimiting strings from either double or single quo
|
|||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Enum**: `autopep8` `pybeautifier` `yapf`
|
||||
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
||||
**Description**:
|
||||
|
@ -10651,6 +10668,34 @@ Indentation character (Supported by Pretty Diff)
|
|||
}
|
||||
```
|
||||
|
||||
##### [Formater](#formater)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `formater`
|
||||
|
||||
**Default**: `autopep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `autopep8` `yapf`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formater used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"formater": "autopep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Indent comments](#indent-comments)
|
||||
|
||||
**Namespace**: `css`
|
||||
|
@ -10661,6 +10706,12 @@ Indentation character (Supported by Pretty Diff)
|
|||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
do not fix these errors/warnings (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
||||
**Description**:
|
||||
|
@ -10687,12 +10738,20 @@ Determines whether comments should be indented. (Supported by Pretty Diff)
|
|||
|
||||
**Type**: `integer`
|
||||
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by Pretty Diff)
|
||||
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
|
@ -10713,6 +10772,11 @@ Indentation size/length (Supported by Pretty Diff)
|
|||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
set maximum allowed line length (Supported by autopep8, pybeautifier)
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
||||
**Description**:
|
||||
|
@ -10729,6 +10793,36 @@ Add a newline between CSS rules (Supported by Pretty Diff)
|
|||
}
|
||||
```
|
||||
|
||||
##### [Multi line output](#multi-line-output)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `multi_line_output`
|
||||
|
||||
**Default**: `Hanging Grid Grouped`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"multi_line_output": "Hanging Grid Grouped"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Sort imports](#sort-imports)
|
||||
|
||||
##### [No lead zero](#no-lead-zero)
|
||||
|
||||
**Namespace**: `css`
|
||||
|
@ -10737,6 +10831,12 @@ Add a newline between CSS rules (Supported by Pretty Diff)
|
|||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
sort imports (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
|
||||
|
||||
**Description**:
|
||||
|
@ -10753,6 +10853,36 @@ If in CSS values leading 0s immediately preceeding a decimal should be removed o
|
|||
}
|
||||
```
|
||||
|
||||
##### [Style config](#style-config)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `style_config`
|
||||
|
||||
**Default**: `pep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formatting style used by yapf (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"style_config": "pep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### [R](#r)
|
||||
|
||||
**Supported Beautifiers**: [`formatR`](#formatr)
|
||||
|
||||
##### [comb predefined config](#comb-predefined-config)
|
||||
|
||||
**Namespace**: `css`
|
||||
|
@ -18825,11 +18955,11 @@ List of tags (defaults to [head,body,/html] that should have an extra newline be
|
|||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8)
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
set maximum allowed line length (Supported by autopep8)
|
||||
set maximum allowed line length (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
|
@ -18851,11 +18981,11 @@ set maximum allowed line length (Supported by autopep8)
|
|||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8)
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by autopep8)
|
||||
Indentation size/length (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
|
@ -18877,11 +19007,11 @@ Indentation size/length (Supported by autopep8)
|
|||
|
||||
**Type**: `array`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8)
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
do not fix these errors/warnings (Supported by autopep8)
|
||||
do not fix these errors/warnings (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
|
@ -18895,6 +19025,60 @@ do not fix these errors/warnings (Supported by autopep8)
|
|||
}
|
||||
```
|
||||
|
||||
##### [Formater](#formater)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `formater`
|
||||
|
||||
**Default**: `autopep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `autopep8` `yapf`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formater used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"formater": "autopep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Style config](#style-config)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `style_config`
|
||||
|
||||
**Default**: `pep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formatting style used by yapf (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"style_config": "pep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Sort imports](#sort-imports)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
@ -18903,11 +19087,11 @@ do not fix these errors/warnings (Supported by autopep8)
|
|||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8)
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
sort imports (requires isort installed) (Supported by autopep8)
|
||||
sort imports (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
|
@ -18919,6 +19103,34 @@ sort imports (requires isort installed) (Supported by autopep8)
|
|||
}
|
||||
```
|
||||
|
||||
##### [Multi line output](#multi-line-output)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `multi_line_output`
|
||||
|
||||
**Default**: `Hanging Grid Grouped`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"multi_line_output": "Hanging Grid Grouped"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### beautysh
|
||||
|
||||
|
@ -19084,6 +19296,195 @@ Indentation size/length (Supported by formatR)
|
|||
```
|
||||
|
||||
|
||||
### pybeautifier
|
||||
|
||||
##### [Max line length](#max-line-length)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `max_line_length`
|
||||
|
||||
**Default**: `79`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
set maximum allowed line length (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"max_line_length": 79
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Indent size](#indent-size)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `indent_size`
|
||||
|
||||
**Default**: `4`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"indent_size": 4
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Ignore](#ignore)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `ignore`
|
||||
|
||||
**Default**: `E24`
|
||||
|
||||
**Type**: `array`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
do not fix these errors/warnings (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"ignore": [
|
||||
"E24"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Formater](#formater)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `formater`
|
||||
|
||||
**Default**: `autopep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `autopep8` `yapf`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formater used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"formater": "autopep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Style config](#style-config)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `style_config`
|
||||
|
||||
**Default**: `pep8`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
formatting style used by yapf (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"style_config": "pep8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Sort imports](#sort-imports)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `sort_imports`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
sort imports (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"sort_imports": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### [Multi line output](#multi-line-output)
|
||||
|
||||
**Namespace**: `python`
|
||||
|
||||
**Key**: `multi_line_output`
|
||||
|
||||
**Default**: `Hanging Grid Grouped`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Grid` `Vertical` `Hanging Indent` `Vertical Hanging Indent` `Hanging Grid` `Hanging Grid Grouped` `NOQA`
|
||||
|
||||
**Supported Beautifiers**: [`autopep8`](#autopep8) [`pybeautifier`](#pybeautifier)
|
||||
|
||||
**Description**:
|
||||
|
||||
defines how from imports wrap (requires isort installed) (Supported by autopep8, pybeautifier)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"python": {
|
||||
"multi_line_output": "Hanging Grid Grouped"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### rustfmt
|
||||
|
||||
##### [Rustfmt path](#rustfmt-path)
|
||||
|
|
|
@ -115,6 +115,10 @@
|
|||
"name": "Victor Uriarte",
|
||||
"url": "https://github.com/vmuriart"
|
||||
},
|
||||
{
|
||||
"name": "guyskk",
|
||||
"url": "https://github.com/guyskk"
|
||||
},
|
||||
{
|
||||
"name": "Denys Vitali",
|
||||
"url": "https://github.com/denysvitali"
|
||||
|
@ -307,6 +311,7 @@
|
|||
"clojure beautifier",
|
||||
"nunjucks",
|
||||
"ux markup",
|
||||
"pybeautifier",
|
||||
"cljfmt",
|
||||
"bash",
|
||||
"beautysh",
|
||||
|
|
|
@ -60,6 +60,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'php-cs-fixer'
|
||||
'phpcbf'
|
||||
'prettydiff'
|
||||
'pybeautifier'
|
||||
'pug-beautify'
|
||||
'puppet-fix'
|
||||
'remark'
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
'use strict'
|
||||
net = require('net')
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
HOST = '127.0.0.1'
|
||||
PORT = 36805
|
||||
MULTI_LINE_OUTPUT_TABLE = {
|
||||
'Grid': 0,
|
||||
'Vertical': 1,
|
||||
'Hanging Indent': 2,
|
||||
'Vertical Hanging Indent': 3,
|
||||
'Hanging Grid': 4,
|
||||
'Hanging Grid Grouped': 5,
|
||||
'NOQA': 6
|
||||
}
|
||||
|
||||
format = (data, formaters) ->
|
||||
return new Promise (resolve, reject) ->
|
||||
client = new net.Socket()
|
||||
client.on 'error', (error) ->
|
||||
client.destroy()
|
||||
reject(error)
|
||||
client.connect PORT, HOST, ->
|
||||
client.setEncoding('utf8')
|
||||
client.write(JSON.stringify({'data': data, 'formaters': formaters}))
|
||||
response = ''
|
||||
client.on 'data', (chunk) ->
|
||||
response += chunk
|
||||
client.on 'end', ->
|
||||
response = JSON.parse(response)
|
||||
if response.error?
|
||||
reject(Error(response.error))
|
||||
else
|
||||
resolve(response.data)
|
||||
client.destroy()
|
||||
|
||||
module.exports = class PythonBeautifier extends Beautifier
|
||||
|
||||
name: "pybeautifier"
|
||||
link: "https://github.com/guyskk/pybeautifier"
|
||||
|
||||
options: {
|
||||
Python: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
formater = {'name': options.formater}
|
||||
if options.formater == 'autopep8'
|
||||
formater.config = {
|
||||
'ignore': options.ignore
|
||||
'max_line_length': options.max_line_length
|
||||
}
|
||||
else if options.formater == 'yapf'
|
||||
formater.config = {'style_config': options.style_config}
|
||||
formaters = [formater]
|
||||
if options.sort_imports
|
||||
multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output]
|
||||
formaters.push
|
||||
'name': 'isort'
|
||||
'config': {'multi_line_output': multi_line_output}
|
||||
return new @Promise (resolve, reject) ->
|
||||
format(text, formaters)
|
||||
.then (data) ->
|
||||
resolve(data)
|
||||
.catch (error) ->
|
||||
reject(error)
|
|
@ -56,9 +56,10 @@ setCursors = (editor, posArray) ->
|
|||
|
||||
# Show beautification progress/loading view
|
||||
beautifier.on('beautify::start', ->
|
||||
LoadingView ?= require "./views/loading-view"
|
||||
loadingView ?= new LoadingView()
|
||||
loadingView.show()
|
||||
if atom.config.get("atom-beautify.general.showLoadingView")
|
||||
LoadingView ?= require "./views/loading-view"
|
||||
loadingView ?= new LoadingView()
|
||||
loadingView.show()
|
||||
)
|
||||
beautifier.on('beautify::end', ->
|
||||
loadingView?.hide()
|
||||
|
|
|
@ -42,4 +42,9 @@ module.exports = {
|
|||
type : 'boolean'
|
||||
default : false
|
||||
description : "Do not show any/all errors when they occur"
|
||||
showLoadingView :
|
||||
title: "Show Loading View"
|
||||
type : 'boolean'
|
||||
default : true
|
||||
description : "Show loading view when beautifying"
|
||||
}
|
||||
|
|
|
@ -41,9 +41,30 @@ module.exports = {
|
|||
items:
|
||||
type: 'string'
|
||||
description: "do not fix these errors/warnings"
|
||||
formater:
|
||||
type: 'string'
|
||||
default: 'autopep8'
|
||||
enum: ['autopep8', 'yapf']
|
||||
description: "formater used by pybeautifier"
|
||||
style_config:
|
||||
type: 'string'
|
||||
default: 'pep8'
|
||||
description: "formatting style used by yapf"
|
||||
sort_imports:
|
||||
type: 'boolean'
|
||||
default: false
|
||||
description: "sort imports (requires isort installed)"
|
||||
|
||||
multi_line_output:
|
||||
type: 'string'
|
||||
default: 'Hanging Grid Grouped'
|
||||
enum: [
|
||||
'Grid'
|
||||
'Vertical'
|
||||
'Hanging Indent'
|
||||
'Vertical Hanging Indent'
|
||||
'Hanging Grid'
|
||||
'Hanging Grid Grouped'
|
||||
'NOQA'
|
||||
]
|
||||
description: "defines how from imports wrap (requires isort installed)"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue