I’m using the ElixirLS extension with VSCode and so far so good. However, my only nuisance is that I don’t get intellisense or jump to definition for functions that are imported from a use. For example, in a live view module (the one that has the mount/render/etc) that uses Phoenix.LiveView, I can’t jump to the definition of assign/2 or assign/3 . Hovering on it shows nothing either.
Additionally, my eex/leex templates have absolutely no intellisense. I am using the YAB for eex/leex extension to get the markup coloring. If I switch the language mode to Embedded Elixir (eex), then my code will have no coloring, no intellisense, basically it’s raw text editing.
So I’ve been working like this for a while, but I wonder if others have managed to get everything working nicely, in which case I’d have to figure out what’s wrong with my configuration. Thanks!
The only thing that kinda bothers me is that eex files do not format properly when you mix Embed Elixir with HTML blocks. Because of this, our code looks like crap if we use any kind of autoformatting.
To be honest, I haven’t noticed that I don’t get IntelliSense on eex files until you brought it up.
So I was able to finally fix the IntelliSense for imported functions and macros via use. Turns out the ElixirLS VSCode extension that ships on the marketplace comes with the language server that was built using Elixir 1.8 and Erlang 21, which are older versions than what my system has. Building the language server using my system’s Elixir and injecting that inside the extension did the trick. I wrote a quick post on my blog about all the steps https://dragoshmocrii.com/fix-vscode-elixirls-intellisense-for-code-imported-with-use/
Unfortunately, the eex/leex files still don’t have any IntelliSense.
@thiagomajesk for formatting you can try the “YAB for eex/leex” extension which works fine for me.
Heaps thanks, mate! I will try your solution shortly.
Something else that bugs me is that “go to symbol in workplace” [cmd + t] does not work for function names. It works for Module names only. At the same time, functions are indexed in the context of a single module, and I can navigate to them using [cmd + shift + o]. Do you have that working yourself?
For me, go to symbol works but is not consistent. For example I am unable to go to “assign” which is defined in Phoenix.LiveView. But for my application files, it works fine. I believe it might be an issue with code from dependencies.