See #505 and #1494. Fix options of Nginx beautifier

This commit is contained in:
Glavin Wiechert 2017-04-15 02:26:27 -03:00
parent c10c9355d6
commit 85a744fb98
3 changed files with 199 additions and 174 deletions

View File

@ -6,7 +6,21 @@ module.exports = class NginxBeautify extends Beautifier
link: "https://github.com/denysvitali/nginxbeautify"
options: {
Nginx: true
Nginx: {
spaces: ["indent_with_tabs", "indent_size", "indent_char", (indent_with_tabs, indent_size, indent_char) ->
if indent_with_tabs or indent_char is "\t"
0
else
indent_size
]
tabs: ["indent_with_tabs", "indent_size", "indent_char", (indent_with_tabs, indent_size, indent_char) ->
if indent_with_tabs or indent_char is "\t"
indent_size
else
0
]
dontJoinCurlyBracet: true
}
}
beautify: (text, language, options) ->

View File

@ -1,3 +1,11 @@
# Get Atom defaults
scope = ['source.conf']
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
defaultIndentSize = (if softTabs then tabLength else 1)
defaultIndentChar = (if softTabs then " " else "\t")
defaultIndentWithTabs = not softTabs
module.exports = {
name: "Nginx"
@ -20,16 +28,19 @@ module.exports = {
defaultBeautifier: "Nginx Beautify"
options:
spaces:
title: "Spaces"
type: "number"
default: 0
description: "Indent with spaces"
tabs:
title: "Tabs"
type: "number"
default: 1
description: "Indent with tabs"
indent_size:
type: 'integer'
default: defaultIndentSize
minimum: 0
description: "Indentation size/length"
indent_char:
type: 'string'
default: defaultIndentChar
description: "Indentation character"
indent_with_tabs:
type: 'boolean'
default: defaultIndentWithTabs
description: "Indentation uses tabs, overrides `Indent Size` and `Indent Char`"
dontJoinCurlyBracet:
title: "Don't join curly brackets"
type: "boolean"