Elixir debugging Phoenix project with VSCode

Hi there,

I’m new to Elixir/Phoenix and loving it.

I am trying to get debugging working on my Phoenix project in vscode and I’m running into issues that I don’t quite understand. I would appreciate a nudge in the right direction.

Product Version
Elixir 1.16.0
Erlang Erlang/OTP 26 [erts-14.2.1]
Phoenix 1.7.10

My .vscode/launch.json looks like so:

    "version": "0.2.0",
    "configurations": [
            "type": "mix_task",
            "name": "mix phx.server",
            "request": "launch",
            "task": "phx.server",
            "projectDir": "${workspaceRoot}",
            # without the following, running from vscode immediately terminates
            "exitAfterTaskReturns": false 

And with that, I’m able to run my Phoenix project with “Run > Start Debugging” and it does start up and runs just fine… until, that is, I make a change to my application and live reload kicks in. Then I get an error like the following:

== Compilation error in file lib/demo1_web/live/counter_live.ex ==
** (UndefinedFunctionError) function Demo1Web.__using__/1 is undefined or private. However, there is a macro with the same name and arity. Be sure to require Demo1Web if you intend to invoke this macro
    (demo1 0.1.0) Demo1Web.__using__(:live_view)
    lib/demo1_web/live/counter_live.ex:2: (module)
    (elixir 1.16.0) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8

If I run mix phx.server or iex -S mix phx.server it all works fine and live reloading works just fine.

Thank you so much!

Disregard. Apparently this is a known issue with ElixirLS and Phoenix live reloading.

Apologies for not catching this prior to posting.

I recently switched to elixir-tools and have found it more useful with fewer issues (albeit I don’t really it put it through any particularity hard paces, i.e. I haven’t tried running code from the editor itself).