How do you deal with defdelegate navigation in Visual Studio Code?

I would like to use defdelegate but it seems to make code navigation worse when using ElixirLS (I use forked one https://github.com/elixir-lsp/elixir-ls because development of ElixirLS seem to have stopped). If I call function directly I can just hover call with mouse and hold CTRL and I’ll see functions code. I can also jump to function with F12 etc. When I use defdelegate these stop working.

I first thought I would create centralized context using defdelegate, but because it makes code navigation worse I’m leaning against it. How do you navigate code that uses defdelegate in VSCode?

2 Likes

With ElixirLS you should be able to navigate from the function call to the defdelegate definition, and then from the defdelgate definition you can navigate to the module that is delegated to, but from there you’ll have to manually navigate to the function that was delegated to.

As an improvement it would be nice to navigate from the defdelegate to the function that is delegated to, so I opened an issue to track that:

PR’s welcome of course :smiley:

2 Likes

Another problem is that you can’t peek code at call site if you use defdelegate and that’s the biggest issue for me.