From 040375e338fc4a64adae16cec231517bad7c3392 Mon Sep 17 00:00:00 2001 From: Nigel Barink Date: Thu, 28 Mar 2024 21:45:53 +0100 Subject: [PATCH] FEAT: Added Debugger Adapter Protocol Paths are setup for my main Windows machine Linux can be defined when necessary --- after/ftplugin/java.lua | 24 ++++++++++++++++++++++++ lazy-lock.json | 14 +++++++++----- lua/barink/plugins/dap.lua | 28 ++++++++++++++++++++++++++++ lua/barink/plugins/lsp.lua | 1 + 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 after/ftplugin/java.lua create mode 100644 lua/barink/plugins/dap.lua diff --git a/after/ftplugin/java.lua b/after/ftplugin/java.lua new file mode 100644 index 0000000..3af7acd --- /dev/null +++ b/after/ftplugin/java.lua @@ -0,0 +1,24 @@ +--[[ +-- Only setup for windows +-- Don't know if all this is actually necessary +-- TODO: FIX: Clean this mess up ~ 03/28/2024 +--]] +if vim.loop.os_uname().sysname == 'Windows_NT' then + Cmd = 'c:/Users/nigel/Appdata/Local/nvim-data/mason/bin/jdtls.cmd' + JavaDebug = vim.fn.glob("C:/Users/nigel/AppData/Local/nvim-data/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-0.52.0.jar", 1) +else + Cmd = '' + JavaDebug = nil +end +local config = { + cmd = {Cmd}, + root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), + init_options = { + bundles = { + JavaDebug + } + } +} +require('jdtls').start_or_attach(config) +require('jdtls').setup_dap({hotcodreplace='auto'}) +require('jdtls.dap').setup_dap_main_class_configs() diff --git a/lazy-lock.json b/lazy-lock.json index 9662754..9000217 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,18 +6,22 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "fidget.nvim": { "branch": "main", "commit": "933db4596e4bab1b09b6d48a10e21819e4cc458f" }, "harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" }, - "lazy.nvim": { "branch": "main", "commit": "08954f723bf2d442ea020551e3acc956f4dc6dc7" }, + "lazy.nvim": { "branch": "main", "commit": "0ccf0312270d2d976ec551a9034bf05720f2486b" }, "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, "mason-lspconfig": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" }, + "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, + "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, + "nvim-jdtls": { "branch": "master", "commit": "8eb5f0dbe6e126b392ddcaf45893358619893e45" }, "nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" }, - "nvim-treesitter": { "branch": "master", "commit": "7f3179315959bd762abd0f8dbe0361db805fb2d4" }, + "nvim-nio": { "branch": "master", "commit": "33c62b3eadd8154169e42144de16ba4db6784bec" }, + "nvim-treesitter": { "branch": "master", "commit": "23ba63028c6acca29be6462c0a291fc4a1b9eae8" }, "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" }, "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope.nvim": { "branch": "master", "commit": "c2b8311dfacd08b3056b8f0249025d633a4e71a8" }, - "tokyonight.nvim": { "branch": "main", "commit": "f4b415bfbce390866a83277db42cf6aa94230728" }, + "telescope.nvim": { "branch": "master", "commit": "b22e6f6896cd64b109bd0807a24098d225d5fb49" }, + "tokyonight.nvim": { "branch": "main", "commit": "71597b108aea89362fc99d7a5e78bba2f9870bf6" }, "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, - "vim-fugitive": { "branch": "master", "commit": "193ba9b393931bad768c1d2eed688b0bcc240858" } + "vim-fugitive": { "branch": "master", "commit": "2377e16e6641418565b934990cf49068855987c6" } } \ No newline at end of file diff --git a/lua/barink/plugins/dap.lua b/lua/barink/plugins/dap.lua new file mode 100644 index 0000000..9880737 --- /dev/null +++ b/lua/barink/plugins/dap.lua @@ -0,0 +1,28 @@ +return { + { + 'mfussenegger/nvim-dap', + dependencies = { + { + 'rcarriga/nvim-dap-ui', + dependencies = { + 'mfussenegger/nvim-dap', + 'nvim-neotest/nvim-nio', + }, + config = function () + require("dapui").setup() + end + }, + }, + config = function () + local dap = require('dap') + dap.configurations.java = { + { + type = 'java'; + request = 'launch'; + name = "Launch file"; + program = "java ${file}"; + }, + } + end + } +} diff --git a/lua/barink/plugins/lsp.lua b/lua/barink/plugins/lsp.lua index 8e99bc3..97b72dc 100644 --- a/lua/barink/plugins/lsp.lua +++ b/lua/barink/plugins/lsp.lua @@ -10,6 +10,7 @@ return "hrsh7th/cmp-cmdline", "hrsh7th/nvim-cmp", 'L3MON4D3/LuaSnip', + {'mfussenegger/nvim-jdtls', dependencies = {'nvim-dap'}}, }, config = function() require("mason").setup()