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": {},
...
}
Just ran across this, might be helpful for someone:
Zed has builtin tailwind support, which can be enabled as well.
Adjust to config as follows:
- "language_servers": ["elixir-ls"],
+ "language_servers": ["elixir-ls", "tailwindcss-language-server"],
I have just installed Zed with the elixir official extension. It should work by default right in the .heex files ?
Code completion works for me in .ex file but doesn’t in .heex
If I create a regular .html file in zed, then the HTML autocomplete works as expected.
To be honest I’m not sure what you expect here. There is no Elixir code in the screenshot where the code completion could happen. Could you elaborate?
Providing more details:
In heex files I dont get autocomplete of HTML tags. For ex. if I type ```<div>``` then the div autoclosing tags should be autogenerated like in .html files in zed.
In .html files its working as expected.
Zed claims HEEX support in its elixir support is on by default. Elixir | Elixir
You need to differenciate between the pieces an extenension enables. They can bring in syntax highlighting through tree-sitter as well as additional language servers. The elixir extension does include heex tree sitter grammer. Autocomplete comes from LSPs. For html files zed runs the built in html lsp. That one wouldn’t understand heex though. For the elixir LSPs available the support for heex is wip at best and imo their maintainers focus is better used improving their support of elixir code before their support of heex.
In the end heex is not html. This is not as simple as “just do what you do for html for this other file”.
This article describes how to make Emmet server work with HEEx files: Setting up Zed for Elixir development 💧 - DEV Community and provide HTML completion. I haven’t tried it myself, but looks reasonable.
Thanks for your explanation. So if I understand you correctly for both major lsps - expert and elixir-ls Ill have to wait for heex support. or I keep using VS code where this works correctly somehow. I was just experimenting with zed.
Yes I saw this and I thought its outdated. Zed already has a “vscode-html-language-server“ that runs to provide autocompletion to .html files (just like emmet) So I think explicitly installing emmet loses the point. Zed is not able to use its emmet alternative to comprehend heex files even if it claims that heex templates are supported by zed Elixir | Elixir. So, If this is a WIP in zed, then Ill continue with VS code then. Can I ask you which editor you use ?
Ok, then probably you need to do what this article mentions for Emmet - for HTML server. The issue is that the HTML server is not started for .heex.html files, so actions specific for HTML are not run. The key would be to force HTML server to start on HEEX files.
Well, they are. Syntax highlighting works. Elixir language server starts. It does not claim to provide same capabilities as with plain HTML files. Perhaps this is a discussion better suited for some Zed forum or issue tracker.
Mainly Emacs.



























