From 1754df2a42bc635b5fa86c621c160d4a720215f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?manuel=20londo=C3=B1o?= Date: Sun, 20 Mar 2022 13:45:55 -0500 Subject: [PATCH] New behavior, now can customize the tabsizer --- README.md | 5 +++++ package.json | 7 ++++++- src/extension.ts | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0bbfea6..809cf5e 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,11 @@ If error color is disabled, indent colors will be rendered until the length of r "indentRainbow.colorOnWhiteSpaceOnly": true // false is the default ``` +By default the tabsize is 4 +```js + "indentRainbow.tabSize": 4 // 4 is the default +``` + Build with: ``` diff --git a/package.json b/package.json index abee212..8b45075 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,11 @@ "type": "boolean", "default": false, "description": "If error color is disabled, indent colors will be rendered until the length of rendered characters (white spaces, tabs, and other ones) is divisible by tabsize. Turn on this option to render white spaces and tabs only." + }, + "indentRainbow.tabSize": { + "type": "integer", + "default": 4, + "description": "By default the tabsize is 4." } } } @@ -126,4 +131,4 @@ "dependencies": { "@vscode/test-web": "^0.0.8" } -} +} \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index bcd0151..7406606 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -154,8 +154,8 @@ export function activate(context: vscode.ExtensionContext) { } var regEx = /^[\t ]+/gm; var text = activeEditor.document.getText(); - var tabSizeRaw = activeEditor.options.tabSize; - var tabSize = 4 + var tabSizeRaw = vscode.workspace.getConfiguration('indentRainbow')['tabSize'] || activeEditor.options.tabSize; + var tabSize = vscode.workspace.getConfiguration('indentRainbow')['tabSize'] || 4; if(tabSizeRaw !== 'auto') { tabSize=+tabSizeRaw }