Merge branch 'faheel-sqlformat-indent'

This commit is contained in:
Glavin Wiechert 2018-03-01 20:35:36 -04:00
commit 08e9f7671d
6 changed files with 77 additions and 1 deletions

View File

@ -1,4 +1,5 @@
# Next
- Add "Reindent" option for sqlformat. See [#1926](https://github.com/Glavin001/atom-beautify/pull/1926).
- Add hindent and brittany beautifiers for haskell
- Breaking change to `pybeautifier`: Fix typo, change `formater` to `formatter`. See [#1898](https://github.com/Glavin001/atom-beautify/pull/1898).
- Fixes [#1773](https://github.com/Glavin001/atom-beautify/issues/1773) and [#793](https://github.com/Glavin001/atom-beautify/issues/793). ruby-beautify with Rubocop now respects `Exclude` settings, and properly loads inherited config files (like `~/.rubocop.yml`)

View File

@ -11387,6 +11387,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff)
| `identifiers` | :white_check_mark: |
| `indent_size` | :white_check_mark: |
| `keywords` | :white_check_mark: |
| `reindent` | :white_check_mark: |
**Description**:
@ -11529,6 +11530,32 @@ Change case of keywords (Supported by sqlformat)
}
```
##### [Reindent](#reindent)
**Namespace**: `sql`
**Key**: `reindent`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`sqlformat`](#sqlformat)
**Description**:
Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat)
**Example `.jsbeautifyrc` Configuration**
```json
{
"sql": {
"reindent": true
}
}
```
#### [SVG](#svg)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
@ -19160,6 +19187,32 @@ Indentation size/length (Supported by sqlformat)
}
```
##### [Reindent](#reindent)
**Namespace**: `sql`
**Key**: `reindent`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`sqlformat`](#sqlformat)
**Description**:
Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat)
**Example `.jsbeautifyrc` Configuration**
```json
{
"sql": {
"reindent": true
}
}
```
##### [Keywords](#keywords)
**Namespace**: `sql`

View File

@ -155,6 +155,10 @@
"name": "Christian Kjær Laustsen",
"email": "ckl@codetalk.io",
"url": "https://github.com/Tehnix"
},
{
"name": "Faheel Ahmad",
"url": "https://github.com/faheel"
}
],
"engines": {

View File

@ -17,7 +17,7 @@ module.exports = class Sqlformat extends Beautifier
beautify: (text, language, options) ->
@run("sqlformat", [
@tempFile("input", text)
"--reindent"
"--reindent=#{options.reindent}" if options.reindent?
"--indent_width=#{options.indent_size}" if options.indent_size?
"--keywords=#{options.keywords}" if (options.keywords? && options.keywords != 'unchanged')
"--identifiers=#{options.identifiers}" if (options.identifiers? && options.identifiers != 'unchanged')

View File

@ -26,6 +26,10 @@ module.exports = {
default: null
minimum: 0
description: "Indentation size/length"
reindent:
type: 'boolean'
default: true
description: "Change indentations of the statements. Uncheck this option to preserve indentation"
keywords:
type: 'string'
default: "upper"

View File

@ -6737,6 +6737,20 @@
"namespace": "sql"
}
},
"reindent": {
"type": "boolean",
"default": true,
"description": "Change indentations of the statements. Uncheck this option to preserve indentation (Supported by sqlformat)",
"title": "Reindent",
"beautifiers": [
"sqlformat"
],
"key": "reindent",
"language": {
"name": "SQL",
"namespace": "sql"
}
},
"keywords": {
"type": "string",
"default": "upper",