Skip to content
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: support suggested fixes from 'gofumpt' #39805

Open
stamblerre opened this issue Jun 24, 2020 · 3 comments
Open

x/tools/gopls: support suggested fixes from 'gofumpt' #39805

stamblerre opened this issue Jun 24, 2020 · 3 comments
Assignees

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 24, 2020

Add an analyzer that produces suggested fixes using https://pkg.go.dev/mvdan.cc/gofumpt/format?tab=doc.
The tricky part is that the dependency will have to live in the gopls module, since it's not a golang.org/x/... dependency. That means the analyzer will have to be in that module, and we won't be able to have any internal/lsp tests for this behavior until #35880 is resolved.

/cc @joshbaum @mvdan

@gopherbot gopherbot added this to the Unreleased milestone Jun 24, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Jun 24, 2020
@muirdm
Copy link

@muirdm muirdm commented Jun 24, 2020

If people want to use gofumpt, wouldn't an option to use gofumpt for formatting be more useful than suggested fixes?

@stamblerre
Copy link
Contributor Author

@stamblerre stamblerre commented Jun 24, 2020

The suggested fixes would be categorized as "source.fixAll", which is a code action kind indicating that these are high-confidence fixes that can be applied on save. We already have similar analyzers and fixes for gofmt -s.

@muirdm
Copy link

@muirdm muirdm commented Jun 24, 2020

I see, I knew I was missing something!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.