Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Add setting to control use of -d flag by the formatting tool #537

Merged
merged 1 commit into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/goFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down