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:
https://github.com/elixir-lsp/elixir_sense/issues/44

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

Where Next?

Popular in Questions Top

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
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
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
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics 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
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
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
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement