浏览代码

Merge branch 'rolling'

kylo252 2 年之前
父节点
当前提交
6fbefdacd3

+ 1 - 1
.github/ISSUE_TEMPLATE/general-issue-form.yaml

@@ -33,7 +33,7 @@ body:
   - type: input
   - type: input
     id: nvim-version
     id: nvim-version
     attributes:
     attributes:
-      label: Neovim version (>= 0.7)
+      label: Neovim version (>= 0.7.2)
       description: "Output of `nvim --version`"
       description: "Output of `nvim --version`"
       placeholder: |
       placeholder: |
         NVIM v0.8.0-dev+199-g2875d45e7
         NVIM v0.8.0-dev+199-g2875d45e7

+ 27 - 6
.github/workflows/install.yaml

@@ -6,6 +6,7 @@ on:
       - "master"
       - "master"
       - "rolling"
       - "rolling"
     paths:
     paths:
+      - '.github/workflows/**'
       - 'lua/**'
       - 'lua/**'
       - 'snapshots/**'
       - 'snapshots/**'
       - 'tests/**'
       - 'tests/**'
@@ -13,33 +14,53 @@ on:
 
 
 jobs:
 jobs:
   unixish:
   unixish:
-    name: ${{ matrix.os }} ${{ matrix.runner }}
+    name: ${{ matrix.os }} ${{ matrix.runner }} (${{ matrix.neovim }})
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         include:
         include:
-          - runner: ubuntu-20.04
+          - runner: ubuntu-latest
             os: linux
             os: linux
-          - runner: macos-10.15
+            neovim: v0.7.0
+          - runner: macos-latest
             os: osx
             os: osx
+            neovim: v0.7.0
+          - runner: ubuntu-22.04
+            os: linux
+            neovim: nightly
+          - runner: macos-12
+            os: osx
+            neovim: nightly
     runs-on: ${{ matrix.runner }}
     runs-on: ${{ matrix.runner }}
     steps:
     steps:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
 
 
-      - name: Install neovim binary
+      - name: Install neovim binary from release
+        env:
+          RELEASE_VER: ${{ matrix.neovim }}
         run: |
         run: |
           echo "$HOME/.local/bin" >> $GITHUB_PATH
           echo "$HOME/.local/bin" >> $GITHUB_PATH
           bash ./utils/installer/install-neovim-from-release
           bash ./utils/installer/install-neovim-from-release
 
 
       - name: Install LunarVim
       - name: Install LunarVim
         timeout-minutes: 4
         timeout-minutes: 4
+        env:
+          LV_BRANCH: ${{ github.head_ref || github.ref_name }}
+          LV_REMOTE: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
+          LUNARVIM_LOG_LEVEL: "debug"
         run: |
         run: |
-          ./utils/installer/install.sh --local --no-install-dependencies
+          export PATH="$HOME/.local/bin:$PATH"
+
+          installer_url="https://raw.githubusercontent.com/${LV_REMOTE}/${LV_BRANCH}/utils/installer/install.sh"
+          curl -LSsO "$installer_url"
+          bash ./install.sh --no-install-dependencies
 
 
       - name: Run unit-tests
       - name: Run unit-tests
         # NOTE: make sure to adjust the timeout if you start adding a lot of tests
         # NOTE: make sure to adjust the timeout if you start adding a lot of tests
         timeout-minutes: 4
         timeout-minutes: 4
-        run: make test
+        run: |
+          nvim --version
+          make test
 
 
   windows:
   windows:
     name: "windows-latest"
     name: "windows-latest"

+ 1 - 1
lua/lvim/config/defaults.lua

@@ -8,7 +8,7 @@ return {
     ---@usage timeout number timeout in ms for the format request (Default: 1000)
     ---@usage timeout number timeout in ms for the format request (Default: 1000)
     timeout = 1000,
     timeout = 1000,
     ---@usage filter func to select client
     ---@usage filter func to select client
-    filter = require("lvim.lsp.handlers").format_filter,
+    filter = require("lvim.lsp.utils").format_filter,
   },
   },
   keys = {},
   keys = {},
 
 

+ 6 - 0
lua/lvim/core/commands.lua

@@ -65,6 +65,12 @@ M.defaults = {
       print(require("lvim.utils.git").get_lvim_version())
       print(require("lvim.utils.git").get_lvim_version())
     end,
     end,
   },
   },
+  {
+    name = "LvimOpenlog",
+    fn = function()
+      vim.fn.execute("edit " .. require("lvim.core.log").get_path())
+    end,
+  },
 }
 }
 
 
 function M.load(collection)
 function M.load(collection)

+ 5 - 2
lua/lvim/core/comment.lua

