Merge branch 'sqlformat-indent' of https://github.com/faheel/atom-beautify into faheel-sqlformat-indent

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

View File

@ -1,4 +1,5 @@
# Next # Next
- Add "Reindent" option for sqlformat. See [#1926](https://github.com/Glavin001/atom-beautify/pull/1926).
- Add hindent and brittany beautifiers for haskell - 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). - 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`) - 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: | | `identifiers` | :white_check_mark: |
| `indent_size` | :white_check_mark: | | `indent_size` | :white_check_mark: |
| `keywords` | :white_check_mark: | | `keywords` | :white_check_mark: |
| `reindent` | :white_check_mark: |
**Description**: **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) #### [SVG](#svg)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **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) ##### [Keywords](#keywords)
**Namespace**: `sql` **Namespace**: `sql`

View File

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

View File

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

View File

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

View File

@ -6737,6 +6737,20 @@
"namespace": "sql" "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": { "keywords": {
"type": "string", "type": "string",
"default": "upper", "default": "upper",