Some more jdtls and dap config changes
parent
3b16716986
commit
259a009602
|
|
@ -1,6 +1,5 @@
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
local jdtls = require("jdtls")
|
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
local telescope = require("telescope.builtin")
|
local telescope = require("telescope.builtin")
|
||||||
local comment_api = require("Comment.api")
|
local comment_api = require("Comment.api")
|
||||||
|
|
@ -16,11 +15,6 @@ map({ "n", "v", "x" }, "<Del>", '"_x')
|
||||||
-- filthy casual save keybind
|
-- filthy casual save keybind
|
||||||
map({ "n", "i", "v" }, "<C-s>", function()
|
map({ "n", "i", "v" }, "<C-s>", function()
|
||||||
vim.cmd("w")
|
vim.cmd("w")
|
||||||
local has_dap_session = dap.session() ~= nil
|
|
||||||
-- If jdtls is available and dap is running also run the hotcode swap automatically
|
|
||||||
if jdtls and has_dap_session then
|
|
||||||
vim.cmd("JdtUpdateHotcode")
|
|
||||||
end
|
|
||||||
end, { desc = "File Save" })
|
end, { desc = "File Save" })
|
||||||
-- easy way to close the current buffer
|
-- easy way to close the current buffer
|
||||||
map("n", "<C-X>", "<cmd>bd!<cr>", { desc = "Close Buffer" })
|
map("n", "<C-X>", "<cmd>bd!<cr>", { desc = "Close Buffer" })
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,31 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
|
||||||
|
-- dap.listeners.before.launch.build = function(session)
|
||||||
|
-- local config = session.config
|
||||||
|
--
|
||||||
|
-- if config.preLaunchTask == "prepareRunClientCompile" then
|
||||||
|
-- vim.system({ "./gradlew", "prepareRunClientCompile" }):wait()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- No I'm not gonna fucking use overseer just to run a fucking script
|
||||||
|
local orig_run = dap.run
|
||||||
|
dap.run = function(config)
|
||||||
|
vim.notify("Running task " .. config.preLaunchTask)
|
||||||
|
if config.preLaunchTask == "prepareRunClientCompile" then
|
||||||
|
vim.system({ "./gradlew", "prepareRunClientCompile" }, {}, function()
|
||||||
|
vim.schedule(function()
|
||||||
|
orig_run(config)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
orig_run(config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,19 @@ return {
|
||||||
|
|
||||||
root_dir = vim.fs.root(0, { "gradlew", ".git", "mvnw" }),
|
root_dir = vim.fs.root(0, { "gradlew", ".git", "mvnw" }),
|
||||||
|
|
||||||
|
on_attach = function(_, _)
|
||||||
|
require("jdtls").setup_dap({ hotcodereplace = "auto" })
|
||||||
|
require("jdtls.dap").setup_dap_main_class_configs()
|
||||||
|
end,
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
java = {
|
java = {
|
||||||
|
autobuild = { enabled = true },
|
||||||
|
|
||||||
|
configuration = {
|
||||||
|
updateBuildConfiguration = "interactive",
|
||||||
|
},
|
||||||
|
|
||||||
format = {
|
format = {
|
||||||
enable = false,
|
enable = false,
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -75,6 +86,27 @@ return {
|
||||||
profile = "GoogleStyle",
|
profile = "GoogleStyle",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveActions = {
|
||||||
|
-- organizeImports = true,
|
||||||
|
cleanup = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup = {
|
||||||
|
actions = {
|
||||||
|
"addOverride",
|
||||||
|
"addDeprecated",
|
||||||
|
"qualifyMembers",
|
||||||
|
"qualifyStaticMembers",
|
||||||
|
-- "addFinalModifier",
|
||||||
|
"lambdaExpression",
|
||||||
|
"lambdaExpressionFromAnonymousClass",
|
||||||
|
"switchExpression",
|
||||||
|
"stringConcatToTextBlock",
|
||||||
|
"instanceofPatternMatch",
|
||||||
|
"useSwitchForInstanceofPattern",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue