From 61240ac75a93b3cdafb4325ab4e9d407f83965f4 Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Fri, 10 Dec 2021 16:32:28 +0100 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 4 ++-- README.md | 2 +- doc/telescope_changelog.txt | 11 +++++++++++ lua/telescope/builtin/init.lua | 4 ++-- lua/telescope/builtin/internal.lua | 2 +- lua/telescope/builtin/lsp.lua | 10 ++-------- lua/telescope/pickers/_test.lua | 4 ++-- lua/tests/automated/pickers/find_files_spec.lua | 12 ++++++------ plugin/telescope.vim | 4 ++-- 9 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 987b938..a7efcc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: manager: sudo apt-get packages: -y fd-find - os: ubuntu-20.04 - url: https://github.com/neovim/neovim/releases/download/v0.5.1/nvim-linux64.tar.gz + url: https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-linux64.tar.gz manager: sudo apt-get packages: -y fd-find - os: macos-10.15 @@ -23,7 +23,7 @@ jobs: manager: brew packages: fd - os: macos-10.15 - url: https://github.com/neovim/neovim/releases/download/v0.5.1/nvim-macos.tar.gz + url: https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz manager: brew packages: fd steps: diff --git a/README.md b/README.md index 605bb15..0909107 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Telescope Wiki This section should guide you to run your first builtin pickers. -[Neovim (v0.5.1)](https://github.com/neovim/neovim/releases/tag/v0.5.1) or the +[Neovim (v0.6.0)](https://github.com/neovim/neovim/releases/tag/v0.6.0) or the latest neovim nightly commit is required for `telescope.nvim` to work. ### Suggested dependencies diff --git a/doc/telescope_changelog.txt b/doc/telescope_changelog.txt index 55d6f14..6d90aa3 100644 --- a/doc/telescope_changelog.txt +++ b/doc/telescope_changelog.txt @@ -131,4 +131,15 @@ requires users to be on Neovim 0.5.1 (the most recent stable version) or on the LATEST version of Neovim nightly. + *telescope.changelog-1549* + +Date: December 10, 2021 +PR: https://github.com/nvim-telescope/telescope.nvim/pull/1549 + +Telescope requires now Neovim release 0.6.0 or a more recent nightly. +If you are running neovim nightly, you need to make sure that you are on the +LATEST version. Every other commit is not supported. So make sure you build +the newest nightly before reporting issues. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index 9330aec..66f3eda 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -26,8 +26,8 @@ --- ---@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 diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index fa655f0..a868bc6 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -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 diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua index 3899264..149cfcb 100644 --- a/lua/telescope/builtin/lsp.lua +++ b/lua/telescope/builtin/lsp.lua @@ -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 diff --git a/lua/telescope/pickers/_test.lua b/lua/telescope/pickers/_test.lua index 2124635..a8680d0 100644 --- a/lua/telescope/pickers/_test.lua +++ b/lua/telescope/pickers/_test.lua @@ -21,7 +21,7 @@ end local writer = function(val) if type(val) == "table" then - val = vim.fn.json_encode(val) .. "\n" + val = vim.json.encode(val) .. "\n" end if tester.debug then @@ -157,7 +157,7 @@ local get_results_from_file = function(file) local results = j:stderr_result() local result_table = {} for _, v in ipairs(results) do - table.insert(result_table, vim.fn.json_decode(v)) + table.insert(result_table, vim.json.decode(v)) end return result_table diff --git a/lua/tests/automated/pickers/find_files_spec.lua b/lua/tests/automated/pickers/find_files_spec.lua index b4001cc..e9094cb 100644 --- a/lua/tests/automated/pickers/find_files_spec.lua +++ b/lua/tests/automated/pickers/find_files_spec.lua @@ -42,9 +42,9 @@ describe("builtin.find_files", function() width = 0.9, }, border = false, - }, vim.fn.json_decode([==[%s]==]))) + }, vim.json.decode([==[%s]==]))) ]], - vim.fn.json_encode(configuration) + vim.json.encode(configuration) )) end) @@ -73,10 +73,10 @@ describe("builtin.find_files", function() width = 0.9, }, border = false, - }, vim.fn.json_decode([==[%s]==]))) + }, vim.json.decode([==[%s]==]))) ]], expected, - vim.fn.json_encode(configuration) + vim.json.encode(configuration) )) end) @@ -99,9 +99,9 @@ describe("builtin.find_files", function() }, vim.tbl_extend("force", { disable_devicons = false, sorter = require('telescope.sorters').get_fzy_sorter(), - }, vim.fn.json_decode([==[%s]==]))) + }, vim.json.decode([==[%s]==]))) ]], - vim.fn.json_encode(configuration) + vim.json.encode(configuration) )) end) end diff --git a/plugin/telescope.vim b/plugin/telescope.vim index 53d1424..5bf3cf0 100644 --- a/plugin/telescope.vim +++ b/plugin/telescope.vim @@ -1,5 +1,5 @@ -if !has('nvim-0.5.1') - echoerr "Telescope.nvim requires at least nvim-0.5.1. See `:h telescope.changelog-1406`" +if !has('nvim-0.6.0') + echoerr "Telescope.nvim requires at least nvim-0.6.0. See `:h telescope.changelog-1549`" finish end