diff options
author | kylo252 <[email protected]> | 2022-10-06 08:55:06 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-06 06:55:06 +0000 |
commit | 9def60f1dd09ac2244672b8570092229977b43b4 (patch) | |
tree | 44bf396deaa7ce20ebc789f95bd03494d2393488 | |
parent | 0d578ab152708019ad10cb7b21fc4a1cb0105a1a (diff) |
feat: lock new installations to nvim 0.8+ (#3111)
-rw-r--r-- | .github/ISSUE_TEMPLATE/general-issue-form.yaml | 2 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/lsp-issue-form.yaml | 2 | ||||
-rw-r--r-- | .github/workflows/install.yaml | 6 | ||||
-rw-r--r-- | .github/workflows/plugins.yml | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | lua/lvim/bootstrap.lua | 4 | ||||
-rw-r--r-- | lua/lvim/lsp/utils.lua | 57 | ||||
-rw-r--r-- | lua/lvim/utils/hooks.lua | 4 | ||||
-rwxr-xr-x | utils/installer/install.sh | 4 |
9 files changed, 20 insertions, 65 deletions
diff --git a/.github/ISSUE_TEMPLATE/general-issue-form.yaml b/.github/ISSUE_TEMPLATE/general-issue-form.yaml index ea8c9cba..8faff6ae 100644 --- a/.github/ISSUE_TEMPLATE/general-issue-form.yaml +++ b/.github/ISSUE_TEMPLATE/general-issue-form.yaml @@ -33,7 +33,7 @@ body: - type: input id: nvim-version attributes: - label: Neovim version (>= 0.7.2) + label: Neovim version (>= 0.8.0) description: "Output of `nvim --version`" placeholder: | NVIM v0.8.0-dev+199-g2875d45e7 diff --git a/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml b/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml index e8079ffa..b3d4713b 100644 --- a/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml +++ b/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml @@ -27,7 +27,7 @@ body: - type: input id: nvim-version attributes: - label: Neovim version (>= 0.7) + label: Neovim version (>= 0.8.0) description: "Output of `nvim --version`" placeholder: | NVIM v0.8.0-dev+199-g2875d45e7 diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml index e21607ab..8ab27e88 100644 --- a/.github/workflows/install.yaml +++ b/.github/workflows/install.yaml @@ -21,10 +21,10 @@ jobs: include: - runner: ubuntu-latest os: linux - neovim: v0.7.0 + neovim: v0.8.0 - runner: macos-latest os: osx - neovim: v0.7.0 + neovim: v0.8.0 - runner: ubuntu-22.04 os: linux neovim: nightly @@ -78,7 +78,7 @@ jobs: uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.7.0 + version: v0.8.0 - name: Install LunarVim timeout-minutes: 4 diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 3df32105..d5c6310f 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -33,7 +33,7 @@ jobs: uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.7.0 + version: v0.8.0 - name: Install LunarVim timeout-minutes: 4 @@ -30,11 +30,11 @@ ## Install In One Command! -Make sure you have the release version of Neovim (0.7+). +Make sure you have the release version of Neovim (0.8+). ### Linux/MacOS: -If you are running Neovim 0.7+ +If you are running Neovim 0.8+ ```bash bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index b803cfa6..5d980498 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -1,7 +1,7 @@ local M = {} -if vim.fn.has "nvim-0.7" ~= 1 then - vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.7+", vim.log.levels.WARN) +if vim.fn.has "nvim-0.8" ~= 1 then + vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.8+", vim.log.levels.WARN) vim.wait(5000, function() return false end) diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 53571f20..44e4f5f7 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -23,25 +23,14 @@ function M.get_active_clients_by_ft(filetype) end function M.get_client_capabilities(client_id) - local client - if not client_id then - local buf_clients = vim.lsp.buf_get_clients() - for _, buf_client in pairs(buf_clients) do - if buf_client.name ~= "null-ls" then - client = buf_client - break - end - end - else - client = vim.lsp.get_client_by_id(tonumber(client_id)) - end + local client = vim.lsp.get_client_by_id(tonumber(client_id)) if not client then - error "Unable to determine client_id" + Log:warn("Unable to determine client from client_id: " .. client_id) return end local enabled_caps = {} - for capability, status in pairs(client.server_capabilities or client.resolved_capabilities) do + for capability, status in pairs(client.server_capabilities) do if status == true then table.insert(enabled_caps, capability) end @@ -178,47 +167,13 @@ function M.format_filter(client) end end ----Provide vim.lsp.buf.format for nvim <0.8 ----@param opts table +---Simple wrapper for vim.lsp.buf.format() to provide defaults +---@param opts table|nil function M.format(opts) opts = opts or {} opts.filter = opts.filter or M.format_filter - if vim.lsp.buf.format then - return vim.lsp.buf.format(opts) - end - - local bufnr = opts.bufnr or vim.api.nvim_get_current_buf() - - ---@type table|nil - local clients = vim.lsp.get_active_clients { - id = opts.id, - bufnr = bufnr, - name = opts.name, - } - - if opts.filter then - clients = vim.tbl_filter(opts.filter, clients) - end - - clients = vim.tbl_filter(function(client) - return client.supports_method "textDocument/formatting" - end, clients) - - if #clients == 0 then - vim.notify_once "[LSP] Format request failed, no matching language servers." - end - - local timeout_ms = opts.timeout_ms or 1000 - for _, client in pairs(clients) do - local params = vim.lsp.util.make_formatting_params(opts.formatting_options) - local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, bufnr) - if result and result.result then - vim.lsp.util.apply_text_edits(result.result, bufnr, client.offset_encoding) - elseif err then - vim.notify(string.format("[LSP][%s] %s", client.name, err), vim.log.levels.WARN) - end - end + return vim.lsp.buf.format(opts) end return M diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index 4101c573..ce4335a9 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -52,8 +52,8 @@ end function M.run_post_update() Log:debug "Starting post-update hook" - if vim.fn.has "nvim-0.7" ~= 1 then - local compat_tag = "1.1.3" + if vim.fn.has "nvim-0.8" ~= 1 then + local compat_tag = "1.1.4" vim.notify( "Please upgrade your Neovim base installation. Newer version of Lunarvim requires v0.7+", vim.log.levels.WARN diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 4f0988be..fee0e420 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -201,11 +201,11 @@ function print_missing_dep_msg() { } function check_neovim_min_version() { - local verify_version_cmd='if !has("nvim-0.7") | cquit | else | quit | endif' + local verify_version_cmd='if !has("nvim-0.8") | cquit | else | quit | endif' # exit with an error if min_version not found if ! nvim --headless -u NONE -c "$verify_version_cmd"; then - echo "[ERROR]: LunarVim requires at least Neovim v0.7 or higher" + echo "[ERROR]: LunarVim requires at least Neovim v0.8 or higher" exit 1 fi } |