simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.16k stars 158 forks source link

Allow passing arguments to a debugger #243

Closed lostl1ght closed 1 year ago

lostl1ght commented 2 years ago

Closes #241

Two notes:

  1. I have to split an input string by whitespace. Passing it as a whole in a table just doesn't work because a debuggee doesn't receive these arguments. E.g.:
    args = { input }
  2. vim.ui.input() is evidently async. No idea how to make caller wait for the closure to return. That's why:
    if --[[cond]] then
    -- code
    dap.run(dap_config)
    end)
    else
    dap.run(dap_config)
    end

Otherwise it works just fine.

Zedai00 commented 2 years ago

how will this work in config?

simrat39 commented 1 year ago

Neovim now supports .editorconfig files in 0.9, I think that would be a cleaner approach to setting debug values as opposed to just asking for input every time

imroc commented 1 year ago

Neovim now supports .editorconfig files in 0.9, I think that would be a cleaner approach to setting debug values as opposed to just asking for input every time

Can you give an example? @simrat39

JxBP commented 1 year ago

Any updates on this?

lostl1ght commented 1 year ago

Sorry for closing silently. I don't use neither rust-tools nor nvim-dap. I would suggest following simrat39's advice and using editorconfig to setup a DAP configuration. It is quite straightforward. Please read :h editorconfig, there is an example at the end.

JxBP commented 1 year ago

It is quite straightforward. Please read :h editorconfig, there is an example at the end.

The help page doesn't mention anything about DAP integration. It explains how to use editorconfig (and custom properties for it) in Lua but rust-tools.nvim would still need to actually read this file.

I could try and make a PR for that but what should the custom property be called?