@@ -26,9 +26,12 @@ function M.config()
       ---operator-pending mapping
       ---operator-pending mapping
       ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
       ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}`
       basic = true,
       basic = true,
-      ---extended mapping
+      ---Extra mapping
+      ---Includes `gco`, `gcO`, `gcA`
+      extra = true,
+      ---Extended mapping
       ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
       ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}`
-      extra = false,
+      extended = false,
     },
     },
 
 
     ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode
     ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode

+ 19 - 9
lua/lvim/core/log.lua

@@ -12,17 +12,27 @@ vim.tbl_add_reverse_lookup(Log.levels)
 local notify_opts = {}
 local notify_opts = {}
 
 
 function Log:set_level(level)
 function Log:set_level(level)
-  -- package.loaded["lvim.core.log"] = nil
-  local log_level = Log.levels[level:upper()]
-  local status_ok, logger = pcall(require("structlog").get_logger, "lvim")
-  if status_ok then
-    for _, s in ipairs(logger.sinks) do
-      s.level = log_level
+  local logger_ok, _ = xpcall(function()
+    local log_level = Log.levels[level:upper()]
+    local structlog = require "structlog"
+    if structlog then
+      local logger = structlog.get_logger "lvim"
+      for _, s in ipairs(logger.sinks) do
+        s.level = log_level
+      end
     end
     end
+  end, debug.traceback)
+  if not logger_ok then
+    Log:debug("Unable to set logger's level: " .. debug.traceback())
   end
   end
 
 
-  package.loaded["packer.log"] = nil
-  require("packer.log").new { level = lvim.log.level }
+  local packer_ok, _ = xpcall(function()
+    package.loaded["packer.log"] = nil
+    require("packer.log").new { level = lvim.log.level }
+  end, debug.traceback)
+  if not packer_ok then
+    Log:debug("Unable to set packer's log level: " .. debug.traceback())
+  end
 end
 end
 
 
 function Log:init()
 function Log:init()
