aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins/dap.lua
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2023-03-12 21:41:41 +0200
committersrdusr <trevorgray@srdusr.com>2023-03-12 21:41:41 +0200
commit20945124174b1bac17caf5042410d99046e75966 (patch)
tree25c67e081e6f71fd68e4127fb6b7b46851a33ceb /lua/plugins/dap.lua
parent54530be3e279b609f4dd023c25a4dd5f0d480869 (diff)
downloaddotfiles-20945124174b1bac17caf5042410d99046e75966.tar.gz
dotfiles-20945124174b1bac17caf5042410d99046e75966.zip
Fixed wrong config
Diffstat (limited to 'lua/plugins/dap.lua')
-rw-r--r--lua/plugins/dap.lua140
1 files changed, 106 insertions, 34 deletions
diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua
index 4ba4c46..2fb4333 100644
--- a/lua/plugins/dap.lua
+++ b/lua/plugins/dap.lua
@@ -134,44 +134,116 @@
-- :env {:LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY :YES}
-- :name :lldb})
--
-local dap = require("dap")
-local dapui = require("dapui")
-dapui.setup()
-
-vim.api.nvim_set_hl(0, "DapBreakpoint", {ctermbg = 0, fg = "#993939", bg = "#31353f"})
-vim.api.nvim_set_hl(0, "DapBreakpointLine", {bg = "#251215"})
-vim.api.nvim_set_hl(0, "DapLogPoint", {ctermbg = 0, fg = "#61afef", bg = "#31353f"})
-vim.api.nvim_set_hl(0, "DapLogPointLine", {bg = "#252849"})
-vim.api.nvim_set_hl(0, "DapStopped", {ctermbg = 0, fg = "#98c379", bg = "#31353f"})
-vim.api.nvim_set_hl(0, "DapStoppedLine", {bg = "#15171B"})
-
-vim.fn.sign_define("DapBreakpoint", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
-vim.fn.sign_define("DapBreakpointCondition", {text = "ﳁ", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
-vim.fn.sign_define("DapBreakpointRejected", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
-vim.fn.sign_define("DapLogPoint", {text = "", texthl = "DapLogPoint", linehl = "DapLogPointLine", numhl = "DapLogPoint"})
-vim.fn.sign_define("DapStopped", {text = "", texthl = "DapStopped", linehl = "DapStoppedLine", numhl = "DapStopped"})
-
-dap.listeners.after.event_initialized["dapui_config"] = function()
-dapui.open()
+--local dap = require("dap")
+--local dapui = require("dapui")
+--dapui.setup()
+--
+--vim.api.nvim_set_hl(0, "DapBreakpoint", {ctermbg = 0, fg = "#993939", bg = "#31353f"})
+--vim.api.nvim_set_hl(0, "DapBreakpointLine", {bg = "#251215"})
+--vim.api.nvim_set_hl(0, "DapLogPoint", {ctermbg = 0, fg = "#61afef", bg = "#31353f"})
+--vim.api.nvim_set_hl(0, "DapLogPointLine", {bg = "#252849"})
+--vim.api.nvim_set_hl(0, "DapStopped", {ctermbg = 0, fg = "#98c379", bg = "#31353f"})
+--vim.api.nvim_set_hl(0, "DapStoppedLine", {bg = "#15171B"})
+--
+--vim.fn.sign_define("DapBreakpoint", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
+--vim.fn.sign_define("DapBreakpointCondition", {text = "ﳁ", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
+--vim.fn.sign_define("DapBreakpointRejected", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"})
+--vim.fn.sign_define("DapLogPoint", {text = "", texthl = "DapLogPoint", linehl = "DapLogPointLine", numhl = "DapLogPoint"})
+--vim.fn.sign_define("DapStopped", {text = "", texthl = "DapStopped", linehl = "DapStoppedLine", numhl = "DapStopped"})
+--
+--dap.listeners.after.event_initialized["dapui_config"] = function()
+--dapui.open()
+--end
+--
+--dap.listeners.before.event_terminated["dapui_config"] = function()
+--dapui.close()
+--end
+--
+--dap.listeners.before.event_exited["dapui_config"] = function()
+--dapui.close()
+--end
+--
+--dap.adapters.lldb = ({
+-- type = "executable",
+-- attach = {
+-- pidProperty = "pid",
+-- pidSelect = "ask",
+-- },
+-- command = "lldb-vscode",
+-- env = {
+-- LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "YES",
+-- },
+-- name = "lldb"
+--}).configurations.rust == dap.configurations.cpp
+local dap_ok, dap = pcall(require, "dap")
+if not (dap_ok) then
+ print("nvim-dap not installed!")
+ return
end
-dap.listeners.before.event_terminated["dapui_config"] = function()
-dapui.close()
-end
+require('dap').set_log_level('INFO') -- Helps when configuring DAP, see logs with :DapShowLog
-dap.listeners.before.event_exited["dapui_config"] = function()
-dapui.close()
+dap.configurations = {
+ go = {
+ {
+ type = "go", -- Which adapter to use
+ name = "Debug", -- Human readable name
+ request = "launch", -- Whether to "launch" or "attach" to program
+ program = "${file}", -- The buffer you are focused on when running nvim-dap
+ },
+ }
+}
+dap.adapters.go = {
+ type = "server",
+ port = "${port}",
+ executable = {
+ command = vim.fn.stdpath("data") .. '/mason/bin/dlv',
+ args = { "dap", "-l", "127.0.0.1:${port}" },
+ },
+}
+local dap_ui_ok, ui = pcall(require, "dapui")
+if not (dap_ok and dap_ui_ok) then
+ require("notify")("dap-ui not installed!", "warning")
+ return
end
-dap.adapters.lldb = ({
- type = "executable",
- attach = {
- pidProperty = "pid",
- pidSelect = "ask",
+ui.setup({
+ icons = { expanded = "▾", collapsed = "▸" },
+ mappings = {
+ open = "o",
+ remove = "d",
+ edit = "e",
+ repl = "r",
+ toggle = "t",
+ },
+ expand_lines = vim.fn.has("nvim-0.7"),
+ layouts = {
+ {
+ elements = {
+ "scopes",
+ },
+ size = 0.3,
+ position = "right"
+ },
+ {
+ elements = {
+ "repl",
+ "breakpoints"
+ },
+ size = 0.3,
+ position = "bottom",
+ },
+ },
+ floating = {
+ max_height = nil,
+ max_width = nil,
+ border = "single",
+ mappings = {
+ close = { "q", "<Esc>" },
+ },
},
- command = "lldb-vscode",
- env = {
- LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "YES",
+ windows = { indent = 1 },
+ render = {
+ max_type_length = nil,
},
- name = "lldb"
-}).configurations.rust == dap.configurations.cpp
+})