add: dap config for other language

This commit is contained in:
asep.komarudin 2024-06-27 11:38:10 +07:00
parent cf21e5a91a
commit fe8e5296f9
4 changed files with 50 additions and 10 deletions

View file

@ -45,7 +45,7 @@ pcode.format_timeout_ms = 5000
-- https://github.com/mfussenegger/nvim-lint
-- https://github.com/stevearc/conform.nvim
-- use conform and nvim-lint if set true
pcode.disable_null_ls = true
pcode.disable_null_ls = false
pcode.treesitter_ensure_installed = {}
pcode.tscontext = false
@ -158,7 +158,7 @@ pcode.database = false
pcode.rest_client = true
-- https://github.com/mfussenegger/nvim-dap
pcode.nvim_dap = false -- not support for windows os (auto config mason-nvim-dap)
pcode.nvim_dap = true -- not support for windows os (auto config mason-nvim-dap)
-- conefig special support test & dap
pcode.active_rust_config = false

View file

@ -1,5 +1,5 @@
local M = {}
if vim.fn.has("win32") == 0 and pcode.nvim_dap then
if pcode.nvim_dap then
M = {
{
"rcarriga/nvim-dap-ui",
@ -15,9 +15,38 @@ if vim.fn.has("win32") == 0 and pcode.nvim_dap then
},
},
},
enabled = vim.fn.has("win32") == 0,
-- enabled = vim.fn.has("win32") == 0,
config = function()
require("user.dapui")
-- add diff langue vs filetype
local keymap = {
["c++"] = "cpp",
["c#"] = "cs",
["jsx"] = "javascriptreact",
}
local mason_reg = require("mason-registry")
local opts = {}
for _, pkg in pairs(mason_reg.get_installed_packages()) do
for _, type in pairs(pkg.spec.categories) do
if type == "DAP" then
for _, ft in pairs(pkg.spec.languages) do
local ftl = string.lower(ft)
local ready = mason_reg.get_package(pkg.spec.name):is_installed()
if ready then
if keymap[ftl] ~= nil then
ftl = keymap[ftl]
local require_ok, conf_opts = pcall(require, "user.dap.settings." .. ftl)
if require_ok then
opts = vim.tbl_deep_extend("force", conf_opts, opts)
end
require("dap").dapters[ftl] = opts
end
end
end
end
end
end
end,
keys = {
{ "<leader>d", "", desc = "  Debug" },
@ -42,7 +71,7 @@ if vim.fn.has("win32") == 0 and pcode.nvim_dap then
lazy = true,
event = "BufRead",
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
enabled = vim.fn.has("win32") == 0,
-- enabled = vim.fn.has("win32") == 0,
config = function()
require("user.mason_dap")
end,

View file

@ -0,0 +1,6 @@
local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
return {
ype = "executable",
command = "node",
args = { path .. "/extension/out/phpDebug.js" },
}