-
Notifications
You must be signed in to change notification settings - Fork 11
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
Cannot launch osv
at the beginning of a neovim configuration
#47
Comments
This comment was marked as outdated.
This comment was marked as outdated.
I made some modifications to my debug code:
Here is the code: local lazydir = vim.fn.stdpath("data") .. "/lazy"
-- Debug
local osvpath = lazydir .. "/one-small-step-for-vimkind"
if (vim.uv or vim.loop).fs_stat(osvpath) then
local nvim_config_debug = vim.env.NVIM_CONFIG_DEBUG
if nvim_config_debug ~= vim.NIL and nvim_config_debug == "y" then
vim.opt.rtp:prepend(osvpath)
vim.env.NVIM_CONFIG_DEBUG = ""
require("osv").launch({ port = 8086 })
vim.env.NVIM_CONFIG_DEBUG = nvim_config_debug
vim.print("Press any key to continue")
vim.fn.getchar()
end
end Now I can start the debugger at the beginning of the config. I will leave this issue open since, Thank you @jbyuki! |
Nice one! Yes, this is an on-going issue that needs better thought. Leaving it open will remind me/others that it's a problem that needs solving. Glad that it worked in your case for now. |
I just ran into this very same issue the other day. Thanks for the recommendation @ramboman. |
A more elegant way to debug configuration files has been added. The help file goes into more details on how it is done. I will close this for now as a more permanent solution has been now added to the plugin. |
Here it is in action. output.mp4 |
I would like to debug some code, in my neovim configuration, that executes at the start of
nvim
.Setup
I made and reduced this setup solely for the purpose of reproducing the problem
OS: Debian 12
NVIM version: v0.10.0
NVIM package manager: lazy.nvim
~/.config/nvim/init.lua
:~/.config/nvim/lua/do_something.lua
:The general idea
I added a debug code (
-- Debug
) at the beginning of~/.config/nvim/init.lua
. I would like this code to launchosv
ifnvim
was started with the environment variableNVIM_DEBUG
equal"y"
. Right afterosv
is launched,nvim
has to wait for a key press, so I have the time to setup the debugger on the othernvim
. After I press any key on the debuggednvim
, it has to continue its execution until it reaches a breakpoint.How to reproduce the problem
nvim
so it setups everythingnvim
add_some
functionnvim
instance to debug:Expected course of action
nvim
instance launchsosv
<F4>
in the clientnvim
to open the debug ui<F9>
so thedap
connects to the debuggednvim
nvim
nvim
stops at the break points so I can start debuggingActual course of action:
nvim
prints this error message:Questions
osv
properly at the beginning of a configuration so I can debug it?The text was updated successfully, but these errors were encountered: