break: bump the minimum required neovim version to 0.6 or higher (#1549)

So we can use `vim.json` and `vim.diagnostics`.

If you aren't able to update to 0.6.* yet you should pin the previous commit.
This commit is contained in:
Simon Hauser
2021-12-10 16:32:28 +01:00
committed by GitHub
parent 80cdb00b22
commit 61240ac75a
9 changed files with 29 additions and 24 deletions

View File

@@ -26,8 +26,8 @@
--- </code>
---@brief ]]
if 1 ~= vim.fn.has "nvim-0.5.1" then
vim.api.nvim_err_writeln "This plugins requires neovim 0.5.1"
if 1 ~= vim.fn.has "nvim-0.6.0" then
vim.api.nvim_err_writeln "This plugins requires neovim 0.6.0"
vim.api.nvim_err_writeln "Please update your neovim."
return
end

View File

@@ -245,7 +245,7 @@ internal.symbols = function(opts)
local results = {}
for _, source in ipairs(sources) do
local data = vim.fn.json_decode(Path:new(source):read())
local data = vim.json.decode(Path:new(source):read())
for _, entry in ipairs(data) do
table.insert(results, entry)
end

View File

@@ -380,16 +380,10 @@ local function get_workspace_symbols_requester(bufnr, opts)
_, cancel = vim.lsp.buf_request(bufnr, "workspace/symbol", { query = prompt }, tx)
-- Handle 0.5 / 0.5.1 handler situation
local err, res_1, res_2 = rx()
local results_lsp
if type(res_1) == "table" then
results_lsp = res_1
else
results_lsp = res_2
end
local err, res = rx()
assert(not err, err)
local locations = vim.lsp.util.symbols_to_items(results_lsp or {}, bufnr) or {}
local locations = vim.lsp.util.symbols_to_items(res or {}, bufnr) or {}
if not vim.tbl_isempty(locations) then
locations = utils.filter_symbols(locations, opts) or {}
end