suketa / nvim-dap-ruby

MIT License
75 stars 21 forks source link

Rails support #25

Open duduribeiro opened 2 years ago

duduribeiro commented 2 years ago

Hey folks πŸ‘‹

I've created a dap adapter / config that I could run a rails debugging flow but I don't know the best idea to integrate with nvim-dap-ruby

basically I did this:

  dap.adapters.ruby = {
    type = 'server';
    port = "1234";
    command = '/path/to/rails/app/bin/rdbg';
    args = {"--open", "--port", "1234", "--"};
    -- useBundler = true;
  }
  --
  dap.configurations.ruby = {
    {
      type = 'ruby';
      request = 'launch';
      name = 'ruby debug: start rails';
      command = 'bin/rails s';
      useBundler = true;
    },
  }

With this config I could run the debugger BUT I needed to manually start the process on another terminal with rdbg --command --open --stop-at-load --port 1234 -- bin/rails s.

Any tips on how can I configure my adapter / configuration to execute this for me? πŸ˜„

https://user-images.githubusercontent.com/771411/197886605-b1f75375-78e5-4643-a221-2b8e43ec5334.mov

this is the video of it working. one annoying stuff that I noted is that when I start the debug process, it looses the syntax highlights and IDK why.

Do u think it is feasible to run dap support for rails with debug gem like I tried to made?

hahuang65 commented 1 year ago

I was able to get this to work by adding the following to dap.configurations.ruby:

      {
        type = "ruby",
        name = "debug rails server",
        bundle = "bundle",
        request = "attach",
        command = "rails",
        script = "server",
        port = 38698,
        server = "127.0.0.1",
        options = {
          source_filetype = "ruby",
        },
        localfs = true,
        waiting = 1000,
      },

However, the issue is, the server continues to run after the debugging session ends, resulting in a need to kill that server in order to start a new debug session (which happens fairly frequently, as you can't seem to add more breakpoints once you start).