-- -- 50-dap.lua -- -- * Configures OSV: -- User commands: -- * OSVLaunch: start the OSV server (on the debuggee) -- * OSVStatus: show status of OSV server and client -- local dap = require("dap") ---------------------------------------------------------------------------------------------------- -- OSV (Lua inside Neovim) ---------------------------------------------------------------------------------------------------- dap.configurations.lua = { { type = "nlua", request = "attach", name = "Attach to running Neovim instance", port = 8086, }, } dap.adapters.nlua = function(callback, config) callback({ type = "server", host = config.host or "127.0.0.1", port = config.port }) end local osv = require("osv") local function osv_launch() osv.launch({ port = dap.configurations.lua.port }) end local function osv_status() vim.notify("OSV server running: " .. tostring(osv.is_running())) vim.notify("OSV client attached: " .. tostring(osv.is_attached())) end ---------------------------------------------------------------------------------------------------- vim.api.nvim_create_user_command("OSVLaunch", osv_launch, { desc = "Launch OSV server" }) vim.api.nvim_create_user_command("OSVStatus", osv_status, { desc = "Show OSV status" })