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

Commit 88dfe84

Browse files
OneOfOneramya-rao-a
authored andcommitted
Fixes #642 Only add -d once to formatflags (#644)
1 parent 7aa5605 commit 88dfe84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/goFormat.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class Formatter {
2929
let formatCommandBinPath = getBinPath(this.formatCommand);
3030
let formatFlags = vscode.workspace.getConfiguration('go')['formatFlags'] || [];
3131
let canFormatToolUseDiff = vscode.workspace.getConfiguration('go')['useDiffForFormatting'] && isDiffToolAvailable();
32-
if (canFormatToolUseDiff) {
32+
if (canFormatToolUseDiff && formatFlags.indexOf('-d') === -1) {
3333
formatFlags.push('-d');
3434
}
3535
// We ignore the -w flag that updates file on disk because that would break undo feature
@@ -80,4 +80,4 @@ export class GoDocumentFormattingEditProvider implements vscode.DocumentFormatti
8080

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

0 commit comments

Comments
 (0)