Zed and PowerShell on macOS

#zed, #powershell edit this page

VSCode has been my daily driver pretty much since it launched. It’s got a great community and amazing extensions, but sometimes it’s slow, and it started draining my battery a lot. I began looking for alternatives, and it wasn’t long before I came across Zed. Zed is a relatively new, high-performance code editor. It’s so fast that typing literally feels easier :)

Most of my (coding) work revolves around PowerShell, so the lack of support was a problem for me. I followed Zed Industries’ GitHub and noticed that some good soul closed this issue a few days ago. Did they just add support for PowerShell? The answer is yes, as it turns out!

The Extension

First of all, we need to install the PowerShell extension. Like in VSCode, press ⌘ ⇧ X (Command + Shift + X) to open the extensions tab. Type “PowerShell” and press install.

PowerShell Editor Services

Then we need a language server to provide common editor features for the PowerShell language. Think tab completion, IntelliSense, best practices, and so on. There’s a PowerShell module that provides just that: PowerShell/PowerShellEditorServices

Download the latest release and unzip it to a folder on your local device; in my case, it is: /Users/tom/code/PowerShellEditorServices.

Zed Configuration

Lastly, we need to tell Zed where to find the language server (LSP). Again, like in VSCode, press ⌘ , (Command + ,) to open settings and configure the LSP. You can also set pwsh as the default shell and much more.

"terminal": {
  "shell": {
    "program": "pwsh"
  }
},
"lsp": {
  "powershell-es": {
    "binary": {
      "path": "/Users/tom/code/PowerShellEditorServices"
    }
  }
}

Have fun!