Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jump to Elixir source definition #772

Open
rodrigues opened this issue Jun 9, 2024 · 3 comments
Open

Jump to Elixir source definition #772

rodrigues opened this issue Jun 9, 2024 · 3 comments

Comments

@rodrigues
Copy link

rodrigues commented Jun 9, 2024

Hey, thanks for all the amazing work with lexical.

Jumping to erlang core code (e.g. :timer.minutes(5)) is working great, getting to asdf erlang source.

I can't jump to elixir core code though (e.g. Supervisor.init(...)) (elixir 1.16.3, erlang 26.2.5, eglot).

I imagine it's not an issue, it's just not implemented yet, right?

It would be so great to have this.

Cheers!

@scohen
Copy link
Collaborator

scohen commented Jun 14, 2024

Correct. I’m actually not sure why erlang works but elixir doesn’t, but we don’t index the elixir source. I’ll investigate soon

@miguno
Copy link

miguno commented Jun 14, 2024

For elixir-ls (another LSP for elixir), the solution to this problem is to install elixir from source, i.e., to use a self-compiled elixir version.

elixir-ls uses a launcher script called elixir-ls/launch.sh, which you can customize. For fixing the "go to definition" issue, I had to add the following line to the launcher script to make sure that the self-compiled version of elixir is found before any other elixir versions (I normally manage elixir versions with mise; that's why I want to put the self-compiled version on the $PATH only for elixir-ls, but not in general).

export PATH="/path/to/your/self-compiled/elixir/bin:$PATH"

This allowed me to use Go To Definition etc. from neovim via elixir-ls.

Perhaps this solution for elixir-ls applies to this issue for lexical, too?

@rodrigues
Copy link
Author

hi @miguno, thanks for the suggestion.

I've just tried it locally, prepending to $PATH in start_lexical.sh the elixir compiled from source (1.16.3), it didn't work:

[jsonrpc] e[10:56:30.052] --> textDocument/definition[26] {"jsonrpc":"2.0","id":26,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///.../application.ex"},"position":{"line":14,"character":25}}}
[jsonrpc] e[10:56:30.086]   <-- textDocument/definition[26] {"id":26,"result":null,"jsonrpc":"2.0"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants