Proposal: Create a function on the Xref task to get a list of callers

29 views
Skip to first unread message

Matt Baker

unread,
Feb 25, 2018, 3:15:06 PM2/25/18
to elixir-lang-core
Hello Elixir friends. We're building "Find References" support in ElixirLS (moving it soon to ElixirSense) so that we can find references in our editor. Right now we run the xref mix task and capture stdout to get the list of references.

We'd prefer to be able to get the list directly. I'm curious what folks think about exposing something like callers/2 as a public function on the xref task (or elsewhere) that would hand back the list.
https://github.com/elixir-lang/elixir/blob/master/lib/mix/lib/mix/tasks/xref.ex#L268

Naively, it could be as simple as a function that includes everything except print_calls() and the :ok return value we see in callers/2.

What we have seems to work, so it's not a blocker, but this would definitely be helpful to anyone building IDE features.

If this seems like a reasonable add I would be happy to submit a PR, I imagine it will be a small change if folks approve of the idea.

José Valim

unread,
Feb 25, 2018, 3:23:01 PM2/25/18
to elixir-l...@googlegroups.com
Can you build this from the information returned by calls/2?
--


José Valim
Founder and 
Director of R&D

Matt Baker

unread,
Feb 25, 2018, 3:27:09 PM2/25/18
to elixir-l...@googlegroups.com
Ah, perhaps! I will take a look and report back.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/DwbVKBH0goE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B%3Dra9eSf599AB2u%3DGPnBf-1CrVX2986nzq05a%2B3D54kQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Matt Baker

unread,
Feb 25, 2018, 4:46:21 PM2/25/18
to elixir-l...@googlegroups.com
That did the trick, thanks for the guidance José :)

On Sun, Feb 25, 2018 at 12:26 PM, Matt Baker <mbake...@gmail.com> wrote:
Ah, perhaps! I will take a look and report back.
On Sun, Feb 25, 2018 at 12:23 PM José Valim <jose....@gmail.com> wrote:
Can you build this from the information returned by calls/2?
--


José Valim
Founder and 
Director of R&D

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/DwbVKBH0goE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages