nvim-dap-ruby icon indicating copy to clipboard operation
nvim-dap-ruby copied to clipboard

Extending with custom configurations

Open ewal opened this issue 2 years ago • 4 comments

I might out my poor Lua skills now, but I'm trying to figure out how to extend the configuration with a custom runner. So, my question is if it's currently possible?

ewal avatar Sep 22 '23 20:09 ewal

No it's not possible. There's no way to feed in a user config. Take a look at some of the other Neovim DAP adapters for inspiration and a PR should be relatively straightforward.

olimorris avatar Sep 30 '23 09:09 olimorris

@olimorris, I did some investigation and it turns out it actually is possible to extend the configuration table. This is what I did it to append a config for running puma-dev:

    require('dap-ruby').setup {}

    table.insert(dap.configurations.ruby, {
      type = 'ruby',
      name = 'run puma',
      bundle = 'bundle',
      request = 'attach',
      command = 'puma [...args for puma]',
      port = 38698,
      server = '127.0.0.1',
      options = {
        source_filetype = 'ruby',
      },
      localfs = true,
      waiting = 1000,
    })

ewal avatar Sep 30 '23 15:09 ewal

@suketa, perhaps the info above about extending the configuration table could be useful for the readme?

ewal avatar Sep 30 '23 15:09 ewal

Nice work!

It's common practice for the plugin to have a config.lua file which allows for the default config to be extended/overwritten by a user's. Would be a much cleaner API.

olimorris avatar Sep 30 '23 17:09 olimorris