golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.78k stars 727 forks source link

Wrap long lines using golines #3397

Open sjackman opened 1 month ago

sjackman commented 1 month ago

Is your feature request related to a problem? Please describe. I'd like to wrap long lines.

Describe the solution you'd like I'd like to wrap long lines using golines when I save a file.

Describe alternatives you've considered

Additional context On 2021-04-09 in https://github.com/golang/vscode-go/issues/847#issuecomment-816992225, @stamblerre wrote…

You can now setting "go.formatTool": "golines" and it will work together with gopls. Closing.

but when I set this configuration option go.formatTool": "golines, I get the error message: Value is not accepted. Valid values: "default", "gofmt", "goimports", "goformat", "gofumpt", "custom".

hyangah commented 1 month ago
    "go.formatTool": "custom",
    "go.alternateTools": {
        "customFormatter": "golines" <--- or exact path like "~/go/bin/golines". 
    }
}
hyangah commented 1 month ago

Add this to https://github.com/golang/vscode-go/wiki/features#custom-formatter and https://github.com/golang/vscode-go/wiki/faq

sjackman commented 1 month ago

Nice! Thank you for the quick and helpful response, @hyangah! 😁