From d0f33b167553fa15b640d61ca37d650dc8325669 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Tue, 6 Feb 2024 11:19:52 +0100 Subject: [PATCH 1/5] lsp telecsope things --- lua/custom/chadrc.lua | 4 ++-- lua/custom/mappings.lua | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 074bd3e..7e7dc46 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -5,8 +5,8 @@ local M = {} local highlights = require "custom.highlights" M.ui = { - theme = "kanagawa", - theme_toggle = { "kanagawa", "chadracula" }, + theme = "oceanic-next", + theme_toggle = { "kanagawa", "oceanic-next" }, hl_override = highlights.override, hl_add = highlights.add, diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua index efbbd2b..42a15d1 100644 --- a/lua/custom/mappings.lua +++ b/lua/custom/mappings.lua @@ -219,6 +219,10 @@ M.telescope = { ["th"] = { " Telescope themes ", "Nvchad themes" }, ["ma"] = { " Telescope marks ", "telescope bookmarks" }, + + -- lsp stuff + ["cw"] = { " Telescope lsp_dynamic_workspace_symbols ", "telescope dynamic workspace symbols" }, + ["cd"] = { " Telescope lsp_document_symbols ", "telescope document symbols" }, }, } From 2c779d1ed405266c34a0251ba963059a2dba5431 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Tue, 6 Feb 2024 12:30:32 +0100 Subject: [PATCH 2/5] rust_analyzer in lspconfig again --- lua/custom/configs/lspconfig.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua index e180978..88b5536 100644 --- a/lua/custom/configs/lspconfig.lua +++ b/lua/custom/configs/lspconfig.lua @@ -10,7 +10,7 @@ local servers = { "tsserver", "clangd", "pyright", - -- "rust_analyzer", + "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration! "bashls", "cmake", } From c7bbbf1a7715706423616ffd777872603abdb9cf Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Tue, 6 Feb 2024 13:13:01 +0100 Subject: [PATCH 3/5] DBG WORKS WITH STDOUT!!! --- lua/custom/plugins.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index 465b971..b63a311 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -735,7 +735,6 @@ local plugins = { end, config = function() local dap = require "dap" - local rustcfg = require "rustaceanvim.config" local mason_registry = require "mason-registry" local codelldb_root = mason_registry.get_package("codelldb"):get_install_path() .. "/extension/" local codelldb_path = codelldb_root .. "adapter/codelldb" @@ -744,12 +743,12 @@ local plugins = { command = "/home/plex/.local/bin/kitty", args = {}, } - dap.adapters.lldb = { + dap.adapters.codelldb = { type = "server", - port = "${port}", + port = "30333", executable = { command = codelldb_path, - args = { "--port", "${port}" }, + args = { "--port", "30333" }, detached = false, }, } @@ -766,7 +765,7 @@ local plugins = { }, } dap.configurations.c = dap.configurations.cpp - -- dap.configurations.rust = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp end, }, { @@ -795,6 +794,7 @@ local plugins = { { "folke/neodev.nvim", opts = {} }, { "mrcjkb/rustaceanvim", + enabled = true, version = "^4", -- Recommended ft = { "rust" }, }, @@ -803,6 +803,28 @@ local plugins = { lazy = false, -- PERF: this can be done more elegant config = function() require("nvim-dap-virtual-text").setup() + local dap = require "dap" + vim.g.rustaceanvim = { + -- Plugin configuration + tools = {}, + -- LSP configuration + server = { + on_attach = function(client, bufnr) + -- you can also put keymaps in here + end, + settings = { + -- rust-analyzer language server configuration + ["rust-analyzer"] = {}, + }, + }, + -- DAP configuration + dap = { + -- FIXME: the rustaceanvim debug config does not map the stdout/stderr to the + -- opened terminal, effectively rendering debugging with it useless. Luckily, + -- we can use the regular nvim-dap and nvim-dap-ui. + adapter = dap.adapters.codelldb, + }, + } end, }, } From dea2aeeb137caafcafd0ad5e08310ae74abf078b Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 7 Feb 2024 11:51:52 +0100 Subject: [PATCH 4/5] mini debug things --- lua/custom/plugins.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index b63a311..578279c 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -743,6 +743,11 @@ local plugins = { command = "/home/plex/.local/bin/kitty", args = {}, } + dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "-i", "dap" }, + } dap.adapters.codelldb = { type = "server", port = "30333", @@ -761,6 +766,7 @@ local plugins = { return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, cwd = "${workspaceFolder}", + -- FIXME: perhaps we can put the stdio somewhere more practical stopOnEntry = false, }, } @@ -784,10 +790,10 @@ local plugins = { dapui.open {} end dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close {} + -- dapui.close {} end dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close {} + -- dapui.close {} end end, }, From 3d3c415db620d726df3aa01cf9edc316104c0b75 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 7 Feb 2024 13:38:16 +0100 Subject: [PATCH 5/5] error notify --- lua/custom/plugins.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index 578279c..d9173a1 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -347,7 +347,9 @@ local plugins = { }, messages = { enabled = true, - view_error = "messages", -- so it does not spam boxes with errors + -- NOTE: we keep it with notify, + -- change this to something else if you want + view_error = "notify", }, popupmenu = { enabled = true,