-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger fails initialization on demo phoenix project #451
Comments
I'm unable to reproduce this issue on macOS with the following launch config
Can you post a repo that reproduces it? |
Of course, here it is: https://github.com/azazel75/phoenix_elixirls_debugger_failure |
Sorry, I'm not able to reproduce. Since you not posted a launch config I used the one from my previous post. Please verify that your launch config is valid. Especially check if |
Hi @lukaszsamson, I don't know how to test your JSON configuration using the (dap-register-debug-template
"Elixir::Phoenix"
(list :type "Elixir"
:task "phx.server"
:taskArgs nil
:request "launch"
:program nil
:name "Elixir::Phoenix")) so no (defun dap-elixir--populate-start-file-args (conf)
"Populate CONF with the required arguments."
(-> conf
(dap--put-if-absent :dap-server-path '("debugger.sh"))
(dap--put-if-absent :type "mix_task")
(dap--put-if-absent :name "mix test")
(dap--put-if-absent :request "launch")
(dap--put-if-absent :task "test")
(dap--put-if-absent :taskArgs (list "--trace"))
(dap--put-if-absent :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name)))
(dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name)))
(dap--put-if-absent :requireFiles (list
"test/**/test_helper.exs"
"test/**/*_test.exs")))) I hope that this is understandable even if this is emacs lisp code. In that |
OK @azazel75, I was able to reproduce it when I added
Your config is wrong - you require test files that try to init a sandboxed repo when the app is not yet started. You need to pass an empty list here. I'm not sure about other settings but
|
You're right, (defun dap-elixir--populate-start-file-args (conf)
"Populate CONF with the required arguments."
(-> conf
(dap--put-if-absent :dap-server-path '("debugger.sh"))
(dap--put-if-absent :type "mix_task")
(dap--put-if-absent :name "mix test")
(dap--put-if-absent :request "launch")
(dap--put-if-absent :task "test")
(dap--put-if-absent :projectDir (lsp-find-session-folder (lsp-session) (buffer-file-name)))
(dap--put-if-absent :cwd (lsp-find-session-folder (lsp-session) (buffer-file-name))))) Does the trick and the launch is effective, thanks @lukaszsamson and ... silly me! That brings me to the other error I'm experiencing, tell me if it's better that I move to another issue. If I now set a breakpoing to
This happens even when I'm stepping through the code. Is this an expected behaviour? Is it maybe the resulting of the browser closing the connection? Thanks in advance for your patience |
Good to hear you made it work @azazel75 . |
For anyone coming here, to increase the timeout i changed the line to http: [port: 4000, protocol_options: [idle_timeout: 300000]], to get a timeout of 5 minutes |
This advise is magic!! So many examples out there, present this as a requirement. |
I tried the debugger with one of my projects and it seemed to work well at
first, but then when I setup a breakpoint the debugger process ended because an
exception was raised roughly after 60 seconds. That smelled strange so I
decided to try the debugger on the output of a basic
mix phx.new hello_world
project just to see if my setup worked. That failed with another error, which
I'm now reporting here. I've reported something
similar
on the forum an year ago but not having received any feedback I decided to write
here. when I run the debugger with a configuration where the relevant settings
are just
"task": "phx.server"
the log is the following:... and if I add
"startApps": true
to the settingd the log is slightly different:Talking with
vhf
on the#elixir-lang
channel he told me that theinstrumentation adds computational overhead and this messes the things with the
application bootstrap. I'm no Elixir expert but looking at the debugger's code
I see that it calls
Mix.Task.run()
multiple times, but again looking at theimplementation of that it doesn't seem to offer any kind of coordination between
the process that calls it and when the task is really executed so the calling
process (the debugger server) just goes on with the initialization without
really wait for those tasks to be executed. Am I wrong? Could it be the
culprit? What can be done to alleviate the symptom?
(The db was previously initialized and the
mix phx.server
command from theshell worked as expected)
I'm coming from Python and I must say that the debugging experience in Elixir
could really improve with an usable debugger. Don't get me wrong,
Iex.pry()
helps but without a chance of stepping through the code you can use it almost
just to confirm your intuition of where and what is causing the bug.
Environment
Erlang/OTP 22)
ElixirLS is at commit
a696d94f5a7b9d9d5323d79342bc206a26cf14bb
Troubleshooting
.elixir_ls
directory, then restart your editorThe text was updated successfully, but these errors were encountered: