aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/omnisharp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lspconfig/omnisharp.lua')
-rw-r--r--lua/lspconfig/omnisharp.lua75
1 files changed, 16 insertions, 59 deletions
diff --git a/lua/lspconfig/omnisharp.lua b/lua/lspconfig/omnisharp.lua
index 8c6866d6..5f2f2c46 100644
--- a/lua/lspconfig/omnisharp.lua
+++ b/lua/lspconfig/omnisharp.lua
@@ -1,68 +1,11 @@
local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'
local server_name = 'omnisharp'
-local bin_name = 'run'
-
-local function make_installer()
- local install_dir = util.path.join{util.base_install_dir, server_name}
- local pid = vim.fn.getpid()
- local url = 'linux-x64'
-
- if vim.fn.has('win32') == 1 then
- url = 'win-x64'
- bin_name = 'Omnisharp.exe'
- elseif vim.fn.has('mac') == 1 then
- url = 'osx'
- end
- local bin_path = util.path.join{install_dir, bin_name}
-
- local download_target = util.path.join{install_dir, string.format("omnisharp-%s.zip", url)}
- local extract_cmd = string.format("unzip '%s' -d '%s'", download_target, install_dir)
- local download_cmd = string.format('curl -fLo "%s" --create-dirs "https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-%s.zip"', download_target, url)
- local make_executable_cmd = string.format("chmod u+x '%s'", bin_path)
-
- local X = {}
- function X.install()
- local install_info = X.info()
- if install_info.is_installed then
- print(server_name, "is already installed")
- return
- end
- if not (util.has_bins("curl")) then
- error('Need "curl" to install this.')
- return
- end
- vim.fn.mkdir(install_dir, 'p')
- vim.fn.system(download_cmd)
- vim.fn.system(extract_cmd)
- vim.fn.system(make_executable_cmd)
- end
- function X.info()
- return {
- is_installed = util.path.exists(bin_path);
- install_dir = install_dir;
- cmd = { bin_path, "--languageserver" , "--hostPID", tostring(pid)};
- }
- end
- function X.configure(config)
- local install_info = X.info()
- if install_info.is_installed then
- config.cmd = install_info.cmd
- end
- end
- return X
-end
-
-local installer = make_installer()
configs[server_name] = {
default_config = {
- cmd = installer.info().cmd;
filetypes = {"cs", "vb"};
root_dir = util.root_pattern("*.csproj", "*.sln");
- on_new_config = function(config)
- installer.configure(config)
- end;
init_options = {
};
};
@@ -72,6 +15,22 @@ configs[server_name] = {
description = [[
https://github.com/omnisharp/omnisharp-roslyn
OmniSharp server based on Roslyn workspaces
+
+`omnisharp-roslyn` can be installed by downloading and extracting a release from [here](https://github.com/OmniSharp/omnisharp-roslyn/releases).
+Omnisharp can also be built from source by following the instructions [here](https://github.com/omnisharp/omnisharp-roslyn#downloading-omnisharp).
+
+**By default, omnisharp-roslyn doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of you unzipped .
+
+```lua
+local pid = vim.fn.getpid()
+local omnisharp_bin = "/path/to/omnisharp/OmniSharp"
+-- on Windows
+-- local omnisharp_bin = "/path/to/omnisharp/OmniSharp.exe"
+require'lspconfig'.omnisharp.setup{
+ cmd = { omnisharp_bin, "--languageserver" , "--hostPID", tostring(pid) };
+ ...
+}
+```
]];
default_config = {
root_dir = [[root_pattern(".csproj", ".sln")]];
@@ -79,6 +38,4 @@ OmniSharp server based on Roslyn workspaces
};
}
-configs[server_name].install = installer.install
-configs[server_name].install_info = installer.info
-- vim:et ts=2 sw=2