aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorChris Kipp <ckipp@pm.me>2020-04-27 04:28:57 +0200
committerGitHub <noreply@github.com>2020-04-26 19:28:57 -0700
commit868a2a5c7c81060954bc334f6f9295845d7eedfb (patch)
tree5b82094253a0ddd1fdbd062e9b3db596d912c350 /lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar.gz
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar.bz2
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar.lz
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar.xz
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.tar.zst
nvim-lspconfig-868a2a5c7c81060954bc334f6f9295845d7eedfb.zip
metals.lua: add ability to reuse cs if already installed #209
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim_lsp/metals.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/lua/nvim_lsp/metals.lua b/lua/nvim_lsp/metals.lua
index 19db4892..6265f9dd 100644
--- a/lua/nvim_lsp/metals.lua
+++ b/lua/nvim_lsp/metals.lua
@@ -21,12 +21,18 @@ local function make_installer()
error('Need "JDK" to install this.')
return
end
- local coursier_bin = install_dir .. "/coursier"
- local download_cmd = string.format("curl -fLo %s --create-dirs https://git.io/coursier-cli", coursier_bin)
- local chmod_cmd = string.format("chmod +x %s", coursier_bin)
- local install_cmd = string.format("%s bootstrap --java-opt -Xss4m --java-opt -Xms100m --java-opt -Dmetals.client=coc.nvim org.scalameta:metals_2.12:latest.release -r bintray:scalacenter/releases -r sonatype:snapshots -o %s -f", coursier_bin, metals_bin)
- vim.fn.system(download_cmd)
- vim.fn.system(chmod_cmd)
+ local coursier_exe
+ if not (util.has_bins("cs")) then
+ coursier_exe = install_dir .. "/coursier"
+ local download_cmd = string.format("curl -fLo %s --create-dirs https://git.io/coursier-cli", coursier_exe)
+ local chmod_cmd = string.format("chmod +x %s", coursier_exe)
+ vim.fn.system(download_cmd)
+ vim.fn.system(chmod_cmd)
+ else
+ os.execute("mkdir " .. install_dir)
+ coursier_exe = "cs"
+ end
+ local install_cmd = string.format("%s bootstrap --java-opt -Xss4m --java-opt -Xms100m --java-opt -Dmetals.client=coc.nvim org.scalameta:metals_2.12:latest.release -r bintray:scalacenter/releases -r sonatype:snapshots -o %s -f", coursier_exe, metals_bin)
vim.fn.system(install_cmd)
end
function X.info()
@@ -66,7 +72,7 @@ Scala language server with rich IDE features.
`metals` can be installed via `:LspInstall metals`.
]];
default_config = {
- root_dir = [[util.root_pattern("build.sbt")]];
+ root_dir = [[util.root_pattern("build.sbt", "build.sc", "build.gradle", "pom.xml")]];
};
};
};