diff --git a/lazy-lock.json b/lazy-lock.json index 3a7e02b..797df45 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -13,7 +13,7 @@ "codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" }, "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, - "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, + "friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, "lazy.nvim": { "branch": "main", "commit": "c501b429cf995c645454539b924aaefae45bb9eb" }, @@ -31,13 +31,17 @@ "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, + "nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" }, + "nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" }, + "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, "nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" }, "nvim-material-icon": { "branch": "main", "commit": "7a8893417c6947925d00946d16b81b56574796a9" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "71a8e8b4b6ebab39765615334d4241a18090a651" }, + "nvim-treesitter": { "branch": "master", "commit": "382c80b5759e909ff22b0e8ceab1f68564e38971" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, @@ -48,12 +52,13 @@ "rest.nvim": { "branch": "main", "commit": "91badd46c60df6bd9800c809056af2d80d33da4c" }, "smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" }, "telescope.nvim": { "branch": "master", "commit": "c392f1b78eaaf870ca584bd698e78076ed301b26" }, - "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "f3f136fd82eded0bd1e1870cf7dfab7e8c36801e" }, + "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, + "vscode-js-debug": { "branch": "main", "commit": "9fd0efd39d534304cffd970263148923b627be20" }, "which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" }, "yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" } } \ No newline at end of file diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 5116b13..93aa9b6 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -151,4 +151,5 @@ pcode.rest_client = true pcode.refactoring = false -- https://github.com/mfussenegger/nvim-dap -pcode.nvim_dap = true +pcode.nvim_dap = false -- not support for windows os +pcode.nvim_dap_javascript = true diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 6e28d13..b4a919a 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -19,6 +19,23 @@ if vim.fn.has("win32") == 0 and pcode.nvim_dap then config = function() require("user.dapui") end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, }, { "jay-babu/mason-nvim-dap.nvim", diff --git a/lua/plugins/dap_js.lua b/lua/plugins/dap_js.lua new file mode 100644 index 0000000..5ea6c2a --- /dev/null +++ b/lua/plugins/dap_js.lua @@ -0,0 +1,92 @@ +local M = {} +if pcode.nvim_dap_javascript then + M = { + { + "rcarriga/nvim-dap-ui", + lazy = true, + event = "BufRead", + dependencies = { + { "mfussenegger/nvim-dap", lazy = true }, + { "nvim-neotest/nvim-nio", lazy = true }, + { + "mxsdev/nvim-dap-vscode-js", + dependencies = { + "microsoft/vscode-js-debug", + version = "1.x", + build = "npm i && npm run compile vsDebugServerBundle && mv dist out", + }, + config = function() + require("dap-vscode-js").setup({ + -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" + debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug", + -- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. + adapters = { + "chrome", + "pwa-node", + "pwa-chrome", + "pwa-msedge", + "node-terminal", + "pwa-extensionHost", + "node", + "chrome", + }, -- which adapters to register in nvim-dap + -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging + -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging. + -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output. + }) + end, + }, + }, + config = function() + require("user.dapui") + local js_based_languages = { "typescript", "javascript", "typescriptreact" } + + for _, language in ipairs(js_based_languages) do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, + { + type = "pwa-node", + request = "attach", + name = "Attach", + processId = require("dap.utils").pick_process, + cwd = "${workspaceFolder}", + }, + { + type = "pwa-chrome", + request = "launch", + name = 'Start Chrome with "localhost"', + url = "http://localhost:3000", + webRoot = "${workspaceFolder}", + userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir", + }, + } + end + end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, + }, + } +end + +return M diff --git a/lua/user/dapui.lua b/lua/user/dapui.lua index 5786ab7..e394373 100644 --- a/lua/user/dapui.lua +++ b/lua/user/dapui.lua @@ -78,5 +78,6 @@ dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end -- vim.fn.sign_define("DapBreakpoint", { text = "🟥", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) +-- vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpoint", { text = "󰨰", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) vim.fn.sign_define("DapStopped", { text = "▶️", texthl = "", linehl = "", numhl = "" }) diff --git a/lua/user/utils/whichkey.lua b/lua/user/utils/whichkey.lua index a39805b..22b6b7a 100644 --- a/lua/user/utils/whichkey.lua +++ b/lua/user/utils/whichkey.lua @@ -1,29 +1,5 @@ local M = {} --- for debug -local debug_key = {} - -if vim.fn.has("win32") == 0 and pcode.nvim_dap then - debug_key = { - name = "  Debug", - t = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, - b = { "lua require'dap'.step_back()", "Step Back" }, - c = { "lua require'dap'.continue()", "Continue" }, - C = { "lua require'dap'.run_to_cursor()", "Run To Cursor" }, - d = { "lua require'dap'.disconnect()", "Disconnect" }, - g = { "lua require'dap'.session()", "Get Session" }, - i = { "lua require'dap'.step_into()", "Step Into" }, - o = { "lua require'dap'.step_over()", "Step Over" }, - u = { "lua require'dap'.step_out()", "Step Out" }, - p = { "lua require'dap'.pause()", "Pause" }, - r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, - s = { "lua require'dap'.continue()", "Start" }, - q = { "lua require'dap'.close()", "Quit" }, - U = { "lua require'dapui'.toggle({reset = true})", "Toggle UI" }, - } -end --- end debug - function M._LAZYGIT_TOGGLE() local Terminal = require("toggleterm.terminal").Terminal local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) @@ -264,7 +240,6 @@ M.mappings = { "MVN Build", }, }, - d = debug_key, z = { name = " 󱑠 Plugins(Lazy)", i = { "Lazy install", "Install" },