aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-05-17 14:37:13 +0200
committerGitHub <noreply@github.com>2021-05-17 14:37:13 +0200
commitae93866358777fcf6766152dd55980c4778f4c59 (patch)
treea1b36ba2e2aa09688c4cb96b645b03c34b728042 /lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
parentremove :LspInstallAll (diff)
downloadmason-ae93866358777fcf6766152dd55980c4778f4c59.tar
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.gz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.bz2
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.lz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.xz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.zst
mason-ae93866358777fcf6766152dd55980c4778f4c59.zip
add support for zx install scripts (#13)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/sumneko_lua/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua/init.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
new file mode 100644
index 00000000..aeb03e82
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
@@ -0,0 +1,41 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local zx = require("nvim-lsp-installer.installers.zx")
+
+local root_dir = server.get_server_root_path("lua")
+
+local uname_alias = {
+ Darwin = "macOS",
+}
+local uname = vim.fn.system("uname"):gsub("%s+", "")
+local bin_dir = uname_alias[uname] or uname
+
+return server.Server:new {
+ name = "sumneko_lua",
+ root_dir = root_dir,
+ install_cmd = zx.file("./install.mjs"),
+ pre_install_check = function()
+ if vim.fn.executable("ninja") ~= 1 then
+ error("ninja not installed (see https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages)")
+ end
+ end,
+ default_options = {
+ cmd = { path.concat { root_dir, "bin", bin_dir, "lua-language-server" }, "-E", path.concat { root_dir, "main.lua" } },
+ settings = {
+ Lua = {
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {"vim"}
+ },
+ workspace = {
+ -- Make the server aware of Neovim runtime files
+ library = {
+ [vim.fn.expand("$VIMRUNTIME/lua")] = true,
+ [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
+ },
+ maxPreload = 10000
+ }
+ }
+ },
+ }
+}