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

Commit

Permalink
Fixes #642 Only add -d once to formatflags (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfOne authored and ramya-rao-a committed Nov 23, 2016
1 parent 7aa5605 commit 88dfe84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/goFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Formatter {
let formatCommandBinPath = getBinPath(this.formatCommand);
let formatFlags = vscode.workspace.getConfiguration('go')['formatFlags'] || [];
let canFormatToolUseDiff = vscode.workspace.getConfiguration('go')['useDiffForFormatting'] && isDiffToolAvailable();
if (canFormatToolUseDiff) {
if (canFormatToolUseDiff && formatFlags.indexOf('-d') === -1) {
formatFlags.push('-d');
}
// We ignore the -w flag that updates file on disk because that would break undo feature
Expand Down Expand Up @@ -80,4 +80,4 @@ export class GoDocumentFormattingEditProvider implements vscode.DocumentFormatti

// package main; import \"fmt\"; func main() {fmt.Print(\"Hello\")}
// package main; import \"fmt\"; import \"math\"; func main() {fmt.Print(\"Hello\")}
// package main; import \"fmt\"; import \"gopkg.in/Shopify/sarama.v1\"; func main() {fmt.Print(sarama.V0_10_0_0)}
// package main; import \"fmt\"; import \"gopkg.in/Shopify/sarama.v1\"; func main() {fmt.Print(sarama.V0_10_0_0)}

0 comments on commit 88dfe84

Please sign in to comment.