add dotnet config
This commit is contained in:
parent
a61afa3889
commit
f366de91bf
@ -30,6 +30,7 @@ keymap("n", "<leader>ff", "<cmd>Telescope find_files<CR>", opts)
|
||||
keymap("n", "<leader>fg", "<cmd>Telescope live_grep<CR>", opts)
|
||||
keymap("n", "<leader>fb", "<cmd>Telescope buffers<CR>", opts)
|
||||
keymap("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", opts)
|
||||
keymap("n", "<leader>fr", "<cmd>Telescope frecency<CR>", opts)
|
||||
|
||||
-- Trouble
|
||||
keymap("n", "<leader>xx", "<cmd>TroubleToggle<CR>", opts)
|
||||
@ -63,4 +64,3 @@ vim.keymap.set("n", "<leader>ct", "<cmd>ChatGPTTests<CR>", { desc = "Generate te
|
||||
vim.keymap.set("v", "<leader>ce", "<cmd>ChatGPTExplain<CR>", { desc = "Explain selection" })
|
||||
vim.keymap.set("v", "<leader>cf", "<cmd>ChatGPTFix<CR>", { desc = "Fix selection" })
|
||||
vim.keymap.set("v", "<leader>co", "<cmd>ChatGPTOptimize<CR>", { desc = "Optimize selection" })
|
||||
|
||||
|
||||
@ -64,4 +64,10 @@ vim.lsp.config("rust_analyzer", {
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.enable({"rust_analyzer"})
|
||||
-- .NET LSP (Neovim 0.11+)
|
||||
vim.lsp.config.csharp_ls = {
|
||||
root_markers = { "*.sln", "*.csproj", ".git" },
|
||||
filetypes = { "cs" },
|
||||
}
|
||||
|
||||
vim.lsp.enable({"rust_analyzer", "csharp_ls"})
|
||||
|
||||
43
dot_config/nvim/lua/lang/dotnet.lua
Normal file
43
dot_config/nvim/lua/lang/dotnet.lua
Normal file
@ -0,0 +1,43 @@
|
||||
local ok_dap, dap = pcall(require, "dap")
|
||||
if not ok_dap then return end
|
||||
|
||||
-- netcoredbg adapter (installed via Mason)
|
||||
local mason_path = vim.fn.stdpath("data") .. "/mason"
|
||||
local netcoredbg_path = mason_path .. "/packages/netcoredbg/netcoredbg"
|
||||
|
||||
dap.adapters.coreclr = {
|
||||
type = "executable",
|
||||
command = netcoredbg_path,
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
local function dotnet_build_and_get_dll()
|
||||
local cwd = vim.fn.getcwd()
|
||||
vim.fn.system("dotnet build " .. cwd)
|
||||
-- Heuristic: pick first dll in bin/Debug
|
||||
local dll = vim.fn.glob(cwd .. "/**/bin/Debug/**/**.dll", 1, 1)[1]
|
||||
return dll
|
||||
end
|
||||
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = "coreclr",
|
||||
name = "Debug (netcoredbg)",
|
||||
request = "launch",
|
||||
program = function()
|
||||
local dll = dotnet_build_and_get_dll()
|
||||
return vim.fn.input("Path to dll: ", dll or (vim.fn.getcwd() .. "/bin/Debug/"), "file")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local function dotnet_to_quickfix(cmd)
|
||||
local output = vim.fn.systemlist(cmd)
|
||||
vim.fn.setqflist({}, " ", { title = cmd, lines = output })
|
||||
vim.cmd("copen")
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>nr", function() dotnet_to_quickfix("dotnet run") end, { desc = "dotnet run" })
|
||||
vim.keymap.set("n", "<leader>nb", function() dotnet_to_quickfix("dotnet build") end, { desc = "dotnet build" })
|
||||
vim.keymap.set("n", "<leader>nt", function() dotnet_to_quickfix("dotnet test") end, { desc = "dotnet test" })
|
||||
|
||||
@ -21,7 +21,7 @@ return require("packer").startup(function(use)
|
||||
after = "mason.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {"rust_analyzer" -- Add more later: "ts_ls", "gopls", "pyright", ...
|
||||
ensure_installed = {"rust_analyzer", "csharp_ls" -- Add more later: "ts_ls", "gopls", "pyright", ...
|
||||
},
|
||||
automatic_installation = true
|
||||
})
|
||||
@ -46,10 +46,28 @@ return require("packer").startup(function(use)
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = {"nvim-lua/plenary.nvim"},
|
||||
config = function()
|
||||
require("telescope").setup({})
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
frecency = {
|
||||
show_scores = false,
|
||||
show_unindexed = true,
|
||||
ignore_patterns = {"*/.git/*", "*/node_modules/*", "*/.cache/*"}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
use({
|
||||
"nvim-telescope/telescope-frecency.nvim",
|
||||
requires = {"tami5/sqlite.lua"},
|
||||
after = "telescope.nvim",
|
||||
config = function()
|
||||
require("telescope").load_extension("frecency")
|
||||
end
|
||||
})
|
||||
use({"tami5/sqlite.lua"})
|
||||
|
||||
-- Trouble (diagnostics list)
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
@ -62,6 +80,20 @@ return require("packer").startup(function(use)
|
||||
-- Formatting (conform)
|
||||
use({"stevearc/conform.nvim"})
|
||||
|
||||
-- Session persistence
|
||||
use({
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
require("auto-session").setup({
|
||||
log_level = "error",
|
||||
auto_session_root_dir = vim.fn.stdpath("data") .. "/sessions/",
|
||||
auto_restore_enabled = true,
|
||||
auto_save_enabled = true,
|
||||
sessionoptions = "buffers,curdir,tabpages,winsize,globals"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
-- Debugging
|
||||
-- Debugging
|
||||
use("mfussenegger/nvim-dap")
|
||||
@ -126,4 +158,5 @@ return require("packer").startup(function(use)
|
||||
})
|
||||
|
||||
use("github/copilot.vim")
|
||||
use("stevearc/conform.nvim")
|
||||
end)
|
||||
|
||||
21
dot_config/nvim/plugin/conform.lua
Normal file
21
dot_config/nvim/plugin/conform.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local ok, conform = pcall(require, "conform")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
conform.setup({
|
||||
format_on_save = function(_)
|
||||
return {
|
||||
timeout_ms = 2000,
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
rust = { "rustfmt" },
|
||||
cs = { "csharpier" }, -- for .NET (optional, requires csharpier installed)
|
||||
lua = { "stylua" },
|
||||
json = { "jq" },
|
||||
yaml = { "yamlfmt" },
|
||||
markdown = { "prettier" },
|
||||
},
|
||||
})
|
||||
@ -84,6 +84,12 @@ _G.packer_plugins = {
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["auto-session"] = {
|
||||
config = { "\27LJ\2\n<EFBFBD>\2\0\0\6\0\n\0\0156\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0006\3\4\0009\3\5\0039\3\6\3'\5\a\0B\3\2\2'\4\b\0&\3\4\3=\3\t\2B\0\2\1K\0\1\0\26auto_session_root_dir\15/sessions/\tdata\fstdpath\afn\bvim\1\0\5\19sessionoptions,buffers,curdir,tabpages,winsize,globals\22auto_save_enabled\2\25auto_restore_enabled\2\26auto_session_root_dir\0\14log_level\nerror\nsetup\17auto-session\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/auto-session",
|
||||
url = "https://github.com/rmagatti/auto-session"
|
||||
},
|
||||
["bufferline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
|
||||
@ -130,7 +136,7 @@ _G.packer_plugins = {
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
config = { "\27LJ\2\n™\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\27automatic_installation\2\21ensure_installed\0\1\2\0\0\18rust_analyzer\nsetup\20mason-lspconfig\frequire\0" },
|
||||
config = { "\27LJ\2\n£\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\21ensure_installed\0\27automatic_installation\2\1\3\0\0\18rust_analyzer\14csharp_ls\nsetup\20mason-lspconfig\frequire\0" },
|
||||
load_after = {},
|
||||
loaded = true,
|
||||
needs_bufread = false,
|
||||
@ -221,8 +227,18 @@ _G.packer_plugins = {
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["sqlite.lua"] = {
|
||||
loaded = true,
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/sqlite.lua",
|
||||
url = "https://github.com/tami5/sqlite.lua"
|
||||
},
|
||||
["telescope-frecency.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/telescope-frecency.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-frecency.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14telescope\frequire\0" },
|
||||
config = { "\27LJ\2\n”\2\0\0\6\0\v\0\0196\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\b\0005\3\6\0005\4\3\0005\5\4\0=\5\5\4=\4\a\3=\3\t\2B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\n\0'\2\a\0B\0\2\1K\0\1\0\19load_extension\15extensions\1\0\1\15extensions\0\rfrecency\1\0\1\rfrecency\0\20ignore_patterns\1\4\0\0\r*/.git/*\21*/node_modules/*\15*/.cache/*\1\0\3\20ignore_patterns\0\19show_unindexed\2\16show_scores\1\nsetup\14telescope\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/wann/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
@ -251,10 +267,14 @@ _G.packer_plugins = {
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: telescope.nvim
|
||||
time([[Config for telescope.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14telescope\frequire\0", "config", "telescope.nvim")
|
||||
time([[Config for telescope.nvim]], false)
|
||||
-- Config for: trouble.nvim
|
||||
time([[Config for trouble.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
|
||||
time([[Config for trouble.nvim]], false)
|
||||
-- Config for: auto-session
|
||||
time([[Config for auto-session]], true)
|
||||
try_loadstring("\27LJ\2\n<EFBFBD>\2\0\0\6\0\n\0\0156\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0006\3\4\0009\3\5\0039\3\6\3'\5\a\0B\3\2\2'\4\b\0&\3\4\3=\3\t\2B\0\2\1K\0\1\0\26auto_session_root_dir\15/sessions/\tdata\fstdpath\afn\bvim\1\0\5\19sessionoptions,buffers,curdir,tabpages,winsize,globals\22auto_save_enabled\2\25auto_restore_enabled\2\26auto_session_root_dir\0\14log_level\nerror\nsetup\17auto-session\frequire\0", "config", "auto-session")
|
||||
time([[Config for auto-session]], false)
|
||||
-- Config for: nvim-dap-ui
|
||||
time([[Config for nvim-dap-ui]], true)
|
||||
try_loadstring("\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\ndapui\frequire\0", "config", "nvim-dap-ui")
|
||||
@ -263,16 +283,16 @@ time([[Config for nvim-dap-ui]], false)
|
||||
time([[Config for mason.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\nmason\frequire\0", "config", "mason.nvim")
|
||||
time([[Config for mason.nvim]], false)
|
||||
-- Config for: trouble.nvim
|
||||
time([[Config for trouble.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
|
||||
time([[Config for trouble.nvim]], false)
|
||||
-- Config for: telescope.nvim
|
||||
time([[Config for telescope.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n”\2\0\0\6\0\v\0\0196\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\b\0005\3\6\0005\4\3\0005\5\4\0=\5\5\4=\4\a\3=\3\t\2B\0\2\0016\0\0\0'\2\1\0B\0\2\0029\0\n\0'\2\a\0B\0\2\1K\0\1\0\19load_extension\15extensions\1\0\1\15extensions\0\rfrecency\1\0\1\rfrecency\0\20ignore_patterns\1\4\0\0\r*/.git/*\21*/node_modules/*\15*/.cache/*\1\0\3\20ignore_patterns\0\19show_unindexed\2\16show_scores\1\nsetup\14telescope\frequire\0", "config", "telescope.nvim")
|
||||
time([[Config for telescope.nvim]], false)
|
||||
-- Load plugins in order defined by `after`
|
||||
time([[Sequenced loading]], true)
|
||||
vim.cmd [[ packadd mason-lspconfig.nvim ]]
|
||||
|
||||
-- Config for: mason-lspconfig.nvim
|
||||
try_loadstring("\27LJ\2\n™\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\27automatic_installation\2\21ensure_installed\0\1\2\0\0\18rust_analyzer\nsetup\20mason-lspconfig\frequire\0", "config", "mason-lspconfig.nvim")
|
||||
try_loadstring("\27LJ\2\n£\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\21ensure_installed\1\0\2\21ensure_installed\0\27automatic_installation\2\1\3\0\0\18rust_analyzer\14csharp_ls\nsetup\20mason-lspconfig\frequire\0", "config", "mason-lspconfig.nvim")
|
||||
|
||||
time([[Sequenced loading]], false)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user