From c2bde3911892a51323219f7cfc9bb50b49afd29f Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 29 Jan 2022 18:03:44 +0100 Subject: add nickel_ls (#452) --- lua/nvim-lsp-installer/_generated/filetype_map.lua | 2 ++ lua/nvim-lsp-installer/_generated/metadata.lua | 3 +++ .../_generated/schemas/nickel_ls.lua | 3 +++ lua/nvim-lsp-installer/installers/cargo.lua | 17 ++++++++++++++ lua/nvim-lsp-installer/servers/init.lua | 1 + lua/nvim-lsp-installer/servers/nickel_ls/init.lua | 26 ++++++++++++++++++++++ 6 files changed, 52 insertions(+) create mode 100644 lua/nvim-lsp-installer/_generated/schemas/nickel_ls.lua create mode 100644 lua/nvim-lsp-installer/servers/nickel_ls/init.lua (limited to 'lua') diff --git a/lua/nvim-lsp-installer/_generated/filetype_map.lua b/lua/nvim-lsp-installer/_generated/filetype_map.lua index eb8ad20d..b1b7ad22 100644 --- a/lua/nvim-lsp-installer/_generated/filetype_map.lua +++ b/lua/nvim-lsp-installer/_generated/filetype_map.lua @@ -74,6 +74,8 @@ return { mdx = { "tailwindcss" }, mustache = { "tailwindcss" }, mysql = { "sqlls", "sqls" }, + ncl = { "nickel_ls" }, + nickel = { "nickel_ls" }, nim = { "nimls" }, nix = { "rnix" }, njk = { "tailwindcss" }, diff --git a/lua/nvim-lsp-installer/_generated/metadata.lua b/lua/nvim-lsp-installer/_generated/metadata.lua index 4c12d7dd..89734d6a 100644 --- a/lua/nvim-lsp-installer/_generated/metadata.lua +++ b/lua/nvim-lsp-installer/_generated/metadata.lua @@ -157,6 +157,9 @@ return { ltex = { filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex" } }, + nickel_ls = { + filetypes = { "ncl", "nickel" } + }, nimls = { filetypes = { "nim" } }, diff --git a/lua/nvim-lsp-installer/_generated/schemas/nickel_ls.lua b/lua/nvim-lsp-installer/_generated/schemas/nickel_ls.lua new file mode 100644 index 00000000..c18af1a6 --- /dev/null +++ b/lua/nvim-lsp-installer/_generated/schemas/nickel_ls.lua @@ -0,0 +1,3 @@ +-- THIS FILE IS GENERATED. DO NOT EDIT MANUALLY. +-- stylua: ignore start +return {properties = {["nls.server.debugLog"] = {default = false,description = "Logs the communication between VS Code and the language server.",scope = "window",type = "boolean"},["nls.server.path"] = {default = "nls",description = "Path to nickel language server",scope = "window",type = "string"},["nls.server.trace"] = {description = "Enables performance tracing to the given file",scope = "window",type = "string"}},title = "Nickel Language Server Configuration",type = "object"} \ No newline at end of file diff --git a/lua/nvim-lsp-installer/installers/cargo.lua b/lua/nvim-lsp-installer/installers/cargo.lua index fe48404e..c4f11854 100644 --- a/lua/nvim-lsp-installer/installers/cargo.lua +++ b/lua/nvim-lsp-installer/installers/cargo.lua @@ -21,8 +21,25 @@ function M.crate(crate, opts) ctx.receipt:with_primary_source(ctx.receipt.cargo(crate)) process.spawn("cargo", { + args = args, cwd = ctx.install_dir, + stdio_sink = ctx.stdio_sink, + }, callback) + end +end + +---@param opts {path:string|nil} +function M.install(opts) + ---@type ServerInstallerFunction + return function(_, callback, ctx) + opts = opts or {} + local args = { "install", "--root", "." } + if opts.path then + vim.list_extend(args, { "--path", opts.path }) + end + process.spawn("cargo", { args = args, + cwd = ctx.install_dir, stdio_sink = ctx.stdio_sink, }, callback) end diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua index fda0c03a..442e31b2 100644 --- a/lua/nvim-lsp-installer/servers/init.lua +++ b/lua/nvim-lsp-installer/servers/init.lua @@ -83,6 +83,7 @@ local CORE_SERVERS = Data.set_of { "lelwel_ls", "lemminx", "ltex", + "nickel_ls", "nimls", "ocamlls", "omnisharp", diff --git a/lua/nvim-lsp-installer/servers/nickel_ls/init.lua b/lua/nvim-lsp-installer/servers/nickel_ls/init.lua new file mode 100644 index 00000000..d87062e7 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/nickel_ls/init.lua @@ -0,0 +1,26 @@ +local path = require "nvim-lsp-installer.path" +local server = require "nvim-lsp-installer.server" +local std = require "nvim-lsp-installer.installers.std" +local context = require "nvim-lsp-installer.installers.context" +local cargo = require "nvim-lsp-installer.installers.cargo" + +return function(name, root_dir) + return server.Server:new { + name = name, + root_dir = root_dir, + homepage = "https://nickel-lang.org/", + languages = { "nickel" }, + installer = { + std.git_clone "https://github.com/tweag/nickel", + cargo.install { + path = path.concat { "lsp", "nls" }, + }, + context.receipt(function(receipt) + receipt:with_primary_source(receipt.git_remote "https://github.com/tweag/nickel") + end), + }, + default_options = { + cmd_env = cargo.env(root_dir), + }, + } +end -- cgit v1.2.3-70-g09d2