aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/sumneko_lua.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2020-12-28 17:32:20 -0800
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-01-03 06:53:43 -0800
commit93c34311581ed9db125b1c41c87b8d3af7dc4c41 (patch)
tree21f20f2afc1b197b725ec1c5bab4eea9799e4cc6 /lua/lspconfig/sumneko_lua.lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar.gz
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar.bz2
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar.lz
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar.xz
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.tar.zst
nvim-lspconfig-93c34311581ed9db125b1c41c87b8d3af7dc4c41.zip
Remove all installers and install logic
Diffstat (limited to 'lua/lspconfig/sumneko_lua.lua')
-rw-r--r--lua/lspconfig/sumneko_lua.lua114
1 files changed, 5 insertions, 109 deletions
diff --git a/lua/lspconfig/sumneko_lua.lua b/lua/lspconfig/sumneko_lua.lua
index 2b821766..640243ac 100644
--- a/lua/lspconfig/sumneko_lua.lua
+++ b/lua/lspconfig/sumneko_lua.lua
@@ -2,94 +2,6 @@ local configs = require 'lspconfig/configs'
local util = require 'lspconfig/util'
local name = "sumneko_lua"
-local bin_name = "lua-language-server"
-
-local function make_installer()
- local P = util.path.join
- local install_dir = P{util.base_install_dir, name}
- local git_dir = P{install_dir, bin_name}
- local os, bin, ninja_zip, build_file
-
- if vim.fn.has('osx') == 1 then
- os = 'macOS'
- bin = P{git_dir, "bin", "macOS", bin_name}
- ninja_zip = "ninja-mac.zip"
- build_file = "macos.ninja"
- elseif vim.fn.has('unix') == 1 then
- os = 'Linux'
- bin = P{git_dir, "bin", "Linux", bin_name}
- ninja_zip = "ninja-linux.zip"
- build_file = "linux.ninja"
- end
- local main_file = P{git_dir, "main.lua"}
- local cmd = {bin, '-E', main_file}
-
- local X = {}
- function X.install()
- if os == nil then
- error("This installer supports Linux and macOS only")
- return
- end
- local install_info = X.info()
- if install_info.is_installed then
- print(name, "is already installed")
- return
- end
- if not (util.has_bins("ninja") or util.has_bins("curl")) then
- error('Need either "ninja" or "curl" (to download ninja) to install this.')
- return
- end
- if not util.has_bins("sh", "chmod", "unzip", "clang") then
- error('Need the binaries "sh", "chmod", "unzip", "clang" to install this')
- return
- end
- local script = [=[
-set -e
-bin_name=]=]..bin_name..'\n'..[=[
-ninja_zip=]=]..ninja_zip..'\n'..[=[
-build_file=]=]..build_file..'\n'..[=[
-
-# Install ninja if not available.
-which ninja >/dev/null || {
- test -x ninja || {
- curl -LO https://github.com/ninja-build/ninja/releases/download/v1.9.0/$ninja_zip
- unzip $ninja_zip
- chmod +x ninja
- }
- export PATH="$PWD:$PATH"
-}
-
-# clone project
-git clone https://github.com/sumneko/$bin_name
-cd $bin_name
-git submodule update --init --recursive
-
-# build
-cd 3rd/luamake
-ninja -f ninja/$build_file
-cd ../..
-./3rd/luamake/luamake rebuild
- ]=]
- vim.fn.mkdir(install_info.install_dir, "p")
- util.sh(script, install_info.install_dir)
- end
- function X.info()
- return {
- is_installed = util.has_bins(bin);
- install_dir = install_dir;
- cmd = cmd;
- }
- end
- function X.configure(config)
- local install_info = X.info()
- if install_info.is_installed then
- config.cmd = cmd
- end
- end
- return X
-end
-
-local installer = make_installer()
configs[name] = {
default_config = {
@@ -99,34 +11,21 @@ configs[name] = {
end;
log_level = vim.lsp.protocol.MessageType.Warning;
};
- on_new_config = function(config)
- installer.configure(config)
- end;
docs = {
package_json = "https://raw.githubusercontent.com/sumneko/vscode-lua/master/package.json";
description = [[
https://github.com/sumneko/lua-language-server
-Lua language server. **By default, this doesn't have a `cmd` set.** This is
-because it doesn't provide a global binary. We provide an installer for Linux
-and macOS using `:LspInstall`. If you wish to install it yourself, [here is a
-guide](https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)).
-So you should set `cmd` yourself like this.
-
-```lua
-require'lspconfig'.sumneko_lua.setup{
- cmd = {"path", "to", "cmd"};
- ...
-}
-```
+Lua language server.
-If you install via our installer, if you execute `:LspInstallInfo sumneko_lua`, you can know `cmd` value.
+`lua-language-server` can be installed by following the instructions [here](https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)).
-The settings of the language server can also be overridden. This is especially useful
-when developing on the lua components of neovim. Some recommended settings are as follows:
+**By default, lua-language-server 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 and compiled lua-language-server.
```lua
+local sumneko_root_path = "/path/to/lua-language-server"
require'lspconfig'.sumneko_lua.setup {
+ cmd = {sumneko_root_path .. "/bin/{linux,macOS}/lua-language-server", "-E", sumneko_root_path .. "/main.lua"};
settings = {
Lua = {
runtime = {
@@ -156,7 +55,4 @@ require'lspconfig'.sumneko_lua.setup {
};
};
}
-
-configs[name].install = installer.install
-configs[name].install_info = installer.info
-- vim:et ts=2