vscode-elixir-ls
vscode-elixir-ls copied to clipboard
Support debug with user defined node full name
As described in issue here https://github.com/JakeBecker/vscode-elixir-ls/issues/97 one would like to debug erlang/elixir node that is part of some cluster. I suggested to respect ERL OPTIONS env variable so it can be injected on application start.
Here is launch config I suggested
{
"type": "mix_task",
"name": "mix phx.server",
"request": "launch",
"projectDir": "${workspaceRoot}",
"task": "phx.server",
"startApps": true,
"env":{
"ELIXIR_ERL_OPTIONS": "-name [email protected]"
}
}
At the moment, LS will never connect to node since this VS Code plugin will generate node name anyways and pass it to LS, and above would only make confusion. Probably it is the best way to be explicit in launch confing with dedicated attribute for sname
or name
flag for instance
{
"type": "mix_task",
"name": "mix phx.server",
"request": "launch",
"projectDir": "${workspaceRoot}",
"task": "phx.server",
"startApps": true,
"nodeName": "[email protected]"
}
EDIT:
For the sake of the safety if node should connect to prod cluster, there can be also flag for "hidden" and nodeCookie
, in case one would like to run hidden node in the cluster with all code up but don't want that node to participate in cluster workload.
{
"type": "mix_task",
"name": "mix phx.server",
"request": "launch",
"projectDir": "${workspaceRoot}",
"task": "phx.server",
"startApps": true,
"erlOpts": {
"name": "[email protected]",
"cookie": "dskajhd98asd9ohasdh98hsad9",
"hidden": true
}
}
the list could go on :) for any erl flag
A PR would be welcome
hi, three years passed, is there any process on it?
No but my answer still stands
hi, @mjaric , i now use this configuratoin, it seems to be working
{
"type": "mix_task",
"name": "debug",
"request": "launch",
"task": "run",
"taskArgs": [
"-e",
// :shortnames, :longnames
":net_kernel.start([:debug, :shortnames])",
"-e",
":erlang.set_cookie(node(), :\"123456\")",
"-e",
"Demo.hello()"
],
"startApps": true,
"preLaunchTask": "epmd",
"projectDir": "${workspaceRoot}",
}
tasks.json
{
"label": "epmd",
"type": "shell",
// kill -9 `pidof epmd`
"command": "epmd -daemon"
}
ELS_ELIXIR_OPTS
and ELS_ERL_OPTS
are now supported. You can pass --sname --cookie mycookie
via ELS_ELIXIR_OPTS
. I believe this issue is now resolved.