chore: remove a lot of deprecated stuff (#1399)
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
local a = vim.api
|
local a = vim.api
|
||||||
|
|
||||||
local log = require "telescope.log"
|
|
||||||
local config = require "telescope.config"
|
local config = require "telescope.config"
|
||||||
local state = require "telescope.state"
|
local state = require "telescope.state"
|
||||||
local utils = require "telescope.utils"
|
local utils = require "telescope.utils"
|
||||||
@@ -27,52 +26,10 @@ local resolver = require "telescope.config.resolve"
|
|||||||
|
|
||||||
local actions = setmetatable({}, {
|
local actions = setmetatable({}, {
|
||||||
__index = function(_, k)
|
__index = function(_, k)
|
||||||
-- TODO(conni2461): Remove deprecated messages
|
|
||||||
if k:find "goto_file_selection" then
|
|
||||||
error(
|
|
||||||
"`"
|
|
||||||
.. k
|
|
||||||
.. "` is removed and no longer usable. "
|
|
||||||
.. "Use `require('telescope.actions').select_` instead. Take a look at developers.md for more Information."
|
|
||||||
)
|
|
||||||
elseif k == "_goto_file_selection" then
|
|
||||||
error(
|
|
||||||
"`_goto_file_selection` is deprecated and no longer replaceable. "
|
|
||||||
.. "Use `require('telescope.actions.set').edit` instead. Take a look at developers.md for more Information."
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
error("Key does not exist for 'telescope.actions': " .. tostring(k))
|
error("Key does not exist for 'telescope.actions': " .. tostring(k))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- TODO(conni2461): Remove deprecated messages
|
|
||||||
local action_is_deprecated = function(name, err)
|
|
||||||
local messager = err and error or log.info
|
|
||||||
|
|
||||||
return messager(
|
|
||||||
string.format("`actions.%s()` is deprecated." .. "Use require('telescope.actions.state').%s() instead", name, name)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function actions.get_selected_entry()
|
|
||||||
-- TODO(1.0): Remove
|
|
||||||
action_is_deprecated "get_selected_entry"
|
|
||||||
return action_state.get_selected_entry()
|
|
||||||
end
|
|
||||||
|
|
||||||
function actions.get_current_line()
|
|
||||||
-- TODO(1.0): Remove
|
|
||||||
action_is_deprecated "get_current_line"
|
|
||||||
return action_state.get_current_line()
|
|
||||||
end
|
|
||||||
|
|
||||||
function actions.get_current_picker(prompt_bufnr)
|
|
||||||
-- TODO(1.0): Remove
|
|
||||||
action_is_deprecated "get_current_picker"
|
|
||||||
return action_state.get_current_picker(prompt_bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Move the selection to the next entry
|
--- Move the selection to the next entry
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
function actions.move_selection_next(prompt_bufnr)
|
function actions.move_selection_next(prompt_bufnr)
|
||||||
|
|||||||
@@ -729,10 +729,7 @@ function config.set_defaults(user_defaults, tele_defaults)
|
|||||||
tele_defaults = if_nil(tele_defaults, telescope_defaults)
|
tele_defaults = if_nil(tele_defaults, telescope_defaults)
|
||||||
|
|
||||||
-- Check if using layout keywords outside of `layout_config`
|
-- Check if using layout keywords outside of `layout_config`
|
||||||
deprecated.picker_window_options(user_defaults)
|
deprecated.options(user_defaults)
|
||||||
|
|
||||||
-- Check if using `layout_defaults` instead of `layout_config`
|
|
||||||
user_defaults = deprecated.layout_configuration(user_defaults)
|
|
||||||
|
|
||||||
local function get(name, default_val)
|
local function get(name, default_val)
|
||||||
if name == "layout_config" then
|
if name == "layout_config" then
|
||||||
|
|||||||
@@ -1,78 +1,12 @@
|
|||||||
local log = require "telescope.log"
|
|
||||||
|
|
||||||
local deprecated = {}
|
local deprecated = {}
|
||||||
|
|
||||||
deprecated.picker_window_options = function(opts)
|
deprecated.options = function(opts)
|
||||||
local messages = {}
|
local messages = {}
|
||||||
|
|
||||||
-- Deprecated: PR:922, 2021/06/25
|
|
||||||
-- Can be removed in a few weeks.
|
|
||||||
|
|
||||||
if opts.shorten_path then
|
|
||||||
table.insert(
|
|
||||||
messages,
|
|
||||||
"'opts.shorten_path' is no longer valid. Please use 'opts.path_display' instead. "
|
|
||||||
.. "Please See ':help telescope.changelog-839'"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.hide_filename then
|
|
||||||
table.insert(
|
|
||||||
messages,
|
|
||||||
"'opts.hide_filename' is no longer valid. Please use 'opts.path_display' instead. "
|
|
||||||
.. "Please See ':help telescope.changelog-839'"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.width then
|
|
||||||
table.insert(messages, "'opts.width' is no longer valid. Please use 'layout_config.width' instead")
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.height then
|
|
||||||
table.insert(messages, "'opts.height' is no longer valid. Please use 'layout_config.height' instead")
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.results_height then
|
|
||||||
table.insert(messages, "'opts.results_height' is no longer valid. Please see ':help telescope.changelog-922'")
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.results_width then
|
|
||||||
table.insert(
|
|
||||||
messages,
|
|
||||||
"'opts.results_width' actually didn't do anything. Please see ':help telescope.changelog-922'"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.prompt_position then
|
|
||||||
table.insert(
|
|
||||||
messages,
|
|
||||||
"'opts.prompt_position' is no longer valid. Please use 'layout_config.prompt_position' instead."
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.preview_cutoff then
|
|
||||||
table.insert(
|
|
||||||
messages,
|
|
||||||
"'opts.preview_cutoff' is no longer valid. Please use 'layout_config.preview_cutoff' instead."
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if #messages > 0 then
|
if #messages > 0 then
|
||||||
table.insert(messages, 1, "Deprecated window options. Please see ':help telescope.changelog'")
|
table.insert(messages, 1, "Deprecated options. Please see ':help telescope.changelog'")
|
||||||
vim.api.nvim_err_write(table.concat(messages, "\n \n ") .. "\n \nPress <Enter> to continue\n")
|
vim.api.nvim_err_write(table.concat(messages, "\n \n ") .. "\n \nPress <Enter> to continue\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
deprecated.layout_configuration = function(user_defaults)
|
|
||||||
if user_defaults.layout_defaults then
|
|
||||||
if user_defaults.layout_config == nil then
|
|
||||||
log.warn "Using 'layout_defaults' in setup() is deprecated. Use 'layout_config' instead."
|
|
||||||
user_defaults.layout_config = user_defaults.layout_defaults
|
|
||||||
else
|
|
||||||
error "Using 'layout_defaults' in setup() is deprecated. Remove this key and use 'layout_config' instead."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return user_defaults
|
|
||||||
end
|
|
||||||
|
|
||||||
return deprecated
|
return deprecated
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ function Picker:new(opts)
|
|||||||
actions._clear()
|
actions._clear()
|
||||||
action_set._clear()
|
action_set._clear()
|
||||||
|
|
||||||
deprecated.picker_window_options(opts)
|
deprecated.options(opts)
|
||||||
|
|
||||||
local layout_strategy = get_default(opts.layout_strategy, config.values.layout_strategy)
|
local layout_strategy = get_default(opts.layout_strategy, config.values.layout_strategy)
|
||||||
|
|
||||||
|
|||||||
@@ -259,11 +259,6 @@ utils.diagnostics_to_tbl = function(opts)
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.path_shorten = function(filename, len)
|
|
||||||
log.warn "`utils.path_shorten` is deprecated. Use `require('plenary.path').shorten`."
|
|
||||||
return Path:new(filename):shorten(len)
|
|
||||||
end
|
|
||||||
|
|
||||||
utils.path_smart = (function()
|
utils.path_smart = (function()
|
||||||
local paths = {}
|
local paths = {}
|
||||||
return function(filepath)
|
return function(filepath)
|
||||||
@@ -505,22 +500,6 @@ function utils.get_os_command_output(cmd, cwd)
|
|||||||
return stdout, ret, stderr
|
return stdout, ret, stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.strdisplaywidth = function()
|
|
||||||
error "strdisplaywidth deprecated. please use plenary.strings.strdisplaywidth"
|
|
||||||
end
|
|
||||||
|
|
||||||
utils.utf_ptr2len = function()
|
|
||||||
error "utf_ptr2len deprecated. please use plenary.strings.utf_ptr2len"
|
|
||||||
end
|
|
||||||
|
|
||||||
utils.strcharpart = function()
|
|
||||||
error "strcharpart deprecated. please use plenary.strings.strcharpart"
|
|
||||||
end
|
|
||||||
|
|
||||||
utils.align_str = function()
|
|
||||||
error "align_str deprecated. please use plenary.strings.align_str"
|
|
||||||
end
|
|
||||||
|
|
||||||
local load_once = function(f)
|
local load_once = function(f)
|
||||||
local resolved = nil
|
local resolved = nil
|
||||||
return function(...)
|
return function(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user