I have Omnisharp server running through native NeoVim LSP, here’s the config:
require'lspconfig'.omnisharp.setup {
-- Use current directory for .csx files, search for .csproj or .sln otherwise
root_dir = function(file, _)
if file:sub(-#".csx") == ".csx" then
return util.path.dirname(file)
end
return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file)
end,
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
cmd = { "/home/llaz/bin/omnisharp/OmniSharp", "--languageserver" , "--hostPID", tostring(pid) },
enable_editorconfig_support = true,
enable_roslyn_analyzers = true,
enable_import_completion = true,
}
It works fine, but I cannot seem to be able to restart the server neither using the LspRestart
nor LspStop
followed by LspStart
.
I’m working with source generators and whenever a new type is being generated I need to restart Omnisharp for autocomplete to pick up the new type.
I have a feeling that there might be some configuration missing to somehow hook LspRestart
onto omnisharp instance?