Initial commit
This commit is contained in:
177
nvim/lua/darcula/setup/500_dap.lua
Normal file
177
nvim/lua/darcula/setup/500_dap.lua
Normal file
@@ -0,0 +1,177 @@
|
||||
-- The MIT License (MIT)
|
||||
--
|
||||
-- Copyright © 2026 Scott E. Graves <scott.e.graves@protonmail.com>
|
||||
--
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
-- and associated documentation files (the “Software”), to deal in the Software without restriction,
|
||||
-- including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
-- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
--
|
||||
-- The above copyright notice and this permission notice shall be included in all copies or
|
||||
-- substantial portions of the Software.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
-- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
--
|
||||
local dap = require("dap")
|
||||
local utils = require("darcula.utils")
|
||||
local utils_os = require("darcula.utils.os")
|
||||
|
||||
-- DOES NOT CURRENTLY WORK
|
||||
-- dap.adapters.cppvsdbg = {
|
||||
-- id = "cppvsdbg",
|
||||
-- type = "executable",
|
||||
-- command = vim.fs.joinpath(
|
||||
-- vim.fn.stdpath("data"),
|
||||
-- "dap", "cpp", "extension", "debugAdapters", "vsdbg", "bin", "vsdbg.exe"
|
||||
-- ),
|
||||
-- args = {
|
||||
-- "--interpreter=vscode"
|
||||
-- },
|
||||
-- options = {
|
||||
-- detached = false
|
||||
-- }
|
||||
-- }
|
||||
dap.adapters.cppdbg = {
|
||||
id = "cppdbg",
|
||||
type = "executable",
|
||||
command = vim.fs.joinpath(
|
||||
vim.fn.stdpath("data"),
|
||||
"dap",
|
||||
"cpp",
|
||||
"extension",
|
||||
"debugAdapters",
|
||||
"bin",
|
||||
utils.iff(utils_os.is_windows, "OpenDebugAD7.exe", "OpenDebugAD7")
|
||||
),
|
||||
options = {
|
||||
detached = false
|
||||
}
|
||||
}
|
||||
|
||||
dap.adapters.dart = {
|
||||
type = "executable",
|
||||
command = "dart",
|
||||
args = {"debug_adapter"}
|
||||
}
|
||||
dap.adapters.flutter = {
|
||||
type = "executable",
|
||||
command = "flutter",
|
||||
args = {"debug_adapter"}
|
||||
}
|
||||
dap.configurations.dart = {
|
||||
{
|
||||
type = "dart",
|
||||
request = "launch",
|
||||
name = "Launch dart",
|
||||
dartSdkPath = vim.fs.joinpath(
|
||||
utils.iff(utils_os.is_windows, vim.env.NV_DARCULA_DRIVE, vim.env.HOME),
|
||||
"flutter",
|
||||
"bin",
|
||||
"cache",
|
||||
"dart-sdk",
|
||||
"bin",
|
||||
"dart"
|
||||
),
|
||||
flutterSdkPath = vim.fs.joinpath(
|
||||
utils.iff(utils_os.is_windows, vim.env.NV_DARCULA_DRIVE, vim.env.HOME),
|
||||
"flutter",
|
||||
"bin",
|
||||
"flutter"
|
||||
),
|
||||
program = "${workspaceFolder}/lib/main.dart", -- ensure this is correct
|
||||
cwd = "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
type = "flutter",
|
||||
request = "launch",
|
||||
name = "Launch flutter",
|
||||
dartSdkPath = vim.fs.joinpath(
|
||||
utils.iff(utils_os.is_windows, vim.env.NV_DARCULA_DRIVE, vim.env.HOME),
|
||||
"flutter",
|
||||
"bin",
|
||||
"cache",
|
||||
"dart-sdk",
|
||||
"bin",
|
||||
"dart"
|
||||
),
|
||||
flutterSdkPath = vim.fs.joinpath(
|
||||
utils.iff(utils_os.is_windows, vim.env.NV_DARCULA_DRIVE, vim.env.HOME),
|
||||
"flutter",
|
||||
"bin",
|
||||
"flutter"
|
||||
),
|
||||
program = "${workspaceFolder}/lib/main.dart", -- ensure this is correct
|
||||
cwd = "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
|
||||
require("dap-go").setup()
|
||||
|
||||
local symbols = require("darcula.utils.symbols")
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpoint",
|
||||
{
|
||||
text = symbols.debug.breakpoint,
|
||||
texthl = "ErrorSign",
|
||||
linehl = "",
|
||||
numhl = ""
|
||||
}
|
||||
)
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointCondition",
|
||||
{
|
||||
text = symbols.debug.conditional_breakpoint,
|
||||
texthl = "ErrorSign",
|
||||
linehl = "",
|
||||
numhl = ""
|
||||
}
|
||||
)
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointRejected",
|
||||
{
|
||||
text = symbols.debug.breakpoint_disabled,
|
||||
texthl = "ErrorSign",
|
||||
linehl = "",
|
||||
numhl = ""
|
||||
}
|
||||
)
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapLogPoint",
|
||||
{
|
||||
text = symbols.debug.breakpoint,
|
||||
texthl = "WarningSign",
|
||||
linehl = "",
|
||||
numhl = ""
|
||||
}
|
||||
)
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapStopped",
|
||||
{
|
||||
text = symbols.debug.current_line,
|
||||
texthl = "WarningSign",
|
||||
linehl = "",
|
||||
numhl = ""
|
||||
}
|
||||
)
|
||||
|
||||
local dapui = require("dapui")
|
||||
dapui.setup()
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user