From 111e3756b32f4828b8e5532450df44005581823d Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 1 Mar 2018 21:26:08 -0400 Subject: [PATCH] See #1959, #1951. Add indent_with_tabs to Bash language (replaces use_tabs) --- docs/options.md | 49 +++++++++++++++++++++++++++++++++ src/beautifiers/beautysh.coffee | 4 +-- src/languages/bash.coffee | 4 +-- src/options.json | 6 ++-- 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/docs/options.md b/docs/options.md index 01263b7..0e6812d 100644 --- a/docs/options.md +++ b/docs/options.md @@ -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**: @@ -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) @@ -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 diff --git a/src/beautifiers/beautysh.coffee b/src/beautifiers/beautysh.coffee index 9257d94..3f48112 100644 --- a/src/beautifiers/beautysh.coffee +++ b/src/beautifiers/beautysh.coffee @@ -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) diff --git a/src/languages/bash.coffee b/src/languages/bash.coffee index c36e60c..731aa47 100644 --- a/src/languages/bash.coffee +++ b/src/languages/bash.coffee @@ -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`" } diff --git a/src/options.json b/src/options.json index 01b1935..4de7b50 100644 --- a/src/options.json +++ b/src/options.json @@ -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"