diff options
| author | William Boman <william@redwill.se> | 2021-12-23 11:08:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-23 11:08:35 +0100 |
| commit | d39847e7b4d89b335e986e6931cfa8ae0d5911a8 (patch) | |
| tree | af3a6177e423736bd0cc9f5bf28310c9529972c1 /lua/nvim-lsp-installer/installers/std.lua | |
| parent | feat: add grammarly (#349) (diff) | |
| download | mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar.gz mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar.bz2 mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar.lz mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar.xz mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.tar.zst mason-d39847e7b4d89b335e986e6931cfa8ae0d5911a8.zip | |
fix(ccls): better Mac support (#352)
This is a breaking change due to fundamental changes to the
installer. Re-installation will unfortunately be required.
Diffstat (limited to 'lua/nvim-lsp-installer/installers/std.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/std.lua | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/lua/nvim-lsp-installer/installers/std.lua b/lua/nvim-lsp-installer/installers/std.lua index f123b3ae..723276fc 100644 --- a/lua/nvim-lsp-installer/installers/std.lua +++ b/lua/nvim-lsp-installer/installers/std.lua @@ -4,6 +4,9 @@ local process = require "nvim-lsp-installer.process" local platform = require "nvim-lsp-installer.platform" local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" +local Data = require "nvim-lsp-installer.data" + +local list_not_nil, when = Data.list_not_nil, Data.when local M = {} @@ -229,36 +232,42 @@ end ---Shallow git clone. ---@param repo_url string -function M.git_clone(repo_url) +---@param opts {directory: string, recursive: boolean} +function M.git_clone(repo_url, opts) ---@type ServerInstallerFunction return function(_, callback, context) + opts = vim.tbl_deep_extend("force", { + directory = ".", + recursive = false, + }, opts) + local c = process.chain { cwd = context.install_dir, stdio_sink = context.stdio_sink, } - c.run("git", { "clone", "--depth", "1", repo_url, "." }) + c.run( + "git", + list_not_nil( + "clone", + "--depth", + "1", + when(opts.recursive, "--recursive"), + when(opts.recursive, "--shallow-submodules"), + repo_url, + opts.directory + ) + ) if context.requested_server_version then - c.run("git", { "fetch", "--depth", "1", "origin", context.requested_server_version }) - c.run("git", { "checkout", "FETCH_HEAD" }) + c.run("git", { "-C", opts.directory, "fetch", "--depth", "1", "origin", context.requested_server_version }) + c.run("git", { "-C", opts.directory, "checkout", "FETCH_HEAD" }) end c.spawn(callback) end end -function M.git_submodule_update() - ---@type ServerInstallerFunction - return function(_, callback, context) - process.spawn("git", { - args = { "submodule", "update", "--init", "--recursive" }, - cwd = context.install_dir, - stdio_sink = context.stdio_sink, - }, callback) - end -end - ---@param opts {args: string[]} function M.gradlew(opts) ---@type ServerInstallerFunction |
