ci: run tests against Neovim v0.10.0

This commit is contained in:
Steven Arcangeli 2024-05-16 11:33:39 -07:00
parent 6c42401801
commit 9e725f0810
7 changed files with 31 additions and 10 deletions

View file

@ -52,6 +52,7 @@ jobs:
include:
- nvim_tag: v0.8.3
- nvim_tag: v0.9.4
- nvim_tag: v0.10.0
name: Run tests
runs-on: ubuntu-22.04

View file

@ -171,7 +171,10 @@ M.symbol_callback = function(_err, result, context, _config)
return
end
local client = vim.lsp.get_client_by_id(context.client_id)
local client = vim.lsp.get_client_by_id(client_id)
if not client then
return
end
-- Debounce this callback to avoid unnecessary re-rendering
if results[bufnr] == nil then
vim.defer_fn(function()
@ -189,6 +192,9 @@ end
M.on_publish_diagnostics = function(_err, result, ctx, _config)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
if not client then
return
end
local uri = result.uri
local bufnr = vim.uri_to_bufnr(uri)
if

View file

@ -15,7 +15,20 @@ end
M.get_client = function(bufnr, exclude_id)
local ret
local last_priority = -1
for _, client in ipairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
local clients
if vim.lsp.get_clients then
clients = vim.lsp.get_clients({
bufnr = bufnr,
})
else
---@diagnostic disable-next-line: deprecated
clients = vim.lsp.get_active_clients({
bufnr = bufnr,
})
end
for _, client in ipairs(clients) do
local priority = config.lsp.priority[client.name] or 10
if
client.id ~= exclude_id

View file

@ -30,7 +30,7 @@ else
---@param bufnr nil|integer
M.get_buf_lang = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
local ft = vim.api.nvim_buf_get_option(bufnr, "ft")
local ft = vim.bo[bufnr].filetype
local result = vim.treesitter.language.get_lang(ft)
if result then
@ -44,21 +44,21 @@ end
if vim.treesitter.query.get == nil then
---@param lang string
---@return Query|nil
---@return vim.treesitter.Query|nil
M.load_query = function(lang)
---@diagnostic disable-next-line: deprecated
return vim.treesitter.query.get_query(lang, "aerial")
end
else
---@param lang string
---@return Query|nil
---@return vim.treesitter.Query|nil
M.load_query = function(lang)
return vim.treesitter.query.get(lang, "aerial")
end
end
---@param lang string
---@return Query|nil
---@return vim.treesitter.Query|nil
---@note caches queries to avoid filesystem hits on neovim 0.9+
M.get_query = function(lang)
if not query_cache[lang] then
@ -77,7 +77,7 @@ M.has_parser = function(lang)
end
---@param bufnr integer
---@return LanguageTree|nil
---@return vim.treesitter.LanguageTree|nil
M.get_parser = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
---@note nvim 0.9.1 and later don't really care for lang here, as vim itself becomes an authority on that

View file

@ -417,6 +417,7 @@ local nerd_icons = {
Collapsed = "",
}
---@diagnostic disable-next-line: deprecated
local islist = vim.islist or vim.tbl_islist
local M = {}

View file

@ -52,7 +52,7 @@ M.add_fold_mappings = function(bufnr)
zX = { aerial.sync_folds, "[aerial] sync folds" },
}
for lhs, v in pairs(maps) do
local callback, desc = unpack(v)
local callback, desc = v[1], v[2]
if not config.link_tree_to_folds then
local orig_cb = callback
callback = function()

View file

@ -371,9 +371,9 @@ M.render_centered_text = function(bufnr, text)
line = string.rep(" ", (width - vim.api.nvim_strwidth(line)) / 2) .. line
table.insert(lines, line)
end
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
vim.bo[bufnr].modifiable = true
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.bo[bufnr].modifiable = false
end
M.pack = function(...)