Removed keymaps (LSP & DAP)

This commit is contained in:
mathijs-bakker
2025-09-15 11:55:20 +02:00
committed by Mathijs Bakker
parent 414ddb586e
commit d1ef31745f
5 changed files with 15 additions and 143 deletions

View File

@@ -3,7 +3,6 @@ local M = {}
function M.setup(config)
local dap = require("dap")
local dapui = require("dapui")
require("godotdev.keymaps").attach_dap()
dap.adapters.godot = {
type = "server",

View File

@@ -1,25 +1,20 @@
vim.api.nvim_create_autocmd("FileType", {
pattern = "gdscript",
callback = function()
vim.bo.expandtab = true
vim.bo.shiftwidth = 4
vim.bo.softtabstop = 4
vim.bo.tabstop = 4
vim.bo.autoindent = true
vim.bo.smartindent = true
end,
})
local config = require("godotdev").opts
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.gd",
callback = function()
if vim.fn.executable("gdformat") == 1 then
-- format with gdformat
vim.cmd("silent !gdformat %")
-- reload buffer if changed externally
vim.cmd("checktime")
else
vim.notify("gdformat not found in PATH. Run `:checkhealth godotdev` for more info.", vim.log.levels.WARN)
local exe = config.formatter_cmd or config.formatter
if vim.fn.executable(exe) ~= 1 then
vim.notify(exe .. " not found in PATH. Run `:checkhealth godotdev` for more info.", vim.log.levels.WARN)
return
end
if config.formatter == "gdformat" then
vim.cmd("silent !" .. exe .. " %")
elseif config.formatter == "gdscript-format" then
vim.cmd("silent !" .. exe .. " %")
end
vim.cmd("checktime")
end,
})

View File

@@ -1,82 +0,0 @@
local M = {}
function M.attach_lsp(bufnr)
local opts = { buffer = bufnr }
local has_telescope, telescope_builtin = pcall(require, "telescope.builtin")
local function map(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, vim.tbl_extend("force", opts, { desc = desc }))
end
-- Definitions / Declarations
map("n", "gd", has_telescope and telescope_builtin.lsp_definitions or vim.lsp.buf.definition, "LSP: Go to definition")
map("n", "gD", vim.lsp.buf.declaration, "LSP: Go to declaration")
map(
"n",
"gy",
has_telescope and telescope_builtin.lsp_type_definitions or vim.lsp.buf.type_definition,
"LSP: Type definition"
)
map(
"n",
"gi",
has_telescope and telescope_builtin.lsp_implementations or vim.lsp.buf.implementation,
"LSP: Go to implementation"
)
map("n", "gr", has_telescope and telescope_builtin.lsp_references or vim.lsp.buf.references, "LSP: List references")
-- Info
map("n", "K", vim.lsp.buf.hover, "LSP: Hover documentation")
map("n", "<C-k>", vim.lsp.buf.signature_help, "LSP: Signature help")
-- Symbols
map(
"n",
"<leader>ds",
has_telescope and telescope_builtin.lsp_document_symbols or vim.lsp.buf.document_symbol,
"LSP: Document symbols"
)
map(
"n",
"<leader>ws",
has_telescope and telescope_builtin.lsp_dynamic_workspace_symbols or vim.lsp.buf.workspace_symbol,
"LSP: Workspace symbols"
)
-- Actions
map("n", "<leader>rn", vim.lsp.buf.rename, "LSP: Rename symbol")
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, "LSP: Code action")
map("n", "<leader>f", function()
vim.lsp.buf.format({ async = true })
end, "LSP: Format buffer")
-- Diagnostics
map("n", "gl", vim.diagnostic.open_float, "LSP: Show diagnostics")
map("n", "[d", vim.diagnostic.goto_prev, "LSP: Previous diagnostic")
map("n", "]d", vim.diagnostic.goto_next, "LSP: Next diagnostic")
end
function M.attach_dap()
local dap = require("dap")
local dapui = require("dapui")
local function map(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { desc = desc })
end
-- Basic debugger controls
map("n", "<F5>", dap.continue, "DAP: Continue/Start")
map("n", "<F10>", dap.step_over, "DAP: Step over")
map("n", "<F11>", dap.step_into, "DAP: Step into")
map("n", "<F12>", dap.step_out, "DAP: Step out")
map("n", "<leader>db", dap.toggle_breakpoint, "DAP: Toggle breakpoint")
map("n", "<leader>dB", function()
dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
end, "DAP: Conditional breakpoint")
-- UI
map("n", "<leader>du", dapui.toggle, "DAP: Toggle UI")
map("n", "<leader>dr", dap.repl.open, "DAP: Open REPL")
end
return M

View File

@@ -4,7 +4,6 @@ M.setup = function(config)
config = config or {}
local lspconfig = require("lspconfig")
local utils = require("godotdev.utils")
local keymaps = require("godotdev.keymaps")
local host = config.editor_host or "127.0.0.1"
local port = config.editor_port or 6005
@@ -29,7 +28,6 @@ M.setup = function(config)
capabilities = capabilities,
on_attach = function(client, bufnr)
utils.suppress_unsupported_lsp_messages(client, { "Method not found: godot/reloadScript" })
keymaps.attach_lsp(bufnr)
end,
})
end