It would be nice to be able to use jump-to-definition for the built-in modules. I installed elixir with asdf, and see that I have the module source at /~.asdf/installs/elixir/1.12.2-otp-24/lib/elixir/lib
.
Is there a way to configure elixir-lsp so it can find these? I’m using it with the ElixirLS vs code plugin.
`
Hi! This is something that does work once you’ve done some setup. Jump to definition is only available if you install elixir from source. I believe the steps to follow are roughly something like this:
- clone the elixir github repository
- Optionally check out a specific tag
- run
make compile
- In the root of your project run
asdf local elixir path:/path/to/elixir/
(where the path is the path to the github repo in step 1)
- In the root of your project run
rm -rf _build .elixir_ls
- Open/restart your editor
- Wait for the build to complete
4 Likes
Great, thanks. I shall try that shortly.
Meanwhile, out of interest: is the need to install from source fundamental to how elixir-ls works? Or, if you have sources available in some other way (eg. via the asdf elixir plugin), could elixir-ls (with some enhancement or other) be configured to use those for jump to definition? I can see advantages - eg. personally, I’d rather asdf take care of elixir for me. If it is feasible, perhaps I’ll add an issue to that effect. I’d consider a PR though that may be beyond me.
Terrific, that worked perfectly. I was expecting a monstrous compile, but it was quick. Perhaps installing elixir from source isn’t such a bad idea.
1 Like
I think it might be possible, but I’m not sure that we could make it very reliable. But I’m glad you got it working by using the Elixir source!
1 Like