zeroexcuses

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

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

axelson

Scenic Core Team

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:

So it is doable, but no one has done it yet.

Where Next?

Popular in Questions Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement