Python: formater->formatter
This commit is contained in:
parent
30dece209a
commit
42183d1b5e
|
@ -10262,7 +10262,7 @@ Automatically beautify Puppet files on save
|
||||||
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| `default_beautifier` | :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: |
|
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| `formater` | :white_check_mark: | :white_check_mark: | :x: |
|
| `formatter` | :white_check_mark: | :white_check_mark: | :x: |
|
||||||
| `ignore` | :white_check_mark: | :white_check_mark: | :x: |
|
| `ignore` | :white_check_mark: | :white_check_mark: | :x: |
|
||||||
| `indent_size` | :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: |
|
| `max_line_length` | :white_check_mark: | :white_check_mark: | :x: |
|
||||||
|
@ -10329,11 +10329,11 @@ Automatically beautify Python files on save
|
||||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||||
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
|
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
|
||||||
|
|
||||||
##### [Formater](#formater)
|
##### [Formatter](#formatter)
|
||||||
|
|
||||||
**Namespace**: `python`
|
**Namespace**: `python`
|
||||||
|
|
||||||
**Key**: `formater`
|
**Key**: `formatter`
|
||||||
|
|
||||||
**Default**: `autopep8`
|
**Default**: `autopep8`
|
||||||
|
|
||||||
|
@ -10352,7 +10352,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"python": {
|
"python": {
|
||||||
"formater": "autopep8"
|
"formatter": "autopep8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -19982,11 +19982,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
##### [Formater](#formater)
|
##### [Formatter](#formatter)
|
||||||
|
|
||||||
**Namespace**: `python`
|
**Namespace**: `python`
|
||||||
|
|
||||||
**Key**: `formater`
|
**Key**: `formatter`
|
||||||
|
|
||||||
**Default**: `autopep8`
|
**Default**: `autopep8`
|
||||||
|
|
||||||
|
@ -20005,7 +20005,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"python": {
|
"python": {
|
||||||
"formater": "autopep8"
|
"formatter": "autopep8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -20335,11 +20335,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
##### [Formater](#formater)
|
##### [Formatter](#formatter)
|
||||||
|
|
||||||
**Namespace**: `python`
|
**Namespace**: `python`
|
||||||
|
|
||||||
**Key**: `formater`
|
**Key**: `formatter`
|
||||||
|
|
||||||
**Default**: `autopep8`
|
**Default**: `autopep8`
|
||||||
|
|
||||||
|
@ -20358,7 +20358,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier)
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"python": {
|
"python": {
|
||||||
"formater": "autopep8"
|
"formatter": "autopep8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -445,4 +445,4 @@
|
||||||
"prettydiff2"
|
"prettydiff2"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ MULTI_LINE_OUTPUT_TABLE = {
|
||||||
'NOQA': 6
|
'NOQA': 6
|
||||||
}
|
}
|
||||||
|
|
||||||
format = (data, formaters) ->
|
format = (data, formatters) ->
|
||||||
return new Promise (resolve, reject) ->
|
return new Promise (resolve, reject) ->
|
||||||
client = new net.Socket()
|
client = new net.Socket()
|
||||||
client.on 'error', (error) ->
|
client.on 'error', (error) ->
|
||||||
|
@ -22,7 +22,7 @@ format = (data, formaters) ->
|
||||||
reject(error)
|
reject(error)
|
||||||
client.connect PORT, HOST, ->
|
client.connect PORT, HOST, ->
|
||||||
client.setEncoding('utf8')
|
client.setEncoding('utf8')
|
||||||
client.write(JSON.stringify({'data': data, 'formaters': formaters}))
|
client.write(JSON.stringify({'data': data, 'formatters': formatters}))
|
||||||
response = ''
|
response = ''
|
||||||
client.on 'data', (chunk) ->
|
client.on 'data', (chunk) ->
|
||||||
response += chunk
|
response += chunk
|
||||||
|
@ -45,22 +45,22 @@ module.exports = class PythonBeautifier extends Beautifier
|
||||||
}
|
}
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
formater = {'name': options.formater}
|
formatter = {'name': options.formatter}
|
||||||
if options.formater == 'autopep8'
|
if options.formatter == 'autopep8'
|
||||||
formater.config = {
|
formatter.config = {
|
||||||
'ignore': options.ignore
|
'ignore': options.ignore
|
||||||
'max_line_length': options.max_line_length
|
'max_line_length': options.max_line_length
|
||||||
}
|
}
|
||||||
else if options.formater == 'yapf'
|
else if options.formatter == 'yapf'
|
||||||
formater.config = {'style_config': options.style_config}
|
formatter.config = {'style_config': options.style_config}
|
||||||
formaters = [formater]
|
formatters = [formatter]
|
||||||
if options.sort_imports
|
if options.sort_imports
|
||||||
multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output]
|
multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output]
|
||||||
formaters.push
|
formatters.push
|
||||||
'name': 'isort'
|
'name': 'isort'
|
||||||
'config': {'multi_line_output': multi_line_output}
|
'config': {'multi_line_output': multi_line_output}
|
||||||
return new @Promise (resolve, reject) ->
|
return new @Promise (resolve, reject) ->
|
||||||
format(text, formaters)
|
format(text, formatters)
|
||||||
.then (data) ->
|
.then (data) ->
|
||||||
resolve(data)
|
resolve(data)
|
||||||
.catch (error) ->
|
.catch (error) ->
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
||||||
items:
|
items:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
description: "do not fix these errors/warnings"
|
description: "do not fix these errors/warnings"
|
||||||
formater:
|
formatter:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
default: 'autopep8'
|
default: 'autopep8'
|
||||||
enum: ['autopep8', 'yapf']
|
enum: ['autopep8', 'yapf']
|
||||||
|
|
|
@ -6108,7 +6108,7 @@
|
||||||
"namespace": "python"
|
"namespace": "python"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"formater": {
|
"formatter": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "autopep8",
|
"default": "autopep8",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
@ -6116,12 +6116,12 @@
|
||||||
"yapf"
|
"yapf"
|
||||||
],
|
],
|
||||||
"description": "formatter used by pybeautifier (Supported by autopep8, pybeautifier)",
|
"description": "formatter used by pybeautifier (Supported by autopep8, pybeautifier)",
|
||||||
"title": "Formater",
|
"title": "Formatter",
|
||||||
"beautifiers": [
|
"beautifiers": [
|
||||||
"autopep8",
|
"autopep8",
|
||||||
"pybeautifier"
|
"pybeautifier"
|
||||||
],
|
],
|
||||||
"key": "formater",
|
"key": "formatter",
|
||||||
"language": {
|
"language": {
|
||||||
"name": "Python",
|
"name": "Python",
|
||||||
"namespace": "python"
|
"namespace": "python"
|
||||||
|
|
Loading…
Reference in New Issue