elixir-ls icon indicating copy to clipboard operation
elixir-ls copied to clipboard

Cannot place debugger breakpoint on an assignment

Open axelson opened this issue 5 years ago • 1 comments

Debugging currently does not work, most likely due to an ElixirSense change. This gist has some details:

https://gist.github.com/Ajwah/4dee98bbb1e0c9257bb52dcd6c6802e2#file-gistfile1-txt

The error Could not determine module at line is received when debugging.

It's seems likely that this broke from the ElixirSense update in https://github.com/elixir-lsp/elixir-ls/pull/202

axelson avatar May 06 '20 17:05 axelson

Placing a debugger breakpoint on an assignment currently results in the breakpoint not being hit and the message "Could not determine module at line" being returned. I've unpinned this issue because it's impact radius is not as far-reaching as I initially thought.

axelson avatar May 11 '20 06:05 axelson

The code from the gist is no longer accessible.

With recent changes in elixir_sense this should not be a problem anymore. To make it more resilient we can fallback to guessing the module via

:code.all_loaded()
|> Enum.filter(fn {atom, _} -> String.starts_with?(Atom.to_string(atom), "Elixir.") end)
|> Enum.group_by(fn
  {module, path} -> Path.expand(to_string(module.module_info(:compile)[:source]))
end, fn {module, _path} -> module end)

Worst case it will return a list of modules and we may set breakpoints in every one of them

lukaszsamson avatar Jul 07 '23 06:07 lukaszsamson