diff --git a/docs/options.md b/docs/options.md index 3cb4453..9a69a78 100644 --- a/docs/options.md +++ b/docs/options.md @@ -12292,6 +12292,8 @@ Maximum amount of characters per line (0 = disable) (Supported by Pretty Diff) | `disabled` | :white_check_mark: | | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | +| `indent_size` | :white_check_mark: | +| `indent_with_tabs` | :white_check_mark: | **Description**: @@ -12352,6 +12354,56 @@ Automatically beautify TSX files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. +##### [Indent size](#indent-size) + +**Namespace**: `js` + +**Key**: `indent_size` + +**Default**: `4` + +**Type**: `integer` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation size/length (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_size": 4 + } +} +``` + +##### [Indent with tabs](#indent-with-tabs) + +**Namespace**: `js` + +**Key**: `indent_with_tabs` + +**Type**: `boolean` + +**Supported Beautifiers**: [`TypeScript Formatter`](#typescript-formatter) + +**Description**: + +Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "indent_with_tabs": false + } +} +``` + #### [Twig](#twig) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) diff --git a/src/beautifiers/typescript-formatter.coffee b/src/beautifiers/typescript-formatter.coffee index be786a8..4dee72d 100644 --- a/src/beautifiers/typescript-formatter.coffee +++ b/src/beautifiers/typescript-formatter.coffee @@ -9,7 +9,10 @@ module.exports = class TypeScriptFormatter extends Beautifier indent_with_tabs: true tab_width: true indent_size: true - TSX: true + TSX: + indent_with_tabs: true + tab_width: true + indent_size: true } beautify: (text, language, options) -> diff --git a/src/languages/tsx.coffee b/src/languages/tsx.coffee index 7625b88..d75ff1b 100644 --- a/src/languages/tsx.coffee +++ b/src/languages/tsx.coffee @@ -2,7 +2,7 @@ module.exports = { name: "TSX" namespace: "tsx" - fallback: ['ts'] + fallback: ['js'] ### Supported Grammars diff --git a/src/options.json b/src/options.json index 24cc1e9..196868b 100644 --- a/src/options.json +++ b/src/options.json @@ -7199,6 +7199,35 @@ "tsx" ], "properties": { + "indent_size": { + "type": "integer", + "default": null, + "minimum": 0, + "description": "Indentation size/length (Supported by TypeScript Formatter)", + "title": "Indent size", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_size", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, + "indent_with_tabs": { + "type": "boolean", + "default": null, + "description": "Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by TypeScript Formatter)", + "title": "Indent with tabs", + "beautifiers": [ + "TypeScript Formatter" + ], + "key": "indent_with_tabs", + "language": { + "name": "JavaScript", + "namespace": "js" + } + }, "disabled": { "title": "Disable Beautifying Language", "order": -3,