@@ -36,7 +46,7 @@ function Log:init()
     lvim = {
     lvim = {
       sinks = {
       sinks = {
         structlog.sinks.Console(log_level, {
         structlog.sinks.Console(log_level, {
-          async = false,
+          async = true,
           processors = {
           processors = {
             structlog.processors.Namer(),
             structlog.processors.Namer(),
             structlog.processors.StackWriter({ "line", "file" }, { max_parents = 0, stack_level = 2 }),
             structlog.processors.StackWriter({ "line", "file" }, { max_parents = 0, stack_level = 2 }),

+ 26 - 24
lua/lvim/core/telescope/custom-finders.lua

@@ -55,33 +55,35 @@ function M.view_lunarvim_changelog()
   }
   }
   opts.entry_maker = make_entry.gen_from_git_commits(opts)
   opts.entry_maker = make_entry.gen_from_git_commits(opts)
 
 
-  pickers.new(opts, {
-    prompt_title = "~ LunarVim Changelog ~",
+  pickers
+    .new(opts, {
+      prompt_title = "~ LunarVim Changelog ~",
 
 
-    finder = finders.new_oneshot_job(
-      vim.tbl_flatten {
-        "git",
-        "log",
-        "--pretty=oneline",
-        "--abbrev-commit",
+      finder = finders.new_oneshot_job(
+        vim.tbl_flatten {
+          "git",
+          "log",
+          "--pretty=oneline",
+          "--abbrev-commit",
+        },
+        opts
+      ),
+      previewer = {
+        previewers.git_commit_diff_as_was.new(opts),
       },
       },
-      opts
-    ),
-    previewer = {
-      previewers.git_commit_diff_as_was.new(opts),
-    },
 
 
-    --TODO: consider opening a diff view when pressing enter
-    attach_mappings = function(_, map)
-      map("i", "<enter>", copy_to_clipboard_action)
-      map("n", "<enter>", copy_to_clipboard_action)
-      map("i", "<esc>", actions._close)
-      map("n", "<esc>", actions._close)
-      map("n", "q", actions._close)
-      return true
-    end,
-    sorter = sorters.generic_sorter,
-  }):find()
+      --TODO: consider opening a diff view when pressing enter
+      attach_mappings = function(_, map)
+        map("i", "<enter>", copy_to_clipboard_action)
+        map("n", "<enter>", copy_to_clipboard_action)
+        map("i", "<esc>", actions._close)
+        map("n", "<esc>", actions._close)
+        map("n", "q", actions._close)
+        return true
+      end,
+      sorter = sorters.generic_sorter,
+    })
+    :find()
 end
 end
 
 
 -- Smartly opens either git_files or find_files, depending on whether the working directory is
 -- Smartly opens either git_files or find_files, depending on whether the working directory is

+ 3 - 18
lua/lvim/core/terminal.lua

@@ -41,7 +41,6 @@ M.config = function()
     -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"}
     -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"}
     execs = {
     execs = {
       { "lazygit", "<leader>gg", "LazyGit", "float" },
       { "lazygit", "<leader>gg", "LazyGit", "float" },
-      { "lazygit", "<c-\\><c-g>", "LazyGit", "float" },
     },
     },
   }
   }
 end
 end
@@ -76,23 +75,9 @@ M.add_exec = function(opts)
     return
     return
   end
   end
 
 
-  local exec_func = string.format(
-    "<cmd>lua require('lvim.core.terminal')._exec_toggle({ cmd = '%s', count = %d, direction = '%s'})<CR>",
-    opts.cmd,
-    opts.count,
-    opts.direction
-  )
-
-  require("lvim.keymappings").load {
-    normal_mode = { [opts.keymap] = exec_func },
-    term_mode = { [opts.keymap] = exec_func },
-  }
-
-  local wk_status_ok, wk = pcall(require, "which-key")
-  if not wk_status_ok then
-    return
-  end
-  wk.register({ [opts.keymap] = { opts.label } }, { mode = "n" })
+  vim.keymap.set({ "n", "t" }, opts.keymap, function()
+    M._exec_toggle { cmd = opts.cmd, count = opts.count, direction = opts.direction }
+  end, { desc = opts.label, noremap = true, silent = true })
 end
 end
 
 
 M._exec_toggle = function(opts)
 M._exec_toggle = function(opts)

+ 30 - 0
lua/lvim/lsp/config.lua

@@ -39,6 +39,8 @@ local skipped_servers = {
 
 
 local skipped_filetypes = { "markdown", "rst", "plaintext" }
 local skipped_filetypes = { "markdown", "rst", "plaintext" }
 
 
+local join_paths = require("lvim.utils").join_paths
+
 return {
 return {
   templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"),
   templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"),
   diagnostics = {
   diagnostics = {
@@ -119,6 +121,34 @@ return {
     insert_mode = {},
     insert_mode = {},
     visual_mode = {},
     visual_mode = {},
   },
   },
+  buffer_options = {
+    --- enable completion triggered by <c-x><c-o>
+    omnifunc = "v:lua.vim.lsp.omnifunc",
+    --- use gq for formatting
+    formatexpr = "v:lua.vim.lsp.formatexpr(#{timeout_ms:500})",
+  },
+  ---@usage list of settings of nvim-lsp-installer
+  installer = {
+    setup = {
+      ensure_installed = {},
+      ui = {
+        icons = {
+          server_installed = "✓",
+          server_pending = "",
+          server_uninstalled = "✗",
+        },
+      },
+    },
+  },
+  nlsp_settings = {
+    setup = {
+      config_home = join_paths(get_config_dir(), "lsp-settings"),
+      -- set to false to overwrite schemastore.nvim
+      append_default_schemas = true,
+      ignored_servers = {},
+      loader = "json",
+    },
+  },
   null_ls = {
   null_ls = {
     setup = {},
     setup = {},
     config = {},
     config = {},

+ 17 - 31
lua/lvim/lsp/init.lua

@@ -3,6 +3,12 @@ local Log = require "lvim.core.log"
 local utils = require "lvim.utils"
 local utils = require "lvim.utils"
 local autocmds = require "lvim.core.autocmds"
 local autocmds = require "lvim.core.autocmds"
 
 
+local function add_lsp_buffer_options(bufnr)
+  for k, v in pairs(lvim.lsp.buffer_options) do
+    vim.api.nvim_buf_set_option(bufnr, k, v)
+  end
+end
+
 local function add_lsp_buffer_keybindings(bufnr)
 local function add_lsp_buffer_keybindings(bufnr)
   local mappings = {
   local mappings = {
     normal_mode = "n",
     normal_mode = "n",
@@ -10,21 +16,10 @@ local function add_lsp_buffer_keybindings(bufnr)
     visual_mode = "v",
     visual_mode = "v",
   }
   }
 
 
-  if lvim.builtin.which_key.active then
-    -- Remap using which_key
-    local status_ok, wk = pcall(require, "which-key")
-    if not status_ok then
-      return
-    end
-    for mode_name, mode_char in pairs(mappings) do
-      wk.register(lvim.lsp.buffer_mappings[mode_name], { mode = mode_char, buffer = bufnr })
-    end
-  else
-    -- Remap using nvim api
-    for mode_name, mode_char in pairs(mappings) do
-      for key, remap in pairs(lvim.lsp.buffer_mappings[mode_name]) do
-        vim.api.nvim_buf_set_keymap(bufnr, mode_char, key, remap[1], { noremap = true, silent = true })
-      end
+  for mode_name, mode_char in pairs(mappings) do
+    for key, remap in pairs(lvim.lsp.buffer_mappings[mode_name]) do
+      local opts = { buffer = bufnr, desc = remap[2], noremap = true, silent = true }
+      vim.keymap.set(mode_char, key, remap[1], opts)
     end
     end
   end
   end
 end
 end
@@ -78,14 +73,7 @@ function M.common_on_attach(client, bufnr)
     lu.setup_codelens_refresh(client, bufnr)
     lu.setup_codelens_refresh(client, bufnr)
   end
   end
   add_lsp_buffer_keybindings(bufnr)
   add_lsp_buffer_keybindings(bufnr)
-end
-
-local function bootstrap_nlsp(opts)
-  opts = opts or {}
-  local lsp_settings_status_ok, lsp_settings = pcall(require, "nlspsettings")
-  if lsp_settings_status_ok then
-    lsp_settings.setup(opts)
-  end
+  add_lsp_buffer_options(bufnr)
 end
 end
 
 
 function M.get_common_opts()
 function M.get_common_opts()
@@ -117,15 +105,13 @@ function M.setup()
     require("lvim.lsp.templates").generate_templates()
     require("lvim.lsp.templates").generate_templates()
   end
   end
 
 
-  bootstrap_nlsp {
-    config_home = utils.join_paths(get_config_dir(), "lsp-settings"),
-    append_default_schemas = true,
-  }
+  pcall(function()
+    require("nlspsettings").setup(lvim.lsp.nlsp_settings.setup)
+  end)
 
 
-  require("nvim-lsp-installer").setup {
-    -- use the default nvim_data_dir, since the server binaries are independent
-    install_root_dir = utils.join_paths(vim.call("stdpath", "data"), "lsp_servers"),
-  }
+  pcall(function()
+    require("nvim-lsp-installer").setup(lvim.lsp.installer.setup)
+  end)
 
 
   require("lvim.lsp.null-ls").setup()
   require("lvim.lsp.null-ls").setup()
 
 

+ 1 - 6
lua/lvim/lsp/providers/jsonls.lua

@@ -1,12 +1,7 @@
-local full_schemas = vim.tbl_deep_extend(
-  "force",
-  require("schemastore").json.schemas(),
-  require("nlspsettings.jsonls").get_default_schemas()
-)
 local opts = {
 local opts = {
   settings = {
   settings = {
     json = {
     json = {
-      schemas = full_schemas,
+      schemas = require("schemastore").json.schemas(),
     },
     },
   },
   },
   setup = {
   setup = {

+ 9 - 1
lua/lvim/lsp/templates.lua

@@ -17,12 +17,20 @@ end
 
 
 local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes
 local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes
 local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers
 local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers
+local ensure_installed_servers = lvim.lsp.installer.setup.ensure_installed
+
+---Check if we should skip generating an ftplugin file based on the server_name
+---@param server_name string name of a valid language server
+local function should_skip(server_name)
+  -- ensure_installed_servers should take priority over skipped_servers
+  return vim.tbl_contains(skipped_servers, server_name) and not vim.tbl_contains(ensure_installed_servers, server_name)
+end
 
 
 ---Generates an ftplugin file based on the server_name in the selected directory
 ---Generates an ftplugin file based on the server_name in the selected directory
 ---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
 ---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
 ---@param dir string the full path to the desired directory
 ---@param dir string the full path to the desired directory
 function M.generate_ftplugin(server_name, dir)
 function M.generate_ftplugin(server_name, dir)
-  if vim.tbl_contains(skipped_servers, server_name) then
+  if should_skip(server_name) then
     return
     return
   end
   end
 
 

+ 27 - 26
lua/lvim/lsp/utils.lua

@@ -130,45 +130,46 @@ function M.setup_codelens_refresh(client, bufnr)
 end
 end
 
 
 ---filter passed to vim.lsp.buf.format
 ---filter passed to vim.lsp.buf.format
----gives higher priority to null-ls
----@param clients table clients attached to a buffer
----@return table chosen clients
-function M.format_filter(clients)
-  return vim.tbl_filter(function(client)
-    local status_ok, formatting_supported = pcall(function()
-      return client.supports_method "textDocument/formatting"
-    end)
-    -- give higher prio to null-ls
-    if status_ok and formatting_supported and client.name == "null-ls" then
-      return "null-ls"
-    else
-      return status_ok and formatting_supported and client.name
-    end
-  end, clients)
+---always selects null-ls if it's available and caches the value per buffer
+---@param client table client attached to a buffer
+---@return boolean if client matches
+function M.format_filter(client)
+  local filetype = vim.bo.filetype
+  local n = require "null-ls"
+  local s = require "null-ls.sources"
+  local method = n.methods.FORMATTING
+  local avalable_formatters = s.get_available(filetype, method)
+
+  if #avalable_formatters > 0 then
+    return client.name == "null-ls"
+  elseif client.supports_method "textDocument/formatting" then
+    return true
+  else
+    return false
+  end
 end
 end
 
 
 ---Provide vim.lsp.buf.format for nvim <0.8
 ---Provide vim.lsp.buf.format for nvim <0.8
 ---@param opts table
 ---@param opts table
 function M.format(opts)
 function M.format(opts)
-  opts = opts or { filter = M.format_filter }
+  opts = opts or {}
+  opts.filter = opts.filter or M.format_filter
 
 
   if vim.lsp.buf.format then
   if vim.lsp.buf.format then
     return vim.lsp.buf.format(opts)
     return vim.lsp.buf.format(opts)
   end
   end
 
 
   local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
   local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
-  local clients = vim.lsp.buf_get_clients(bufnr)
+
+  ---@type table|nil
+  local clients = vim.lsp.get_active_clients {
+    id = opts.id,
+    bufnr = bufnr,
+    name = opts.name,
+  }
 
 
   if opts.filter then
   if opts.filter then
-    clients = opts.filter(clients)
-  elseif opts.id then
-    clients = vim.tbl_filter(function(client)
-      return client.id == opts.id
-    end, clients)
-  elseif opts.name then
-    clients = vim.tbl_filter(function(client)
-      return client.name == opts.name
-    end, clients)
+    clients = vim.tbl_filter(opts.filter, clients)
   end
   end
 
 
   clients = vim.tbl_filter(function(client)
   clients = vim.tbl_filter(function(client)

+ 1 - 0
lua/lvim/plugin-loader.lua

@@ -20,6 +20,7 @@ function plugin_loader.init(opts)
     package_root = opts.package_root or join_paths(vim.fn.stdpath "data", "site", "pack"),
     package_root = opts.package_root or join_paths(vim.fn.stdpath "data", "site", "pack"),
     compile_path = compile_path,
     compile_path = compile_path,
     snapshot_path = snapshot_path,
     snapshot_path = snapshot_path,
+    max_jobs = 40,
     log = { level = "warn" },
     log = { level = "warn" },
     git = {
     git = {
       clone_timeout = 300,
       clone_timeout = 300,

+ 2 - 0
lua/lvim/plugins.lua

@@ -12,6 +12,7 @@ local core_plugins = {
   },
   },
   {
   {
     "lunarvim/onedarker.nvim",
     "lunarvim/onedarker.nvim",
+    branch = "freeze",
     config = function()
     config = function()
       pcall(function()
       pcall(function()
         if lvim and lvim.colorscheme == "onedarker" then
         if lvim and lvim.colorscheme == "onedarker" then
@@ -37,6 +38,7 @@ local core_plugins = {
   -- Telescope
   -- Telescope
   {
   {
     "nvim-telescope/telescope.nvim",
     "nvim-telescope/telescope.nvim",
+    branch = "0.1.x",
     config = function()
     config = function()
       require("lvim.core.telescope").setup()
       require("lvim.core.telescope").setup()
     end,
     end,

+ 16 - 18
lua/lvim/utils/git.lua

@@ -13,16 +13,14 @@ local function git_cmd(opts)
   opts.cwd = opts.cwd or get_lvim_base_dir()
   opts.cwd = opts.cwd or get_lvim_base_dir()
 
 
   local stderr = {}
   local stderr = {}
-  local stdout, ret = Job
-    :new({
-      command = "git",
-      args = opts.args,
-      cwd = opts.cwd,
-      on_stderr = function(_, data)
-        table.insert(stderr, data)
-      end,
-    })
-    :sync()
+  local stdout, ret = Job:new({
+    command = "git",
+    args = opts.args,
+    cwd = opts.cwd,
+    on_stderr = function(_, data)
+      table.insert(stderr, data)
+    end,
+  }):sync()
 
 
   if not vim.tbl_isempty(stderr) then
   if not vim.tbl_isempty(stderr) then
     Log:debug(stderr)
     Log:debug(stderr)
@@ -32,20 +30,20 @@ local function git_cmd(opts)
     Log:debug(stdout)
     Log:debug(stdout)
   end
   end
 
 
-  return ret, stdout
+  return ret, stdout, stderr
 end
 end
 
 
 local function safe_deep_fetch()
 local function safe_deep_fetch()
-  local ret, result = git_cmd { args = { "rev-parse", "--is-shallow-repository" } }
+  local ret, result, error = git_cmd { args = { "rev-parse", "--is-shallow-repository" } }
   if ret ~= 0 then
   if ret ~= 0 then
-    Log:error "Git fetch failed! Check the log for further information"
+    Log:error(vim.inspect(error))
     return
     return
   end
   end
   -- git fetch --unshallow will cause an error on a a complete clone
   -- git fetch --unshallow will cause an error on a a complete clone
   local fetch_mode = result[1] == "true" and "--unshallow" or "--all"
   local fetch_mode = result[1] == "true" and "--unshallow" or "--all"
   ret = git_cmd { args = { "fetch", fetch_mode } }
   ret = git_cmd { args = { "fetch", fetch_mode } }
   if ret ~= 0 then
   if ret ~= 0 then
-    Log:error "Git fetch failed! Check the log for further information"
+    Log:error("Git fetch failed! Please pull the changes manually in " .. get_lvim_base_dir())
     return
     return
   end
   end
   return true
   return true
@@ -55,12 +53,12 @@ end
 function M.update_base_lvim()
 function M.update_base_lvim()
   Log:info "Checking for updates"
   Log:info "Checking for updates"
 
 
-  local ret = git_cmd { args = { "fetch" } }
-  if ret ~= 0 then
-    Log:error "Update failed! Check the log for further information"
+  if not safe_deep_fetch() then
     return
     return
   end
   end
 
 
+  local ret
+
   ret = git_cmd { args = { "diff", "--quiet", "@{upstream}" } }
   ret = git_cmd { args = { "diff", "--quiet", "@{upstream}" } }
   if ret == 0 then
   if ret == 0 then
     Log:info "LunarVim is already up-to-date"
     Log:info "LunarVim is already up-to-date"
@@ -69,7 +67,7 @@ function M.update_base_lvim()
 
 
   ret = git_cmd { args = { "merge", "--ff-only", "--progress" } }
   ret = git_cmd { args = { "merge", "--ff-only", "--progress" } }
   if ret ~= 0 then
   if ret ~= 0 then
-    Log:error "Update failed! Please pull the changes manually instead."
+    Log:error("Update failed! Please pull the changes manually in " .. get_lvim_base_dir())
     return
     return
   end
   end
 
 

+ 26 - 26
snapshots/default.json

@@ -1,27 +1,27 @@
 {
 {
   "Comment.nvim": {
   "Comment.nvim": {
-    "commit": "3c69bab"
+    "commit": "2e0572c"
   },
   },
   "FixCursorHold.nvim": {
   "FixCursorHold.nvim": {
-    "commit": "1bfb32e"
+    "commit": "5aa5ff1"
   },
   },
   "LuaSnip": {
   "LuaSnip": {
-    "commit": "79b2019"
+    "commit": "be3083b"
   },
   },
   "alpha-nvim": {
   "alpha-nvim": {
-    "commit": "ef27a59"
+    "commit": "14974c3"
   },
   },
   "bufferline.nvim": {
   "bufferline.nvim": {
-    "commit": "c78b3ec"
+    "commit": "d7b775a"
   },
   },
   "cmp-buffer": {
   "cmp-buffer": {
-    "commit": "12463cf"
+    "commit": "62fc67a"
   },
   },
   "cmp-nvim-lsp": {
   "cmp-nvim-lsp": {
     "commit": "affe808"
     "commit": "affe808"
   },
   },
   "cmp-path": {
   "cmp-path": {
-    "commit": "466b6b8"
+    "commit": "981baf9"
   },
   },
   "cmp_luasnip": {
   "cmp_luasnip": {
     "commit": "a9de941"
     "commit": "a9de941"
@@ -30,61 +30,61 @@
     "commit": "bbda2b0"
     "commit": "bbda2b0"
   },
   },
   "friendly-snippets": {
   "friendly-snippets": {
-    "commit": "d27a83a"
+    "commit": "40c306b"
   },
   },
   "gitsigns.nvim": {
   "gitsigns.nvim": {
-    "commit": "c18e016"
+    "commit": "bb6c3bf"
   },
   },
   "lua-dev.nvim": {
   "lua-dev.nvim": {
     "commit": "54149d1"
     "commit": "54149d1"
   },
   },
   "lualine.nvim": {
   "lualine.nvim": {
-    "commit": "3362b28"
+    "commit": "8d956c1"
   },
   },
   "nlsp-settings.nvim": {
   "nlsp-settings.nvim": {
-    "commit": "62d72bc"
+    "commit": "6c4e1a4"
   },
   },
   "null-ls.nvim": {
   "null-ls.nvim": {
-    "commit": "ff40739"
+    "commit": "9c396ab"
   },
   },
   "nvim-autopairs": {
   "nvim-autopairs": {
-    "commit": "fa6876f"
+    "commit": "972a797"
   },
   },
   "nvim-cmp": {
   "nvim-cmp": {
-    "commit": "df6734a"
+    "commit": "c4dcb12"
   },
   },
   "nvim-dap": {
   "nvim-dap": {
-    "commit": "014ebd5"
+    "commit": "c0f43f4"
   },
   },
   "nvim-lsp-installer": {
   "nvim-lsp-installer": {
-    "commit": "2408a0f"
+    "commit": "45571e1"
   },
   },
   "nvim-lspconfig": {
   "nvim-lspconfig": {
-    "commit": "10c3934"
+    "commit": "3479473"
   },
   },
   "nvim-notify": {
   "nvim-notify": {
-    "commit": "8960269"
+    "commit": "74ba257"
   },
   },
   "nvim-tree.lua": {
   "nvim-tree.lua": {
-    "commit": "bdb6d4a"
+    "commit": "08ab346"
   },
   },
   "nvim-treesitter": {
   "nvim-treesitter": {
-    "commit": "518e275"
+    "commit": "07b7221"
   },
   },
   "nvim-ts-context-commentstring": {
   "nvim-ts-context-commentstring": {
     "commit": "8834375"
     "commit": "8834375"
   },
   },
   "nvim-web-devicons": {
   "nvim-web-devicons": {
-    "commit": "8d2c533"
+    "commit": "2d02a56"
   },
   },
   "onedarker.nvim": {
   "onedarker.nvim": {
     "commit": "b00dd21"
     "commit": "b00dd21"
   },
   },
   "packer.nvim": {
   "packer.nvim": {
-    "commit": "00ec5ad"
+    "commit": "494fd59"
   },
   },
   "plenary.nvim": {
   "plenary.nvim": {
-    "commit": "968a4b9"
+    "commit": "986ad71"
   },
   },
   "popup.nvim": {
   "popup.nvim": {
     "commit": "b7404d3"
     "commit": "b7404d3"
@@ -93,7 +93,7 @@
     "commit": "541115e"
     "commit": "541115e"
   },
   },
   "schemastore.nvim": {
   "schemastore.nvim": {
-    "commit": "a32911d"
+    "commit": "fbc7c71"
   },
   },
   "structlog.nvim": {
   "structlog.nvim": {
     "commit": "232a8e2"
     "commit": "232a8e2"
@@ -102,10 +102,10 @@
     "commit": "6a33ece"
     "commit": "6a33ece"
   },
   },
   "telescope.nvim": {
   "telescope.nvim": {
-    "commit": "d96eaa9"
+    "commit": "273ccff"
   },
   },
   "toggleterm.nvim": {
   "toggleterm.nvim": {
-    "commit": "aaeed9e"
+    "commit": "9db6f98"
   },
   },
   "which-key.nvim": {
   "which-key.nvim": {
     "commit": "f03a259"
     "commit": "f03a259"

+ 8 - 10
tests/lvim/helpers.lua

@@ -3,16 +3,14 @@ local M = {}
 function M.search_file(file, args)
 function M.search_file(file, args)
   local Job = require "plenary.job"
   local Job = require "plenary.job"
   local stderr = {}
   local stderr = {}
-  local stdout, ret = Job
-    :new({
-      command = "grep",
-      args = { args, file },
-      cwd = get_cache_dir(),
-      on_stderr = function(_, data)
-        table.insert(stderr, data)
-      end,
-    })
-    :sync()
+  local stdout, ret = Job:new({
+    command = "grep",
+    args = { args, file },
+    cwd = get_cache_dir(),
+    on_stderr = function(_, data)
+      table.insert(stderr, data)
+    end,
+  }):sync()
   return ret, stdout, stderr
   return ret, stdout, stderr
 end
 end
 
 

+ 15 - 1
utils/installer/config.example.lua

@@ -84,6 +84,20 @@ lvim.builtin.treesitter.highlight.enabled = true
 
 
 -- generic LSP settings
 -- generic LSP settings
 
 
+-- -- make sure server will always be installed even if the server is in skipped_servers list
+-- lvim.lsp.installer.setup.ensure_installed = {
+--     "sumeko_lua",
+--     "jsonls",
+-- }
+-- -- change UI setting of `LspInstallInfo`
+-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
+-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
+-- lvim.lsp.installer.setup.ui.border = "rounded"
+-- lvim.lsp.installer.setup.ui.keymaps = {
+--     uninstall_server = "d",
+--     toggle_server_expand = "o",
+-- }
+
 -- ---@usage disable automatic installation of servers
 -- ---@usage disable automatic installation of servers
 -- lvim.lsp.automatic_servers_installation = false
 -- lvim.lsp.automatic_servers_installation = false
 
 
@@ -94,7 +108,7 @@ lvim.builtin.treesitter.highlight.enabled = true
 -- require("lvim.lsp.manager").setup("pyright", opts)
 -- require("lvim.lsp.manager").setup("pyright", opts)
 
 
 -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
 -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
--- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
+-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
 -- vim.tbl_map(function(server)
 -- vim.tbl_map(function(server)
 --   return server ~= "emmet_ls"
 --   return server ~= "emmet_ls"
 -- end, lvim.lsp.automatic_configuration.skipped_servers)
 -- end, lvim.lsp.automatic_configuration.skipped_servers)

+ 15 - 1
utils/installer/config_win.example.lua

@@ -99,6 +99,20 @@ lvim.builtin.treesitter.highlight.enabled = true
 
 
 -- generic LSP settings
 -- generic LSP settings
 
 
+-- -- make sure server will always be installed even if the server is in skipped_servers list
+-- lvim.lsp.installer.setup.ensure_installed = {
+--     "sumeko_lua",
+--     "jsonls",
+-- }
+-- -- change UI setting of `LspInstallInfo`
+-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
+-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
+-- lvim.lsp.installer.setup.ui.border = "rounded"
+-- lvim.lsp.installer.setup.ui.keymaps = {
+--     uninstall_server = "d",
+--     toggle_server_expand = "o",
+-- }
+
 -- ---@usage disable automatic installation of servers
 -- ---@usage disable automatic installation of servers
 -- lvim.lsp.automatic_servers_installation = false
 -- lvim.lsp.automatic_servers_installation = false
 
 
@@ -109,7 +123,7 @@ lvim.builtin.treesitter.highlight.enabled = true
 -- require("lvim.lsp.manager").setup("pyright", opts)
 -- require("lvim.lsp.manager").setup("pyright", opts)
 
 
 -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
 -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
--- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
+-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
 -- vim.tbl_map(function(server)
 -- vim.tbl_map(function(server)
 --   return server ~= "emmet_ls"
 --   return server ~= "emmet_ls"
 -- end, lvim.lsp.automatic_configuration.skipped_servers)
 -- end, lvim.lsp.automatic_configuration.skipped_servers)

+ 4 - 0
utils/installer/install-neovim-from-release

@@ -72,6 +72,10 @@ function install_neovim() {
   pushd "$DOWNLOAD_DIR"
   pushd "$DOWNLOAD_DIR"
   tar -xzf "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz"
   tar -xzf "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz"
   popd
   popd
+  if [ ! -d "$DOWNLOAD_DIR/$RELEASE_NAME" ]; then
+    # fallback to archive name
+    RELEASE_NAME="$ARCHIVE_NAME"
+  fi
   # https://dev.to/ackshaey/macos-vs-linux-the-cp-command-will-trip-you-up-2p00
   # https://dev.to/ackshaey/macos-vs-linux-the-cp-command-will-trip-you-up-2p00
   cp -r "$DOWNLOAD_DIR/$RELEASE_NAME/." "$LV_INSTALL_PREFIX"
   cp -r "$DOWNLOAD_DIR/$RELEASE_NAME/." "$LV_INSTALL_PREFIX"
   echo "Installation complete!"
   echo "Installation complete!"

+ 4 - 1
utils/installer/install.sh

@@ -15,6 +15,8 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
 declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
 declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}"
 declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
 declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
 
 
+declare -r LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}"
+
 declare BASEDIR
 declare BASEDIR
 BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
 BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")"
 BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")"
@@ -209,7 +211,7 @@ function check_neovim_min_version() {
 function verify_core_plugins() {
 function verify_core_plugins() {
   msg "Verifying core plugins"
   msg "Verifying core plugins"
   if ! bash "$LUNARVIM_BASE_DIR/utils/ci/verify_plugins.sh"; then
   if ! bash "$LUNARVIM_BASE_DIR/utils/ci/verify_plugins.sh"; then
-    echo "[ERROR]: Unable to verify plugins, makde sure to manually run ':PackerSync' when starting lvim for the first time."
+    echo "[ERROR]: Unable to verify plugins, make sure to manually run ':PackerSync' when starting lvim for the first time."
     exit 1
     exit 1
   fi
   fi
   echo "Verification complete!"
   echo "Verification complete!"
@@ -423,6 +425,7 @@ function setup_lvim() {
   echo "Preparing Packer setup"
   echo "Preparing Packer setup"
 
 
   "$INSTALL_PREFIX/bin/lvim" --headless \
   "$INSTALL_PREFIX/bin/lvim" --headless \
+    -c "lua require('lvim.core.log'):set_level([[$LUNARVIM_LOG_LEVEL]])" \
     -c 'autocmd User PackerComplete quitall' \
     -c 'autocmd User PackerComplete quitall' \
     -c 'PackerSync'
     -c 'PackerSync'