|
@@ -22,8 +22,14 @@ M.config = function()
|
|
linehl = "Visual",
|
|
linehl = "Visual",
|
|
numhl = "DiagnosticSignWarn",
|
|
numhl = "DiagnosticSignWarn",
|
|
},
|
|
},
|
|
|
|
+ log = {
|
|
|
|
+ level = "info",
|
|
|
|
+ },
|
|
ui = {
|
|
ui = {
|
|
auto_open = true,
|
|
auto_open = true,
|
|
|
|
+ notify = {
|
|
|
|
+ threshold = vim.log.levels.INFO,
|
|
|
|
+ },
|
|
config = {
|
|
config = {
|
|
expand_lines = true,
|
|
expand_lines = true,
|
|
icons = { expanded = "", collapsed = "", circular = "" },
|
|
icons = { expanded = "", collapsed = "", circular = "" },
|
|
@@ -99,6 +105,8 @@ M.setup = function()
|
|
U = { "<cmd>lua require'dapui'.toggle()<cr>", "Toggle UI" },
|
|
U = { "<cmd>lua require'dapui'.toggle()<cr>", "Toggle UI" },
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ dap.set_log_level(lvim.builtin.dap.log.level)
|
|
|
|
+
|
|
if lvim.builtin.dap.on_config_done then
|
|
if lvim.builtin.dap.on_config_done then
|
|
lvim.builtin.dap.on_config_done(dap)
|
|
lvim.builtin.dap.on_config_done(dap)
|
|
end
|
|
end
|
|
@@ -123,6 +131,43 @@ M.setup_ui = function()
|
|
-- dapui.close()
|
|
-- dapui.close()
|
|
-- end
|
|
-- end
|
|
end
|
|
end
|
|
|
|
+
|
|
|
|
+ local Log = require "lvim.core.log"
|
|
|
|
+
|
|
|
|
+ -- until rcarriga/nvim-dap-ui#164 is fixed
|
|
|
|
+ local function notify_handler(msg, level, opts)
|
|
|
|
+ if level >= lvim.builtin.dap.ui.notify.threshold then
|
|
|
|
+ return vim.notify(msg, level, opts)
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ opts = vim.tbl_extend("keep", opts or {}, {
|
|
|
|
+ title = "dap-ui",
|
|
|
|
+ icon = "",
|
|
|
|
+ on_open = function(win)
|
|
|
|
+ vim.api.nvim_buf_set_option(vim.api.nvim_win_get_buf(win), "filetype", "markdown")
|
|
|
|
+ end,
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ -- vim_log_level can be omitted
|
|
|
|
+ if level == nil then
|
|
|
|
+ level = Log.levels["INFO"]
|
|
|
|
+ elseif type(level) == "string" then
|
|
|
|
+ level = Log.levels[(level):upper()] or Log.levels["INFO"]
|
|
|
|
+ else
|
|
|
|
+ -- https://github.com/neovim/neovim/blob/685cf398130c61c158401b992a1893c2405cd7d2/runtime/lua/vim/lsp/log.lua#L5
|
|
|
|
+ level = level + 1
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ msg = string.format("%s: %s", opts.title, msg)
|
|
|
|
+ Log:add_entry(level, msg)
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ local dapui_ok, _ = xpcall(function()
|
|
|
|
+ require("dapui.util").notify = notify_handler
|
|
|
|
+ end, debug.traceback)
|
|
|
|
+ if not dapui_ok then
|
|
|
|
+ Log:debug "Unable to override dap-ui logging level"
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
return M
|
|
return M
|