Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backwards-compatibility] Prevent error messages from incorrect usage by 3rd party plugins #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lua/telescope/_extensions/ui-select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ return require("telescope").register_extension {
}
for idx, item in ipairs(items) do
local client_id, title
if vim.version and vim.version.cmp(vim.version(), vim.version.parse "0.10-dev") >= 0 then

if item[1] ~= nil and item[2] ~= nil and item[2].title ~= nil then
client_id = item[1]
title = item[2].title
elseif
item.ctx ~= nil
and item.ctx.client_id ~= nil
and item.action ~= nil
and item.action.title ~= nil
then
client_id = item.ctx.client_id
title = item.action.title
else
client_id = item[1]
title = item[2].title
vim.api.nvim_err_writeln "telescope-ui-select.nvim - Failed to get item information"
end

local client = vim.lsp.get_client_by_id(client_id)
Expand Down