From e84d8657cf0cb3a017b403fd7f1c93f42420f3b5 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 19 Jul 2022 13:58:25 -0300 Subject: [PATCH 1/4] FEATURE: Add --print-width support using extension setting --- package.json | 5 +++++ src/extension.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/package.json b/package.json index 60a5b04..79cbee6 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,11 @@ "type": "object", "title": "Syntax Tree", "properties": { + "syntaxTree.maximumLineWidth": { + "default": 80, + "markdownDescription": "The maximum line width to use when formatting.", + "type": "number" + }, "syntaxTree.singleQuotes": { "default": false, "markdownDescription": "Uses single-quoted strings when possible.", diff --git a/src/extension.ts b/src/extension.ts index 1563ac5..e5dee8d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -87,6 +87,9 @@ export async function activate(context: ExtensionContext) { args.push(`--plugins=${Array.from(plugins).join(",")}`); } + // Configure print width. + args.push(`--print-width=${config.get("maximumLineWidth")}`) + // There's a bit of complexity here. Basically, if there's an open folder, // then we're going to check if the syntax_tree gem is inside the bundle. If // it is, then we'll run bundle exec stree. This is good, because it'll From 64844ce4fe4ddfae9c16b3ba0e919b8cf2ce724d Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 19 Jul 2022 14:11:27 -0300 Subject: [PATCH 2/4] Update package.json Co-authored-by: Kevin Newton --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 79cbee6..461a61d 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "type": "object", "title": "Syntax Tree", "properties": { - "syntaxTree.maximumLineWidth": { + "syntaxTree.printWidth": { "default": 80, "markdownDescription": "The maximum line width to use when formatting.", "type": "number" From 93a16c887e92fbff75193a4b67fcc3c12c06868b Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 19 Jul 2022 14:11:36 -0300 Subject: [PATCH 3/4] Update package.json Co-authored-by: Kevin Newton --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 461a61d..16765cd 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "properties": { "syntaxTree.printWidth": { "default": 80, - "markdownDescription": "The maximum line width to use when formatting.", + "markdownDescription": "The width to be used when formatting code.", "type": "number" }, "syntaxTree.singleQuotes": { From 6cd58fafc3c73dcbd567305f3b34eb765cc978a2 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 19 Jul 2022 14:11:40 -0300 Subject: [PATCH 4/4] Update src/extension.ts Co-authored-by: Kevin Newton --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index e5dee8d..4fd7746 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -88,7 +88,7 @@ export async function activate(context: ExtensionContext) { } // Configure print width. - args.push(`--print-width=${config.get("maximumLineWidth")}`) + args.push(`--print-width=${config.get("printWidth")}`) // There's a bit of complexity here. Basically, if there's an open folder, // then we're going to check if the syntax_tree gem is inside the bundle. If