From 8e7f26d1c9e8554b3b9acbfa3640057d29f09bd8 Mon Sep 17 00:00:00 2001 From: fm39hz-laptop Date: Fri, 28 Jun 2024 14:37:49 +0700 Subject: [PATCH] feat: add C# plugins --- lazy-lock.json | 1 + lua/config/autocmds.lua | 15 +++++++++++++++ lua/plugins/development.lua | 23 +++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/lazy-lock.json b/lazy-lock.json index 0f7adb8..e1f8beb 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -14,6 +14,7 @@ "codesnap.nvim": { "branch": "main", "commit": "a223fd882953e56ae1a8747fdc44b8d6a2ff7a9b" }, "compiler.nvim": { "branch": "main", "commit": "4ad0395994f374e6c797266ea4acca90927f19aa" }, "conform.nvim": { "branch": "master", "commit": "c26dadf8a47a547768d1048a0d698ecec33494ce" }, + "csharp.nvim": { "branch": "main", "commit": "48d72dfad26177295744d6da958f1dc08046a9d9" }, "dial.nvim": { "branch": "master", "commit": "750f802879c90ea51f92b68c35fa562ee575804a" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, "edgy.nvim": { "branch": "main", "commit": "a8bc1d24798c80a391f1a5d898a50c41a7f93883" }, diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index a82fedb..025d3d6 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -10,3 +10,18 @@ vim.api.nvim_create_autocmd("User", { vim.api.nvim_win_set_config(win_id, { border = "rounded" }) end, }) +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ timeout = 1000, async = false }) + if vim.bo[0].filetype == "cs" then + require("csharp").fix_usings() + end + end, + }) + end, +}) diff --git a/lua/plugins/development.lua b/lua/plugins/development.lua index cc8a28a..e473983 100644 --- a/lua/plugins/development.lua +++ b/lua/plugins/development.lua @@ -34,6 +34,9 @@ return { require("telescope").load_extension("import") end, }, + { + "Tastyep/structlog.nvim", + }, -- TS / JS { "dmmulroy/tsc.nvim", @@ -72,7 +75,27 @@ return { "typescriptreact", }, }, + -- C# { + "iabdelkareem/csharp.nvim", + ft = "cs", + keys = { + { + "", + function() + require("csharp").debug_project() + end, + { desc = "C# debug project", noremap = true, nowait = true }, + }, }, + dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", + "Tastyep/structlog.nvim", + }, + config = function() + require("mason").setup() + require("csharp").setup() + end, }, }