From a94738e4a494ce067cfa7c8850a4580198ab41d9 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Tue, 6 Aug 2024 00:26:50 -0400 Subject: [PATCH] feat: almost add debugger --- .github/CONTRIBUTING.md | 0 .github/FUNDING.yml | 0 .github/ISSUE_TEMPLATE/bug_report.md | 0 .github/ISSUE_TEMPLATE/config.yml | 0 .github/ISSUE_TEMPLATE/feature_request.md | 0 .github/PULL_REQUEST_TEMPLATE/feature.md | 0 .github/PULL_REQUEST_TEMPLATE/plugin.md | 0 .github/README.md | 0 .github/workflows/stale.yml | 0 README.md | 0 init.lua | 6 +- lazy-lock.json | 21 +++--- lua/colorscheme.lua | 8 +++ lua/commands.lua | 0 lua/config/autopairs.lua | 0 lua/config/autotags.lua | 0 lua/config/comment.lua | 0 lua/config/conform.lua | 0 lua/config/dap-ui.lua | 13 ++++ lua/config/dap.lua | 30 --------- lua/config/dashboard.lua | 0 lua/config/fterm.lua | 0 lua/config/harpoon.lua | 0 lua/config/lualine.lua | 0 lua/config/mason.lua | 0 lua/config/nvim-cmp.lua | 0 lua/config/nvim-tree.lua | 0 lua/config/telescope.lua | 0 lua/config/theme.lua | 0 lua/config/themery.lua | 0 lua/custom/chadrc.lua | 70 -------------------- lua/custom/configs/lspconfig.lua | 24 ------- lua/custom/configs/null-ls.lua | 33 ---------- lua/custom/configs/overrides.lua | 62 ------------------ lua/custom/highlights.lua | 21 ------ lua/custom/mappings.lua | 34 ---------- lua/custom/options.lua | 34 ---------- lua/custom/plugins.lua | 61 ------------------ lua/dap_config.lua | 78 +++++++++++++++++++++++ lua/keymaps.lua | 1 + lua/lsp.lua | 0 lua/options.lua | 0 lua/plugins.lua | 20 ++++-- requirements.md | 0 44 files changed, 129 insertions(+), 387 deletions(-) mode change 100644 => 100755 .github/CONTRIBUTING.md mode change 100644 => 100755 .github/FUNDING.yml mode change 100644 => 100755 .github/ISSUE_TEMPLATE/bug_report.md mode change 100644 => 100755 .github/ISSUE_TEMPLATE/config.yml mode change 100644 => 100755 .github/ISSUE_TEMPLATE/feature_request.md mode change 100644 => 100755 .github/PULL_REQUEST_TEMPLATE/feature.md mode change 100644 => 100755 .github/PULL_REQUEST_TEMPLATE/plugin.md mode change 100644 => 100755 .github/README.md mode change 100644 => 100755 .github/workflows/stale.yml mode change 100644 => 100755 README.md mode change 100644 => 100755 init.lua mode change 100644 => 100755 lazy-lock.json mode change 100644 => 100755 lua/colorscheme.lua mode change 100644 => 100755 lua/commands.lua mode change 100644 => 100755 lua/config/autopairs.lua mode change 100644 => 100755 lua/config/autotags.lua mode change 100644 => 100755 lua/config/comment.lua mode change 100644 => 100755 lua/config/conform.lua create mode 100755 lua/config/dap-ui.lua delete mode 100644 lua/config/dap.lua mode change 100644 => 100755 lua/config/dashboard.lua mode change 100644 => 100755 lua/config/fterm.lua mode change 100644 => 100755 lua/config/harpoon.lua mode change 100644 => 100755 lua/config/lualine.lua mode change 100644 => 100755 lua/config/mason.lua mode change 100644 => 100755 lua/config/nvim-cmp.lua mode change 100644 => 100755 lua/config/nvim-tree.lua mode change 100644 => 100755 lua/config/telescope.lua mode change 100644 => 100755 lua/config/theme.lua mode change 100644 => 100755 lua/config/themery.lua delete mode 100755 lua/custom/chadrc.lua delete mode 100755 lua/custom/configs/lspconfig.lua delete mode 100755 lua/custom/configs/null-ls.lua delete mode 100755 lua/custom/configs/overrides.lua delete mode 100755 lua/custom/highlights.lua delete mode 100755 lua/custom/mappings.lua delete mode 100644 lua/custom/options.lua delete mode 100755 lua/custom/plugins.lua create mode 100755 lua/dap_config.lua mode change 100644 => 100755 lua/keymaps.lua mode change 100644 => 100755 lua/lsp.lua mode change 100644 => 100755 lua/options.lua mode change 100644 => 100755 lua/plugins.lua mode change 100644 => 100755 requirements.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md old mode 100644 new mode 100755 diff --git a/.github/PULL_REQUEST_TEMPLATE/feature.md b/.github/PULL_REQUEST_TEMPLATE/feature.md old mode 100644 new mode 100755 diff --git a/.github/PULL_REQUEST_TEMPLATE/plugin.md b/.github/PULL_REQUEST_TEMPLATE/plugin.md old mode 100644 new mode 100755 diff --git a/.github/README.md b/.github/README.md old mode 100644 new mode 100755 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/init.lua b/init.lua old mode 100644 new mode 100755 index 2d43b1b..a0ecb65 --- a/init.lua +++ b/init.lua @@ -1,6 +1,4 @@ require("plugins") -require("colorscheme") -require("lsp") require("config.telescope") require("config.comment") require("config.mason") @@ -13,6 +11,10 @@ require("config.harpoon") require("config.autopairs") require("config.autotags") require("config.conform") +-- require("config.dapui") +require("colorscheme") require("options") require("keymaps") require("commands") +require("lsp") +require("dap_config") diff --git a/lazy-lock.json b/lazy-lock.json old mode 100644 new mode 100755 index ad25d33..dd31617 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,7 @@ { "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" }, + "catppuccin": { "branch": "main", "commit": "e1268d1c0351aa5a42ea00a680ce84de2ba080fc" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -11,25 +11,28 @@ "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, "git-blame.nvim": { "branch": "master", "commit": "50543e3993f4b996eea01ff5ccc8fe2a354c5388" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, - "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, "nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" }, - "nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" }, + "nvim-dap": { "branch": "master", "commit": "dcc85d12d6e2c18c5fa0f9a304d9f5e767e1401a" }, + "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, + "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, "nvim-grey": { "branch": "main", "commit": "b57f62baddc5a295bd0ffd61ff9a671a149df95a" }, - "nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" }, + "nvim-lspconfig": { "branch": "master", "commit": "81a19de18990208b678be084597613e2dbe66912" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-tree.lua": { "branch": "master", "commit": "48d0e82f9434691cc50d970898142a8c084a49d6" }, - "nvim-treesitter": { "branch": "master", "commit": "2d5133f67429f82547ea5fad33a0b1e7d4f78a1c" }, + "nvim-treesitter": { "branch": "master", "commit": "1aad04ecde5ebf8f2b3eea5c6f39d38b251757f5" }, "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, - "nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" }, + "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "themery.nvim": { "branch": "main", "commit": "f745a49d9c103babde35e1111b91faa6bc591d5c" }, "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, - "vscode-js-debug": { "branch": "main", "commit": "14b430024ccadd5e573228214a39fac7781bd759" } + "vscode-js-debug": { "branch": "main", "commit": "ca1c6450490dab5d742eac16a08d593533a1a13d" } } diff --git a/lua/colorscheme.lua b/lua/colorscheme.lua old mode 100644 new mode 100755 index a166fb5..b7b0527 --- a/lua/colorscheme.lua +++ b/lua/colorscheme.lua @@ -6,3 +6,11 @@ if not is_ok then vim.notify('colorscheme ' .. colorscheme .. ' not found!') return end + +vim.api.nvim_create_augroup('WinHighlight', {clear = true}) +vim.api.nvim_create_autocmd({'ColorScheme'}, { + group = 'WinHighlight', + callback = function() + vim.api.nvim_set_hl(0, 'VertSplit', {fg = '#ff0000'}) + end +}) diff --git a/lua/commands.lua b/lua/commands.lua old mode 100644 new mode 100755 diff --git a/lua/config/autopairs.lua b/lua/config/autopairs.lua old mode 100644 new mode 100755 diff --git a/lua/config/autotags.lua b/lua/config/autotags.lua old mode 100644 new mode 100755 diff --git a/lua/config/comment.lua b/lua/config/comment.lua old mode 100644 new mode 100755 diff --git a/lua/config/conform.lua b/lua/config/conform.lua old mode 100644 new mode 100755 diff --git a/lua/config/dap-ui.lua b/lua/config/dap-ui.lua new file mode 100755 index 0000000..361bc3f --- /dev/null +++ b/lua/config/dap-ui.lua @@ -0,0 +1,13 @@ +local dap, dapui = require("dap"), require("dapui") + +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 + +vim.keymap.set("n", "ui", require("dapui").toggle) diff --git a/lua/config/dap.lua b/lua/config/dap.lua deleted file mode 100644 index e1f7d4c..0000000 --- a/lua/config/dap.lua +++ /dev/null @@ -1,30 +0,0 @@ -require("dap-vscode-js").setup({ - -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node" - -- debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", -- Path to vscode-js-debug installation. - -- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`. - adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- 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. -}) - -for _, language in ipairs({ "typescript", "javascript" }) 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}", - } - } - } -end diff --git a/lua/config/dashboard.lua b/lua/config/dashboard.lua old mode 100644 new mode 100755 diff --git a/lua/config/fterm.lua b/lua/config/fterm.lua old mode 100644 new mode 100755 diff --git a/lua/config/harpoon.lua b/lua/config/harpoon.lua old mode 100644 new mode 100755 diff --git a/lua/config/lualine.lua b/lua/config/lualine.lua old mode 100644 new mode 100755 diff --git a/lua/config/mason.lua b/lua/config/mason.lua old mode 100644 new mode 100755 diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua old mode 100644 new mode 100755 diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua old mode 100644 new mode 100755 diff --git a/lua/config/telescope.lua b/lua/config/telescope.lua old mode 100644 new mode 100755 diff --git a/lua/config/theme.lua b/lua/config/theme.lua old mode 100644 new mode 100755 diff --git a/lua/config/themery.lua b/lua/config/themery.lua old mode 100644 new mode 100755 diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua deleted file mode 100755 index 32ed4b0..0000000 --- a/lua/custom/chadrc.lua +++ /dev/null @@ -1,70 +0,0 @@ ----@type ChadrcConfig -local M = {} - --- Path to overriding theme and highlights files -local highlights = require "custom.highlights" - -M.ui = { - theme = "catppuccin", - theme_toggle = { "catppuccin", "one_light" }, - - hl_override = highlights.override, - hl_add = highlights.add, - tabufline = { - enabled = false, - }, -} - -M.plugins = "custom.plugins" - -M.mappings = require "custom.mappings" - --- M.options = require "custom.options" -local opt = vim.opt -local api = vim.api --- line numbers -opt.number = true - --- tabs & indentation -opt.tabstop = 4 -opt.shiftwidth = 4 -opt.expandtab = true -opt.smartindent = true -opt.autoindent = true -opt.cindent = true -opt.softtabstop = 4 - --- lne wrapping -opt.wrap = false - --- search settings -opt.ignorecase = true -opt.smartcase = true - --- cursor line -opt.cursorline = true - --- backspace -opt.backspace = "indent,eol,start" - --- autoread -opt.autoread = true --- Function to set autocmd -local function set_autocmd(event, pattern, command) - vim.cmd(string.format("autocmd %s %s %s", event, pattern, command)) -end - --- Trigger 'checktime' on 'CursorHold' event -set_autocmd("CursorHold", "*", "checktime") - --- Show trailing whitespace -api.nvim_set_option("list", true) -api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<") - --- remove whitespace on save -api.nvim_create_autocmd({ "BufWritePre" }, { - pattern = { "*" }, - command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]], -}) - -return M diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua deleted file mode 100755 index 6558882..0000000 --- a/lua/custom/configs/lspconfig.lua +++ /dev/null @@ -1,24 +0,0 @@ -local on_attach = require("plugins.configs.lspconfig").on_attach -local capabilities = require("plugins.configs.lspconfig").capabilities - -local lspconfig = require "lspconfig" - --- if you just want default config for the servers then put them in a table -local servers = { - "html", - "cssls", - "tsserver", - "intelephense", - "pyright", - "tailwindcss", - "cssmodules_ls", - "emmet_ls", - "lua_ls", -} - -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = on_attach, - capabilities = capabilities, - } -end diff --git a/lua/custom/configs/null-ls.lua b/lua/custom/configs/null-ls.lua deleted file mode 100755 index bc857e4..0000000 --- a/lua/custom/configs/null-ls.lua +++ /dev/null @@ -1,33 +0,0 @@ ---------------------------------- --- Formatting ---------------------------------- -local diagnostics = require("null-ls").builtins.diagnostics -local formatting = require("null-ls").builtins.formatting -local code_actions = require("null-ls").builtins.code_actions -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - -require("null-ls").setup { - debug = true, - sources = { - formatting.black, - formatting.rustfmt, - formatting.prettier, - formatting.stylua, - diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" }, - diagnostics.eslint_d.with { diagnostics_format = "#{m} [#{c}]" }, - code_actions.eslint, - code_actions.eslint_d, - }, - on_attach = function(client, bufnr) - if client.supports_method "textDocument/formatting" then - vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr } - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format { bufnr = bufnr } - end, - }) - end - end, -} diff --git a/lua/custom/configs/overrides.lua b/lua/custom/configs/overrides.lua deleted file mode 100755 index 3d2b42c..0000000 --- a/lua/custom/configs/overrides.lua +++ /dev/null @@ -1,62 +0,0 @@ -local M = {} - -M.treesitter = { - ensure_installed = { - "lua", - "css", - "javascript", - "html", - "typescript", - "tsx", - }, - indent = { - enable = true, - }, - highlight = { - enable = true, - }, - autotag = { - enable = true, - }, - context_commentstring = { - enable = true, - }, -} - -M.mason = { - ensure_installed = { - -- lua stuff - "lua-language-server", - "stylua", - - -- web dev stuff - "html-lsp", - "json-lsp", - "typescript-language-server", - "deno", - "prettier", - "intelephense", - "tailwindcss", - "lua", - "prisma-language-server", - "graphql", - }, -} - --- git support in nvimtree -M.nvimtree = { - git = { - enable = true, - }, - - renderer = { - highlight_git = true, - icons = { - show = { - git = true, - }, - }, - }, -} - -return M diff --git a/lua/custom/highlights.lua b/lua/custom/highlights.lua deleted file mode 100755 index 5f88435..0000000 --- a/lua/custom/highlights.lua +++ /dev/null @@ -1,21 +0,0 @@ --- To find any highlight groups: " Telescope highlights" --- Each highlight group can take a table with variables fg, bg, bold, italic, etc --- base30 variable names can also be used as colors - -local M = {} - ----@type Base46HLGroupsList - -M.override = { - Comment = { - fg = "#8294c2", -- Lightened color - italic = true, - }, -} - ----@type HLTable -M.add = { - NvimTreeOpenedFolderName = { fg = "green", bold = true }, -} - -return M diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua deleted file mode 100755 index 5cb76c5..0000000 --- a/lua/custom/mappings.lua +++ /dev/null @@ -1,34 +0,0 @@ ----@type MappingsTable --- -local M = {} - -local opts = { noremap = true, silent = true } - -M.general = { - n = { - ["nh"] = { ":nohl", "nohl", opts }, - ["sv"] = { "s", "split window vertically", opts }, - ["sh"] = { "v", "split window horizontally", opts }, - ["se"] = { "=", "make split windows even width", opts }, - ["sx"] = { ":close", "close current split window", opts }, - ["tx"] = { ":tabclose", "close current tab", opts }, - ["e"] = { ":NvimTreeToggle", "nvim-tree", opts }, - ["ls"] = { ":LspStop", "LSP", opts }, - ["lo"] = { ":LspStart", "LSP", opts }, - ["cf"] = { ":NvimTreeCollapse", "nvim-tree", opts }, - }, - - x = { - ["J"] = { ":move '>+1gv-gv", "Move text up", opts }, - ["K"] = { ":move '<-2gv-gv", "Move text down", opts }, - [""] = { ":move '>+1gv-gv", "Move text up", opts }, - [""] = { ":move '<-2gv-gv", "Move text down", opts }, - }, - - i = { - ["C-j"] = { 'copilot#Accept("")', "Copilot accept", { silent = true, expr = true } }, - [""] = { "", "escape", opts }, - }, -} - -return M diff --git a/lua/custom/options.lua b/lua/custom/options.lua deleted file mode 100644 index 573332b..0000000 --- a/lua/custom/options.lua +++ /dev/null @@ -1,34 +0,0 @@ -local opt = vim.opt -local api = vim.api --- line numbers -opt.number = true - --- tabs & indentation -opt.tabstop = 4 -opt.shiftwidth = 4 -opt.expandtab = true -opt.autoindent = true -opt.softtabstop = 2 - --- lne wrapping -opt.wrap = false - --- search settings -opt.ignorecase = true -opt.smartcase = true - --- cursor line -opt.cursorline = true - --- backspace -opt.backspace = "indent,eol,start" - --- Show trailing whitespace -api.nvim_set_option("list", true) -api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<") - --- remove whitespace on save -api.nvim_create_autocmd({ "BufWritePre" }, { - pattern = { "*" }, - command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]], -}) diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua deleted file mode 100755 index 6be06f5..0000000 --- a/lua/custom/plugins.lua +++ /dev/null @@ -1,61 +0,0 @@ -local overrides = require "custom.configs.overrides" ----@type NvPluginSpec[] -local plugins = { - - { - "neovim/nvim-lspconfig", - dependencies = { - -- format & linting - { - "jose-elias-alvarez/null-ls.nvim", - config = function() - require "custom.configs.null-ls" - end, - }, - }, - config = function() - require "plugins.configs.lspconfig" - require "custom.configs.lspconfig" - end, -- Override to setup mason-lspconfig - }, - - { - "williamboman/mason.nvim", - opts = overrides.mason, - }, - - { - "nvim-treesitter/nvim-treesitter", - opts = overrides.treesitter, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - }, - config = function() - require("ts_context_commentstring").setup {} - end, - }, - - { - "nvim-tree/nvim-tree.lua", - opts = overrides.nvimtree, - }, - { - "github/copilot.vim", - lazy = false, - }, - { - "prettier/vim-prettier", - run = "yarn install", - }, - { - "windwp/nvim-ts-autotag", - lazy = false, - config = function() - require("nvim-ts-autotag").setup() - end, - }, - { "akinsho/git-conflict.nvim", version = "*", config = true, lazy = false }, - { "f-person/git-blame.nvim", lazy = false }, -} - -return plugins diff --git a/lua/dap_config.lua b/lua/dap_config.lua new file mode 100755 index 0000000..4ace150 --- /dev/null +++ b/lua/dap_config.lua @@ -0,0 +1,78 @@ +local dap, dapui = require("dap"), require("dapui") +require("dapui").setup() +-- -- Set keymaps to control the debugger +vim.keymap.set("n", "", dap.continue) +vim.keymap.set("n", "", dap.step_over) +vim.keymap.set("n", "", dap.step_into) +vim.keymap.set("n", "", dap.step_out) +vim.keymap.set("n", "b", dap.toggle_breakpoint) +vim.keymap.set("n", "B", function() + dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) +end) + +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", -- Path to vscode-js-debug installation. + -- 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. +}) + +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 + +dap.listeners.before.attach.dapui_config = function() + print("before attach") + dapui.open() +end +dap.listeners.before.launch.dapui_config = function() + print("before launch") + dapui.open() +end +dap.listeners.before.event_terminated.dapui_config = function() + print("before terminated") + dapui.close() +end +dap.listeners.before.event_exited.dapui_config = function() + print("before exited") + dapui.close() +end + +vim.keymap.set("n", "ui", require("dapui").toggle) diff --git a/lua/keymaps.lua b/lua/keymaps.lua old mode 100644 new mode 100755 index 243e2ae..672fb8c --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -39,6 +39,7 @@ local mappings = { [""] = "", -- Toggle word wrap ["w"] = "ToggleWrap", + -- Debugger }, x = { [""] = ":move '>+1gv-gv", diff --git a/lua/lsp.lua b/lua/lsp.lua old mode 100644 new mode 100755 diff --git a/lua/options.lua b/lua/options.lua old mode 100644 new mode 100755 diff --git a/lua/plugins.lua b/lua/plugins.lua old mode 100644 new mode 100755 index 64a58e8..f6855b7 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -83,16 +83,22 @@ require("lazy").setup({ }, "windwp/nvim-ts-autotag", "nvim-treesitter/nvim-treesitter", - { - "mfussenegger/nvim-dap", - opt = true, - run = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out", - }, - "jay-babu/mason-nvim-dap.nvim", - "microsoft/vscode-js-debug", { "stevearc/conform.nvim", opts = {}, }, "f-person/git-blame.nvim", + -- debugger stuff + "mfussenegger/nvim-dap", + + { + "mxsdev/nvim-dap-vscode-js", + dependencies = { + "microsoft/vscode-js-debug", + build = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out", + }, + }, + { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" } }, }) + +-- require('dap') diff --git a/requirements.md b/requirements.md old mode 100644 new mode 100755