Use the `gofumpt` formatter in Zed as Golang default formatter

1 min read

128 words

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