I really like the Zed editor but recently code completion just stopped working. I still get syntax highlighting just no code completion. Is anybody having the same issue or know what the problem might be.
The first step should always be looking at the lsp logs, which you can open via the command palette in zed.
Not exactly sure what I’m looking for in Logs but this is what my logs look like. I wonder if this line is the problem
server "elixir-ls": failed to spawn command. path: "/Users/jamesavery/Library/Application
2024-07-25T18:12:24.636696Z [INFO] starting language server "elixir-ls", path: "/Users/jamesavery/Dev/otp_apps/delta", id: 5
2024-07-25T18:12:24.753174Z [INFO] starting language server. binary path: "/Users/jamesavery/Library/Application Support/Zed/extensions/work/elixir/elixir-ls-v0.22.1/language_server.sh", working directory: "/Users/jamesavery/Dev/otp_apps/delta", args: []
2024-07-25T18:12:24.753329Z [ERROR] failed to start language server "elixir-ls": failed to spawn command. path: "/Users/jamesavery/Library/Application Support/Zed/extensions/work/elixir/elixir-ls-v0.22.1/language_server.sh", working directory: "/Users/jamesavery/Dev/otp_apps/delta", args: []
2024-07-25T18:12:24.753386Z [ERROR] server stderr: Some("")
2024-07-25T18:12:24.753434Z [ERROR] Hit 4 reinstallation attempts for "elixir-ls"
2024-07-25T19:40:44.760385Z [INFO] Initializing default prettier with plugins {}
2024-07-25T19:40:44.762037Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.762262Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.762322Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.819125Z [INFO] Initializing default prettier with plugins {}
2024-07-25T19:40:44.819226Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.820365Z [INFO] Initializing default prettier with plugins {}
2024-07-25T19:40:44.820426Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.820646Z [INFO] Initializing default prettier with plugins {}
2024-07-25T19:40:44.820701Z [INFO] starting language servers for Elixir: elixir-ls
2024-07-25T19:40:44.820832Z [INFO] Initializing default prettier with plugins {}
2024-07-25T19:40:44.820881Z [INFO] starting language servers for Elixir: elixir-ls
I was getting this error too, but I did not know when it started on my mac (maybe a zed update?).
I tried to uninstall zed, compared releases of elixir-ls, etc, but I finally made it work by making the elixir-ls scripts that zed downloads to be executable. Comparing the version between VSCode and zed, I noticed that the elixir-ls release files were not marked as executable:
By running chmod +x ...
things started to work again.
Nice, that solved it for me.
Also, I added the following overall config for Elixir, maybe it is useful for someone
Selects the language server and configures format on save.
Most of it was taken from the zed manual
{
"languages": {
"Elixir": {
"show_inline_completions": true,
"language_servers": ["elixir-ls"],
"format_on_save": {
"external": {
"command": "mix",
"arguments": ["format", "--stdin-filename", "{buffer_path}", "-"]
}
}
}
}
}
this worked on my problem
I ran into this as well. Fwiw, I had to add this to my settings.json
"lsp": {
"elixir-ls": {},
...
}