See #1959, #1951. Add indent_with_tabs to Bash language (replaces use_tabs)

This commit is contained in:
Glavin Wiechert 2018-03-01 21:26:08 -04:00
parent a9d3a0cce6
commit 111e3756b3
4 changed files with 56 additions and 7 deletions

View File

@ -641,6 +641,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
| `default_beautifier` | :white_check_mark: | | `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: |
| `indent_size` | :white_check_mark: | | `indent_size` | :white_check_mark: |
| `indent_with_tabs` | :white_check_mark: |
**Description**: **Description**:
@ -727,6 +728,30 @@ Indentation size/length (Supported by beautysh)
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `bash`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`beautysh`](#beautysh)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by beautysh)
**Example `.jsbeautifyrc` Configuration**
```json
{
"bash": {
"indent_with_tabs": false
}
}
```
#### [C](#c) #### [C](#c)
**Supported Beautifiers**: [`Uncrustify`](#uncrustify) [`clang-format`](#clang-format) **Supported Beautifiers**: [`Uncrustify`](#uncrustify) [`clang-format`](#clang-format)
@ -19049,6 +19074,30 @@ Indentation size/length (Supported by beautysh)
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `bash`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`beautysh`](#beautysh)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by beautysh)
**Example `.jsbeautifyrc` Configuration**
```json
{
"bash": {
"indent_with_tabs": false
}
}
```
### clang-format ### clang-format

View File

@ -24,13 +24,13 @@ module.exports = class BashBeautify extends Beautifier
options: { options: {
Bash: Bash:
indent_size: true indent_size: true
use_tabs: true indent_with_tabs: true
} }
beautify: (text, language, options) -> beautify: (text, language, options) ->
beautysh = @exe("beautysh") beautysh = @exe("beautysh")
file = @tempFile("input", text) file = @tempFile("input", text)
tabs = options.use_tabs tabs = options.indent_with_tabs
if tabs is true if tabs is true
beautysh.run([ '-t', '-f', file ]) beautysh.run([ '-t', '-f', file ])
.then(=> @readFile file) .then(=> @readFile file)

View File

@ -27,9 +27,9 @@ module.exports = {
default: null default: null
minimum: 0 minimum: 0
description: "Indentation size/length" description: "Indentation size/length"
use_tabs: indent_with_tabs:
type: 'boolean' type: 'boolean'
default: null default: null
description: "Use tabs for indentation" description: "Indentation uses tabs, overrides `Indent Size` and `Indent Char`"
} }

View File

@ -146,15 +146,15 @@
"namespace": "bash" "namespace": "bash"
} }
}, },
"use_tabs": { "indent_with_tabs": {
"type": "boolean", "type": "boolean",
"default": null, "default": null,
"description": "Use tabs instead of spaces for indentation, overrides `Indent Size` (Supported by beautysh)", "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by beautysh)",
"title": "Indent with tabs", "title": "Indent with tabs",
"beautifiers": [ "beautifiers": [
"beautysh" "beautysh"
], ],
"key": "use_tabs", "key": "indent_with_tabs",
"language": { "language": {
"name": "Bash", "name": "Bash",
"namespace": "bash" "namespace": "bash"