Omnisharp
info
You can enable the extra with the :LazyExtras
command.
Plugins marked as optional will only be configured if they are installed.
Alternatively, you can add it to your lazy.nvim
imports
lua/config/lazy.lua
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.omnisharp" },
{ import = "plugins" },
},
})
Below you can find a list of included plugins and their default settings.
caution
You don't need to copy the default settings to your config. They are only shown here for reference.
omnisharp-extended-lsp.nvim
- Options
- Full Spec
opts = nil
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true }
nvim-treesitter
- Options
- Full Spec
opts = { ensure_installed = { "c_sharp" } }
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "c_sharp" } },
}
mason.nvim
- Options
- Full Spec
opts = { ensure_installed = { "csharpier", "netcoredbg" } }
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "csharpier", "netcoredbg" } },
}
nvim-lspconfig
- Options
- Full Spec
opts = {
servers = {
omnisharp = {
handlers = {
["textDocument/definition"] = function(...)
return require("omnisharp_extended").handler(...)
end,
},
keys = {
{
"gd",
LazyVim.has("telescope.nvim") and function()
require("omnisharp_extended").telescope_lsp_definitions()
end or function()
require("omnisharp_extended").lsp_definitions()
end,
desc = "Goto Definition",
},
},
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
},
}
{
"neovim/nvim-lspconfig",
opts = {
servers = {
omnisharp = {
handlers = {
["textDocument/definition"] = function(...)
return require("omnisharp_extended").handler(...)
end,
},
keys = {
{
"gd",
LazyVim.has("telescope.nvim") and function()
require("omnisharp_extended").telescope_lsp_definitions()
end or function()
require("omnisharp_extended").lsp_definitions()
end,
desc = "Goto Definition",
},
},
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
},
},
}
neotest-dotnet
- Options
- Full Spec
opts = nil
{
"Issafalcon/neotest-dotnet",
}
none-ls.nvim (optional)
- Options
- Full Spec
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.csharpier)
end
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.csharpier)
end,
}
conform.nvim (optional)
- Options
- Full Spec
opts = {
formatters_by_ft = {
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
}
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
}
nvim-dap (optional)
- Options
- Full Spec
opts = function()
local dap = require("dap")
if not dap.adapters["netcoredbg"] then
require("dap").adapters["netcoredbg"] = {
type = "executable",
command = vim.fn.exepath("netcoredbg"),
args = { "--interpreter=vscode" },
options = {
detached = false,
},
}
end
for _, lang in ipairs({ "cs", "fsharp", "vb" }) do
if not dap.configurations[lang] then
dap.configurations[lang] = {
{
type = "netcoredbg",
name = "Launch file",
request = "launch",
---@diagnostic disable-next-line: redundant-parameter
program = function()
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
},
}
end
end
end
{
"mfussenegger/nvim-dap",
optional = true,
opts = function()
local dap = require("dap")
if not dap.adapters["netcoredbg"] then
require("dap").adapters["netcoredbg"] = {
type = "executable",
command = vim.fn.exepath("netcoredbg"),
args = { "--interpreter=vscode" },
options = {
detached = false,
},
}
end
for _, lang in ipairs({ "cs", "fsharp", "vb" }) do
if not dap.configurations[lang] then
dap.configurations[lang] = {
{
type = "netcoredbg",
name = "Launch file",
request = "launch",
---@diagnostic disable-next-line: redundant-parameter
program = function()
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
},
}
end
end
end,
}
neotest (optional)
- Options
- Full Spec
opts = {
adapters = {
["neotest-dotnet"] = {
-- Here we can set options for neotest-dotnet
},
},
}
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"Issafalcon/neotest-dotnet",
},
opts = {
adapters = {
["neotest-dotnet"] = {
-- Here we can set options for neotest-dotnet
},
},
},
}