-
Notifications
You must be signed in to change notification settings - Fork 651
Add "goformat" to the allowed values for go.formatTool #1656
Comments
I believe you should be able to use
The extension should just pick it up and run it. |
It runs it, but I get a perpetual entry in my Problems tab, so that it always has the blue bubble, which makes harder to notice when I have an actual problem. |
That makes sense. PRs are welcome to this option to Just add an entry at https://github.com/Microsoft/vscode-go/blob/0.6.79/package.json#L507. That should fix the warning in the settings. |
Thanks for the code pointers. I managed to implement it. If go.formatFlags == [] and go.formatTool == "goformat", then use a default set of flags that corresponds to
I would assume that this automatically fixes issue #1011 if the user is willing/able to set go.formatTool="goformat". What do you think? Should I add this at |
Let's not have hidden defaults that way. Sometimes, a user might indeed want to pass no flags. Also, it wouldn't be right for the Go extension to have formatting opinions :). That's purely a personal decision. |
But that's exactly the point. We should honor the user's setting of editor.insertSpaces. VSCode contains this default: "[go]": { If the user deliberately changes insertSpaces to true, he clearly does not want tabs. If he also deliberately changes go.formatTool to goformat, he clearly does not want standard gofmt formatting. |
I am sorry, I misunderstood. Yes, translating the user's settings for |
If this formatTool is set and the user has not provided custom go.formatFlags, indentation settings from editor.insertSpaces/editor.tabSize are used.
* Add support for go.formatTool: "goformat" #1656 If this formatTool is set and the user has not provided custom go.formatFlags, indentation settings from editor.insertSpaces/editor.tabSize are used. * changed goformat URL to canonical source * Fix linting error
This feature is now out in the latest update to the Go extension (0.6.80) |
Please add "goformat" to the allowed values for go.formatTool.
goformat is an extended version of gofmt with more options:
https://github.com/mbenkmann/goformat
This tool would also allow you to revisit issue #1011 but all I care about is having VSCode accept "goformat" as a value for go.formatTool. Usage is exactly as gofmt, so the backend can call it exactly the same way.
The text was updated successfully, but these errors were encountered: