entbit. Menu

Cologne, DE

Published
Length
1 min · 128 w
Filed under
GolangZed

Use the gofumpt formatter in Zed as Golang default formatter.

Set up your Zed editor to use the gofumpt formatter as the Golang default. Learn how to configure Zed to use the gopls language server and enable gofumpt formatting in your projects.

I've been working more with Golang for a while now, so I set up my Zed editor to use gofumpt instead of gofmt as my default formatter.

The setup took a while at first because I don't have much customization in my editor yet. If you look at the solution, you can see how well Zed interacts with the LSPs (in our case gopls) of the respective languages.

Without beating around the bush, here are the settings that can be used for either the global or the project specific (.zed/settings.json) settings.

{
  "lsp": {
    "gopls": {
      "gofumpt": true,
      "initialization_options": {
        "gofumpt": true
      }
    }
  }
}

For more information, see the gopls language server documentation on [GitHub] (https://github.com/golang/tools/blob/master/gopls/doc/settings.md).

Thanks for reading,

Niklas

Newsletter · entbit.

One email per post.

Deno, AWS, GitHub Actions and whatever I'm debugging. No spam.

Prefer not to hand over your real address? Use an alias from DuckDuckGo, Firefox Relay or Hide My Email.