remove do not change whitespace

This commit is contained in:
hxsf 2017-05-28 15:07:51 +08:00
parent c53b92e3fb
commit ce287977c8
4 changed files with 37 additions and 24 deletions

View File

@ -7633,7 +7633,7 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff)
| `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
| `do_not_change_whitespace` | :white_check_mark: |
| `end_of_line` | :white_check_mark: |
**Description**:
@ -7694,26 +7694,30 @@ Automatically beautify Lua 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.
##### [Do not change whitespace](#do-not-change-whitespace)
##### [End of line](#end-of-line)
**Namespace**: `lua`
**Key**: `do_not_change_whitespace`
**Key**: `end_of_line`
**Type**: `boolean`
**Default**: `System Default`
**Type**: `string`
**Enum**: `CRLF` `LF` `System Default`
**Supported Beautifiers**: [`Lua beautifier`](#lua-beautifier)
**Description**:
do not adjust whitespace (Supported by Lua beautifier)
Override EOL from line-ending-selector (Supported by Lua beautifier)
**Example `.jsbeautifyrc` Configuration**
```json
{
"lua": {
"do_not_change_whitespace": false
"end_of_line": "System Default"
}
}
```
@ -16802,26 +16806,30 @@ undefined (Supported by Latex Beautify)
### Lua beautifier
##### [Do not change whitespace](#do-not-change-whitespace)
##### [End of line](#end-of-line)
**Namespace**: `lua`
**Key**: `do_not_change_whitespace`
**Key**: `end_of_line`
**Type**: `boolean`
**Default**: `System Default`
**Type**: `string`
**Enum**: `CRLF` `LF` `System Default`
**Supported Beautifiers**: [`Lua beautifier`](#lua-beautifier)
**Description**:
do not adjust whitespace (Supported by Lua beautifier)
Override EOL from line-ending-selector (Supported by Lua beautifier)
**Example `.jsbeautifyrc` Configuration**
```json
{
"lua": {
"do_not_change_whitespace": false
"end_of_line": "System Default"
}
}
```

View File

@ -27,7 +27,6 @@ DEFAULT_WARN_FN = (msg) ->
console.log('WARNING:', msg)
module.exports = (str, indent, warn_fn, opts = {}) ->
do_not_change_whitespace = !!opts?.do_not_change_whitespace
eol = opts?.eol or '\n'
indent = indent or DEFAULT_INDENT
warn_fn = if typeof warn_fn == 'function' then warn_fn else DEFAULT_WARN_FN
@ -48,7 +47,7 @@ module.exports = (str, indent, warn_fn, opts = {}) ->
arr = line.split(/\]=*\]/, 2)
comment = arr[0]
code = arr[1]
line = comment + ']' + '='.repeat($template - 1) + ']' + if do_not_change_whitespace then code else adjust_space(code)
line = comment + ']' + '='.repeat($template - 1) + ']' + adjust_space(code)
$template = 0
$template = 0
else
@ -59,7 +58,7 @@ module.exports = (str, indent, warn_fn, opts = {}) ->
if !$template_flag
line = line.trim()
# remote all spaces on both ends
line = if do_not_change_whitespace then line else adjust_space(line)
line = adjust_space(line)
if !line.length
return ''
raw_line = line

View File

@ -20,8 +20,9 @@ module.exports = {
defaultBeautifier: "Lua beautifier"
options:
do_not_change_whitespace:
type: 'boolean'
default: false
description: "do not adjust whitespace"
end_of_line:
type: 'string'
default: "System Default"
enum: ["CRLF","LF","System Default"]
description: "Override EOL from line-ending-selector"
}

View File

@ -4567,15 +4567,20 @@
"lua"
],
"properties": {
"do_not_change_whitespace": {
"type": "boolean",
"default": false,
"description": "do not adjust whitespace (Supported by Lua beautifier)",
"title": "Do not change whitespace",
"end_of_line": {
"type": "string",
"default": "System Default",
"enum": [
"CRLF",
"LF",
"System Default"
],
"description": "Override EOL from line-ending-selector (Supported by Lua beautifier)",
"title": "End of line",
"beautifiers": [
"Lua beautifier"
],
"key": "do_not_change_whitespace",
"key": "end_of_line",
"language": {
"name": "Lua",
"namespace": "lua"