Skip to content

Commit

Permalink
feat(pack): add csharp support with omnisharp (#1241)
Browse files Browse the repository at this point in the history
feat(cs-omnisharp): add csharp support with omnisharp
  • Loading branch information
ahmtsen authored and mehalter committed Nov 7, 2024
1 parent 7a86fad commit 9c67bb9
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/astrocommunity/pack/cs-omnisharp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# C# Language Pack

**Requirements:** `dotnet` must be in your `PATH` and executable

This plugin pack does the following:

- Adds `c_sharp` Treesitter parsers
- Adds `omnisharp` language server
- Adds [`omnisharp-extended-lsp.nvim`](https://github.com/Hoffs/omnisharp-extended-lsp.nvim) for better go to definition/type definition
- Adds the following `null-ls` sources:
- [csharpier](https://github.com/belav/csharpier)
- Adds `coreclr` debug adapters for nvim-dap
74 changes: 74 additions & 0 deletions lua/astrocommunity/pack/cs-omnisharp/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
return {
-- CSharp support
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "c_sharp" })
end
end,
},
{
"jay-babu/mason-null-ls.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "csharpier" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "omnisharp" })
end,
},
{
"Hoffs/omnisharp-extended-lsp.nvim",
dependencies = {
{
"AstroNvim/astrolsp",
opts = {
config = {
csharp_ls = {
handlers = {
["textDocument/definition"] = function(...) require("omnisharp_extended").definition_handler(...) end,
["textDocument/typeDefinition"] = function(...)
require("omnisharp_extended").type_definition_handler(...)
end,
["textDocument/references"] = function(...) require("omnisharp_extended").references_handler(...) end,
["textDocument/implementation"] = function(...)
require("omnisharp_extended").implementation_handler(...)
end,
},
},
},
},
},
},
},
{
"jay-babu/mason-nvim-dap.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "coreclr" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "omnisharp", "csharpier", "netcoredbg" })
end,
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = { "Issafalcon/neotest-dotnet", config = function() end },
opts = function(_, opts)
if not opts.adapters then opts.adapters = {} end
table.insert(opts.adapters, require "neotest-dotnet"(require("astrocore").plugin_opts "neotest-dotnet"))
end,
},
}

0 comments on commit 9c67bb9

Please sign in to comment.