-
Notifications
You must be signed in to change notification settings - Fork 10
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
How to use with larger projects #7
Comments
Are you using packer.nvim to manage your plugin extension? There is a catch explained here. Basically you need to open the source file located in the nvim-data directory ( If that's not the problem, please describe how you are starting the debugging session so that I can reproduce it. |
That's strange, not sure what could be the issue. But in the case of debugging, I would say it's okay if it only works once. You can try to use the test script located in test/test.lua which automatically starts a debugging session and test if the breakpoint hits. You just need to put test/input.lua in your home directory. Then execute the script using |
Running the test.lua works, I see the output on my screen which looks good and result.txt says OK. I'll explain exactly what I'm trying to do.
Telescope runs normally without being stopped at the breakpoint. After doing this I ran through using your quickstart example and it worked fine, stops on the breakpoint I set. |
I just tested it on my machine and it seems to work. The issue might just be a misconfigured dap configuration or something. Here is my debugging session in action: 2021-09-22.21-40-43.movHopefully the commands are visible in the video. The dap config I use is: local dap = require"dap"
dap.configurations.lua = {
{
type = 'nlua',
request = 'attach',
name = "Attach to running Neovim instance",
}
}
dap.adapters.nlua = function(callback, config)
callback({ type = 'server', host = config.host or "127.0.0.1", port = config.port or 8086 })
end
vim.api.nvim_set_keymap('n', '<F8>', [[:lua require"dap".toggle_breakpoint()<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<F9>', [[:lua require"dap".continue()<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<F10>', [[:lua require"dap".step_over()<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<S-F10>', [[:lua require"dap".step_into()<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<F12>', [[:lua require"dap.ui.variables".hover()<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<F5>', [[:lua require"osv".launch({port = 8086})<CR>]], { noremap = true })
vim.api.nvim_set_keymap('n', '<F6>', [[:lua require"osv".run_this()<CR>]], { noremap = true }) |
Thanks so much for taking the time to test this. The problem is with my set-up. I use Dropbox to share my dotfiles between computers, my ~/.config/nvim is a link to a Dropbox folder. I know I should be able to use links as your help files show how to do this for debugging plugins if you use packer.nvim. The problem isn't Dropbox, it's using links in general on my machine. I know this isn't a problem with your plugin, it's my set-up, I'll just move to using the local folder. |
Well, it seems you tried a lot of things so you probably wasted more time than I did. Just as a small help maybe you can see which files is executed in neovim (which internal.lua) using debug.sethook. This is essentially what osv is using. Set a hook for each line then try to catch if there is internal.lua which is executed on calling telescope. If you give me the complete path, it's possible it's just a string formatting error which I can then fix. Otherwise if on local it works for you then nevermind. |
I couldn't follow exactly what you asked but I was able to get something out by using my own logfile function,
The output for
I then set a breakpoint using It showed this:
Does that show it's not working because the paths don't match? If I use
|
This seems to be more than an simple path formatting issue. Maybe changing the vim-plug working directory to the dropbox path could solve the problem. But there might be other consequences which raises other problems. You're welcome to submit a PR. I will assist you if you need any help. |
I followed your example and I can get dap to stop at breakpoints. (not always, sometimes it doesn't work with the simple example.)
I wanted to ask how I can use dam with larger projects? I'd like to debug Telescope to help me writing an extension.
I've added a breakpoint which should stop when I open my Telescope picker but it never stops.
In this case I don't use `luafile myscript.lua' as that's not how the function would be called.
The text was updated successfully, but these errors were encountered: