From cf08ebc74aa4546b51f11fd0d8a0f8fa5721f021 Mon Sep 17 00:00:00 2001 From: Access <3237126351@qq.com> Date: Mon, 29 Nov 2021 17:51:23 +0800 Subject: add csharpls (#294) Resolves #291. --- lua/nvim-lsp-installer/servers/csharp_ls/init.lua | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lua/nvim-lsp-installer/servers/csharp_ls/init.lua (limited to 'lua/nvim-lsp-installer/servers/csharp_ls/init.lua') diff --git a/lua/nvim-lsp-installer/servers/csharp_ls/init.lua b/lua/nvim-lsp-installer/servers/csharp_ls/init.lua new file mode 100644 index 00000000..956689e6 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/csharp_ls/init.lua @@ -0,0 +1,41 @@ +local server = require "nvim-lsp-installer.server" +local path = require "nvim-lsp-installer.path" +local process = require "nvim-lsp-installer.process" +local std = require "nvim-lsp-installer.installers.std" + +return function(name, root_dir) + return server.Server:new { + name = name, + root_dir = root_dir, + languages = { "c#" }, + homepage = "https://github.com/razzmatazz/csharp-language-server", + installer = { + std.ensure_executables { + { + "dotnet", + "dotnet was not found in path. Refer to https://dotnet.microsoft.com/download for installation instructions.", + }, + }, + ---@type ServerInstallerFunction + function(_, callback, ctx) + process.spawn("dotnet", { + args = { "tool", "update", "--tool-path", ".", "csharp-ls" }, + cwd = ctx.install_dir, + stdio_sink = ctx.stdio_sink, + }, function(success) + if not success then + ctx.stdio_sink.stderr "Failed to install csharp-ls.\n" + callback(false) + else + callback(true) + end + end) + end, + }, + default_options = { + cmd = { + path.concat { root_dir, "csharp-ls" }, + }, + }, + } +end -- cgit v1.2.3-70-g09d2