diff options
| author | Miles Ramage <53498605+JustALawnGnome7@users.noreply.github.com> | 2023-06-30 01:47:04 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-30 14:47:04 +0800 |
| commit | 0011c435282f043a018e23393cae06ed926c3f4a (patch) | |
| tree | 733ffbe6f37d04bee9884f1cb5202278ebf438c8 /lua | |
| parent | docs: link to github discussions, stackoverflow instead of discourse (diff) | |
| download | nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar.gz nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar.bz2 nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar.lz nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar.xz nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.tar.zst nvim-lspconfig-0011c435282f043a018e23393cae06ed926c3f4a.zip | |
fix(omnisharp): update on_new_config (#2692)
* fix(omnisharp): update on_new_config
Save the initial value of cmd to be used in subsequent calls to on_new_config.
* feat: replace excessive code with a call to unpack
* fix(omnisharp): disable capabilities.workspace.workspaceFolders
* fix(omnisharp): added empty lines
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/omnisharp.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lua/lspconfig/server_configurations/omnisharp.lua b/lua/lspconfig/server_configurations/omnisharp.lua index 837d7f51..f86cbddb 100644 --- a/lua/lspconfig/server_configurations/omnisharp.lua +++ b/lua/lspconfig/server_configurations/omnisharp.lua @@ -41,14 +41,18 @@ return { root_dir = function(fname) return util.root_pattern '*.sln'(fname) or util.root_pattern '*.csproj'(fname) end, - on_new_config = function(new_config, new_root_dir) + on_new_config = function(new_config, _) + -- Get the initially configured value of `cmd` + new_config.cmd = { unpack(new_config.cmd or {}) } + + -- Append hard-coded command arguments table.insert(new_config.cmd, '-z') -- https://github.com/OmniSharp/omnisharp-vscode/pull/4300 - vim.list_extend(new_config.cmd, { '-s', new_root_dir }) vim.list_extend(new_config.cmd, { '--hostPID', tostring(vim.fn.getpid()) }) table.insert(new_config.cmd, 'DotNet:enablePackageRestore=false') vim.list_extend(new_config.cmd, { '--encoding', 'utf-8' }) table.insert(new_config.cmd, '--languageserver') + -- Append configuration-dependent command arguments if new_config.enable_editorconfig_support then table.insert(new_config.cmd, 'FormattingOptions:EnableEditorConfigSupport=true') end @@ -76,6 +80,10 @@ return { if new_config.analyze_open_documents_only then table.insert(new_config.cmd, 'RoslynExtensionsOptions:AnalyzeOpenDocumentsOnly=true') end + + -- Disable the handling of multiple workspaces in a single instance + new_config.capabilities = vim.deepcopy(new_config.capabilities) + new_config.capabilities.workspace.workspaceFolders = false -- https://github.com/OmniSharp/omnisharp-roslyn/issues/909 end, init_options = {}, }, |
