zeroexcuses
VSCode ElixirLS: Jump to definition for stdlib functions?
I am using VSCode + Elixir_LS
I have a piece of code that look slike:
{:ok, pid} = Agent.start_link(fn -> %{} end)
Agent.update(pid, fn map -> Map.put(map, :hello, :world) end)
Agent.get(pid, fn map -> Map.get(map, :hello) end )
if I put mouse cursor over Agent.updat, it shows me the spec, the documentation, and examples.
However, if I hit ‘gd’ (jump to def in VSCode/Vim), it can’t find the definition.
Question: In VSCode/Elixir_LS, is there a way to jump to the definition (actual source code) of Elixir stdlib funcs ?
If the answer is no, is there some other IDE combo that will let me do this ?
Most Liked
zeroexcuses
Thanks for the insightful response.
Step 3 of
requires not merely cloning the source, but building it.
I’m on a weird Linux setup where running the newly built binary might be problematic. Can you offer insights on why Elixir_LS requires a newly built elixir rather than just a directory containing the sources ?
Thanks!
axelson
Currently the issue is that if elixir was not compiled from source then ElixirLS doesn’t know where to get the source from, and specifically the source for the specific version of Elixir that you’re using. One idea is to download or configure elixir sources that could be used (although we’d have to make sure that the versions matched) in that case.
So a working solution would probably involve detecting:
iex(2)> Enum.module_info[:compile][:source]
'/home/build/elixir/lib/elixir/lib/enum.ex'
And then interactively prompting the user to download the elixir source code to a location on their file system (or possibly stashing it in the .elixir_ls directory) and then finishing jumping.
This ElixirSense issue has some further discussion:
https://github.com/elixir-lsp/elixir_sense/issues/44
So it is doable, but no one has done it yet.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








