Skip to content

Commit

Permalink
See #1959, #1951. Add indent_with_tabs to Bash language (replaces use…
Browse files Browse the repository at this point in the history
…_tabs)
  • Loading branch information
Glavin001 committed Mar 2, 2018
1 parent a9d3a0c commit 111e375
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
49 changes: 49 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
| `indent_size` | :white_check_mark: |
| `indent_with_tabs` | :white_check_mark: |

**Description**:

Expand Down Expand Up @@ -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)

**Supported Beautifiers**: [`Uncrustify`](#uncrustify) [`clang-format`](#clang-format)
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/beautifiers/beautysh.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ module.exports = class BashBeautify extends Beautifier
options: {
Bash:
indent_size: true
use_tabs: true
indent_with_tabs: true
}

beautify: (text, language, options) ->
beautysh = @exe("beautysh")
file = @tempFile("input", text)
tabs = options.use_tabs
tabs = options.indent_with_tabs
if tabs is true
beautysh.run([ '-t', '-f', file ])
.then(=> @readFile file)
Expand Down
4 changes: 2 additions & 2 deletions src/languages/bash.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ module.exports = {
default: null
minimum: 0
description: "Indentation size/length"
use_tabs:
indent_with_tabs:
type: 'boolean'
default: null
description: "Use tabs for indentation"
description: "Indentation uses tabs, overrides `Indent Size` and `Indent Char`"

}
6 changes: 3 additions & 3 deletions src/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@
"namespace": "bash"
}
},
"use_tabs": {
"indent_with_tabs": {
"type": "boolean",
"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",
"beautifiers": [
"beautysh"
],
"key": "use_tabs",
"key": "indent_with_tabs",
"language": {
"name": "Bash",
"namespace": "bash"
Expand Down

0 comments on commit 111e375

Please sign in to comment.