From 5e86fdb03966f85ce65f47f35b1278f74e869fa7 Mon Sep 17 00:00:00 2001 From: Konnichy Date: Sun, 10 May 2026 02:23:32 +0000 Subject: [PATCH 1/2] Allow configuring a minimal line width below which the indicator is not displayed --- package.json | 6 ++++++ src/components/LWI.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5fc7537..de7f48f 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,12 @@ "maxLength": 50, "pattern": "//\\s[a-z]+" }, + "LWI.minimalLineWidth": { + "type": "number", + "default": 1, + "description": "The minimum width required for the indicator to be displayed.", + "minimum": 0 + }, "LWI.style.margin": { "type": "number", "default": 10, diff --git a/src/components/LWI.ts b/src/components/LWI.ts index 043afb0..a372938 100644 --- a/src/components/LWI.ts +++ b/src/components/LWI.ts @@ -116,6 +116,7 @@ export class LineWidthIndicator { appendCounterToLine(document: vscode.TextDocument): void { const excludedLanguages = vscode.workspace.getConfiguration("LWI").get("excludedLanguages") as string[]; const excluded = excludedLanguages.includes(document.languageId); + const minimalLineWidth = vscode.workspace.getConfiguration("LWI").get("minimalLineWidth") as number; // change editor if needed if (this.activeEditor !== vscode.window.activeTextEditor) { @@ -131,7 +132,7 @@ export class LineWidthIndicator { this.counterDecoration.dispose(); // only add new decoration and/or comment if the user typed something on that line previously - if (!excluded && editor && this.counterDecoration && text.length > 0) { + if (!excluded && editor && this.counterDecoration && text.length >= minimalLineWidth) { this.counterDecoration = vscode.window.createTextEditorDecorationType({ after: this.getDecorDetails(text) }); editor.setDecorations(this.counterDecoration, [new vscode.Range(position, position)]); } From 1171ee9cfdf9a2e607301a01c9745041cc7cb646 Mon Sep 17 00:00:00 2001 From: Konnichy Date: Sun, 10 May 2026 02:35:37 +0000 Subject: [PATCH 2/2] Describe the new feature in the documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2fd537d..6dd8123 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ None 😋 You can add the following settings: - `LWI.excludedLanguages`: An array of [languages identifiers](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers) for which you wish not to use the 'Line Width Indicator' extension. +- `LWI.minimalLineWidth`: The line width below which the indicator is not displayed (defaults to 1) - `LWI.breakpoints`: The counter will change to the respective color when its count is below that column's value. - `LWI.ignoreComment`: A comment that is added to preserve the current line formatting (no wrapping). Depending on your formatter, this will differ. - `LWI.style.margin`: The space between the text being typed and LWI counter.