summaryrefslogtreecommitdiffstats
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/plugin/50-dap.lua35
1 files changed, 26 insertions, 9 deletions
diff --git a/.config/nvim/plugin/50-dap.lua b/.config/nvim/plugin/50-dap.lua
index 6e6eea1..7c715ba 100644
--- a/.config/nvim/plugin/50-dap.lua
+++ b/.config/nvim/plugin/50-dap.lua
@@ -1,26 +1,43 @@
--
--- DAP client/adapter configurations
+-- 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 configuration
-local osv = require("osv")
+----------------------------------------------------------------------------------------------------
+-- 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 or 8086 })
+ callback({ type = "server", host = config.host or "127.0.0.1", port = config.port })
end
-vim.api.nvim_create_user_command("OSVLaunch", function()
- osv.launch({ port = 8086 })
-end, { desc = "Launch OSV server" })
-vim.api.nvim_create_user_command("OSVStatus", function()
+
+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, { desc = "Show OSV status" })
+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" })