-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: allow enabling gofumpt extra rules #56403
Comments
Change https://go.dev/cl/444656 mentions this issue: |
We generally try to avoid new configuration when possible, but this may be important as we already integrate with gofumpt. Curious what @mvdan thinks of this request. |
That flag only turns on one additional rule, and it's a somewhat controversial one. Looking ahead, that kind of optional cleanup should rather be a "quickfix" step that the user opts into, rather than formatting that happens automatically. So I don't oppose adding the feature in the future (e.g. as a quickfix), but I do lean against adding "extra rules" as a formatting option. At least for now, given the only rule that it turns on. |
@mvdan that sounds like a great idea: if gofumpt were to provide an API for these types of additional formatting rules, we could definitely offer them as a quick-fix, via an analyzer that could be enabled/disabled independently of gofumpt formatting. @maxbrunet what do you think about this idea? |
Thank you for the replies, it sounds reasonable. I am not familiar enough with LSP and the requirements for a code action, but I have opened mvdan/gofumpt#251 to start the discussion about what it would look like there |
gopls version
master (8166dca) (latest release: v0.9.5)
go env
N/A
What did you do?
Currently
gofumpt
can be enabled: https://go.googlesource.com/tools/+/refs/heads/master/gopls/doc/settings.md#gofumpt-boolBut extra rules cannot be used: mvdan/gofumpt#extra-rules-behind--extra
What did you expect to see?
An option to enable extra rules (e.g.
formatting.gofumptExtraRules
bool
). Suggested implementation: golang/tools#410What did you see instead?
No option to enable extra rules.
Editor and settings
Logs
N/A
The text was updated successfully, but these errors were encountered: