Closed nbernardes closed 1 year ago
asdf
is maybe the most common way of installing and managing elixir versions in the elixir community, and I'm experiencing the same error. This bug will probably hit most elixir users.
Before I configured things in Zed I looked at the homebrew formula to make sure I was matching what it was doing. It makes sure the language server is compiled and that a symlink named elixir-ls
points to the language server shell script, so I made sure I did the same and confirmed elixir-ls is in my path.
Not sure where elixir-ls.zip came into play, are more recent versions of the beta trying to download the elixir language server automatically without me having to install it globally? That would be nice, that's what vscode does and it would be a welcome improvement.
I'm excited that elixir-ls support is in progress though! It's the only thing standing between me and using Zed as my main editor :) Thanks for ya'lls efforts!
For the Zed folks: https://github.com/zed-industries/zed/issues/6178 looks like a duplicate
As a hacky short-term fix I was able to get this working I think. I ended up creating a symlink in ~/matt/Library/Application Support/Zed/languages/elixir-ls
named elixir-ls
that points to language_server.sh
from the elixir-ls release directory.
So to summarize:
release
directory and the language_server.sh
scriptelixir-ls
in /Users/matt/Library/Application Support/Zed/languages/elixir-ls
pointing to language_server.sh
If anyone's installed elixir-ls a different way the same solution should work (I think), you just need to find where your elixir-ls release is so you can symlink to the language_server.sh file it contains.
❯ pwd
/Users/matt/Library/Application Support/Zed/languages/elixir-ls
❯ ln -s /Users/matt/code/elixir-ls/release/language_server.sh elixir-ls
I only tested jump to definition, find references, and that compile errors showed up in the file. I haven't actually done any significant coding yet so I can't say if surprises will crop up or not. Also confirmed I can view the elixir language server log output via the "open language server logs" command.
Hopefully this helps people get unblocked until the bug can be fixed! Excited to try out Zed full-time :)
asdf
is maybe the most common way of installing and managing elixir versions in the elixir community, and I'm experiencing the same error. This bug will probably hit most elixir users.Before I configured things in Zed I looked at the homebrew formula to make sure I was matching what it was doing. It makes sure the language server is compiled and that a symlink named
elixir-ls
points to the language server shell script, so I made sure I did the same and confirmed elixir-ls is in my path.Not sure where elixir-ls.zip came into play, are more recent versions of the beta trying to download the elixir language server automatically without me having to install it globally? That would be nice, that's what vscode does and it would be a welcome improvement.
I'm excited that elixir-ls support is in progress though! It's the only thing standing between me and using Zed as my main editor :) Thanks for ya'lls efforts!
Feeling the same as you. I wanted to replace once in for all VSCode by Zed, but not having elixir-ls
working correctly without to much of hacking around is a bummer.
Still, it's great to see that Elixir is talked on Zed docs, and hopefully it will be the best solution for Elixir development. I sometimes feel that VSCode is not 100% there.
As a hacky short-term fix I was able to get this working I think. I ended up creating a symlink in
~/matt/Library/Application Support/Zed/languages/elixir-ls
namedelixir-ls
that points tolanguage_server.sh
from the elixir-ls release directory.So to summarize:
- I cloned the elixir-ls project
- I compiled it and generated a release, which creates the
release
directory and thelanguage_server.sh
script- I created a symlink named
elixir-ls
in/Users/matt/Library/Application Support/Zed/languages/elixir-ls
pointing tolanguage_server.sh
If anyone's installed elixir-ls a different way the same solution should work (I think), you just need to find where your elixir-ls release is so you can symlink to the language_server.sh file it contains.
❯ pwd /Users/matt/Library/Application Support/Zed/languages/elixir-ls ❯ ln -s /Users/matt/code/elixir-ls/release/language_server.sh elixir-ls
I only tested jump to definition, find references, and that compile errors showed up in the file. I haven't actually done any significant coding yet so I can't say if surprises will crop up or not. Also confirmed I can view the elixir language server log output via the "open language server logs" command.
Hopefully this helps people get unblocked until the bug can be fixed! Excited to try out Zed full-time :)
Unfortunately, this solution didn't worked for me. I've followed the steps you provided, but it didn't worked. @mattbaker I saw that you are on the Elixir Slack, if you can give me some sync assistance there I would be very much appreciated 🙂
I assume that the issue is caused by the recent change in the Release assets of ElixirLS on GitHub.
https://github.com/elixir-lsp/elixir-ls/releases/tag/v0.15.0
v0.15.0 is missing the asset elixir-ls.zip
and now has the version number in the file name: elixir-ls-v0.15.0.zip
.
In addition they changed the implementation to use Mix.install
to make sure that the language server is compiled with the correct Erlang/Elixir combination to provide completions when using the use
macro.
IMO zed should consider to start the launch.sh
file instead of the language_server.sh
file when starting up the language server. This ensures that the Erlang/Elixir version of asdf-vm is picked up when running the language server.
Thank you gents @ Zed for taking a look at this. I'm also waiting for this to land before giving Zed two weeks of solid attention. I love your mission and I am keen to use Zed instead of VSCode.
For what it’s worth elixir-ls has been working in Zed perfectly with the workaround so far. I know @nbernardes wasn’t able to get it going (we’re not sure why) but I’d encourage you make an attempt if it means you get to start testing Zed a little sooner. Totally understand wanting to wait for a fix though, but I was impatient :)
❤️ thanks @mattbaker, I just tried it and it works for me too, I've been without elixir-ls for 2 days and its been driving me crazy
Confirming that the workaround provided by @mattbaker is working for me. Thanks dude 🙇
I've got the same issue with the elixir-ls not working, unfortunately the fix isn't working for me either 😢
Just confirming that the workaround provided by @mattbaker is working for me. thank you 🙏🏻
I did an extra couple of things before the ln -s
step
/Library/Application Support/Zed/languages
"lsp": { "Elixir": {} }
/Library/Application Support/Zed/languages
)ln -s ../elixir-ls/release/language_server.sh elixir-ls
in Zed/languagesThe fix worked for me after removing Zed from my system and installing the latest beta from the website. Adding
"lsp": {
"Elixir": {}
}
to settings.json
also seems to make a difference here, thanks @jvelez1 and @mattbaker 🥳
I finally managed to get it working - had to completely remove Zed and the Zed directory in ../Library/Application Support/
, then re-install the latest beta.
Thanks @zimt28, @jvelez1 and @mattbaker 😺
IMO zed should consider to start the launch.sh file instead of the language_server.sh file when starting up the language server. This ensures that the Erlang/Elixir version of asdf-vm is picked up when running the language server.
@benvp language_server.sh
runs launch.sh
:
#!/bin/sh
# Launches the language server. This script must be in the same directory as mix install launch script.
readlink_f () {
cd "$(dirname "$1")" > /dev/null || exit 1
filename="$(basename "$1")"
if [ -h "$filename" ]; then
readlink_f "$(readlink "$filename")"
else
echo "$(pwd -P)/$filename"
fi
}
if [ -z "${ELS_INSTALL_PREFIX}" ]; then
dir="$(dirname "$(readlink_f "$0")")"
>&2 echo "Running ${dir}/launch.sh"
else
dir=${ELS_INSTALL_PREFIX}
>&2 echo "ELS_INSTALL_PREFIX is set, running ${ELS_INSTALL_PREFIX}/launch.sh"
fi
export ELS_MODE=language_server
exec "${dir}/launch.sh"
And launch.sh
tries to figure out which Erlang/Elixir version to use (asdf-vm or something else)
Oh, I misread that. Sorry!
Side note:
The reason why the workaround might not work for some of us is that currently elixir-ls is broken with OTP 26 - the server does not start at all.
It should be fixed when OTP 26.0.2 is released (If I understood the discussion correctly)
After updating OTP 26.0.2 and delete the zed from my system I still can not use Elixir-ls formatter and autocompletion
I use asdf erlang 26.0.2
and 1.15.0-otp-26
@shahryarjb That's because a new version of elixir-ls (0.15.1) that fixes OTP 26 coop has not been published yet.
Zed still downloads version 0.15.0 as of now.
Want to confirm without doing any "hacks" or anything like that, my ElixirLS is now working fine and I can cmd+click into modules. Thanks!
Want to confirm without doing any "hacks" or anything like that, my ElixirLS is now working fine and I can cmd+click into modules. Thanks!
Confirmed for me as well with Zed 0.92.4
Elixir-ls 15.1 has been released, Zed has got it, and now language server works with Elixir 1.15.0 OTP 26.0.2. 🥳
It seems like bugy, because if something crashed like there is no macro or sth you should delete the build and deps to compile again!!
I'm not sure if I'm having the same issue, but elixir-ls
won't start with message
Could not run the elixir language server, `elixir-ls`, because `elixir` was not found.`
It's installed through asdf
so I'm under the impression that Zed does not have the right environment when it tries to download and run the language server, asdf
installed deps are probably not in the env. I tried to configure the terminal.shell
setting to use my zsh
shell with the right .zshrc
file but that doesn't change anything (The terminal do open with the right shell though)
@nicklayb the terminal.shell
here is unrelated. What Zed tries to do on startup is to load the environment in a login shell and set that on itself. Here:
When we then lookup elixir
, we just use Rust's stdlib to lookup in $PATH
, which by now should be the one you get when you run zsh -i -l -c 'elixir'
.
Where and how is your asdf
configured?
Can you create a ticket and tag me on it?
(I'm also happy to look at this together, if you want feel free to book some time here: https://calendly.com/thorsten-ball-zed/30min)
Check for existing issues
Describe the bug / provide steps to reproduce it
When opening any project on Zed, I always get this error
elixir-ls
works in VSCode, and I'm usingelixir
anderlang
viaasdf
Environment
Zed: v0.90.2 (stable) OS: macOS 13.4.0 Memory: 32 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.If you only need the most recent lines, you can run the
zed: open log
command palette action to see the last 1000.