From 94609baadc1f53d52cb68cf5b6c6ae24cfb73081 Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 17 Oct 2016 14:14:44 -0700 Subject: [PATCH] Add setting to control use of -d flag by the formatting tool --- package.json | 5 +++++ src/goFormat.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 517ad8683..13308e01c 100644 --- a/package.json +++ b/package.json @@ -296,6 +296,11 @@ "default": [], "description": "Flags to pass to format tool (e.g. ['-s'])" }, + "go.useDiffForFormatting": { + "type": "boolean", + "default": true, + "description": "Run the formatting tools with the -d flag" + }, "go.useCodeSnippetsOnFunctionSuggest": { "type": "boolean", "default": false, diff --git a/src/goFormat.ts b/src/goFormat.ts index cc153899f..6db996ee8 100644 --- a/src/goFormat.ts +++ b/src/goFormat.ts @@ -28,7 +28,7 @@ export class Formatter { let formatCommandBinPath = getBinPath(this.formatCommand); let formatFlags = vscode.workspace.getConfiguration('go')['formatFlags'] || []; - let canFormatToolUseDiff = isDiffToolAvailable(); + let canFormatToolUseDiff = vscode.workspace.getConfiguration('go')['useDiffForFormatting'] && isDiffToolAvailable(); if (canFormatToolUseDiff) { formatFlags.push('-d'); }