Skip to content

Commit e67962f

Browse files
fix(lsp): add default position encoding when calling symbols_to_items()
1 parent 814f102 commit e67962f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lua/telescope/builtin/__lsp.lua

+15-3
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,11 @@ lsp.document_symbols = function(opts)
359359
return
360360
end
361361

362-
local locations = vim.lsp.util.symbols_to_items(result or {}, opts.bufnr) or {}
362+
if vim.fn.has "nvim-0.11" == 1 then
363+
local locations = vim.lsp.util.symbols_to_items(result or {}, opts.bufnr, "utf-8") or {}
364+
else
365+
local locations = vim.lsp.util.symbols_to_items(result or {}, opts.bufnr) or {}
366+
end
363367
locations = utils.filter_symbols(locations, opts, symbols_sorter)
364368
if vim.tbl_isempty(locations) then
365369
-- error message already printed in `utils.filter_symbols`
@@ -402,7 +406,11 @@ lsp.workspace_symbols = function(opts)
402406
return
403407
end
404408

405-
local locations = vim.lsp.util.symbols_to_items(server_result or {}, opts.bufnr) or {}
409+
if vim.fn.has "nvim-0.11" == 1 then
410+
local locations = vim.lsp.util.symbols_to_items(server_result or {}, opts.bufnr, "utf-8") or {}
411+
else
412+
local locations = vim.lsp.util.symbols_to_items(server_result or {}, opts.bufnr) or {}
413+
end
406414
locations = utils.filter_symbols(locations, opts, symbols_sorter)
407415
if vim.tbl_isempty(locations) then
408416
-- error message already printed in `utils.filter_symbols`
@@ -452,7 +460,11 @@ local function get_workspace_symbols_requester(bufnr, opts)
452460
if client_res.error then
453461
vim.api.nvim_err_writeln("Error when executing workspace/symbol : " .. client_res.error.message)
454462
elseif client_res.result ~= nil then
455-
vim.list_extend(locations, vim.lsp.util.symbols_to_items(client_res.result, bufnr))
463+
if vim.fn.has "nvim-0.11" == 1 then
464+
vim.list_extend(locations, vim.lsp.util.symbols_to_items(client_res.result, bufnr, "utf-8"))
465+
else
466+
vim.list_extend(locations, vim.lsp.util.symbols_to_items(client_res.result, bufnr))
467+
end
456468
end
457469
end
458470

0 commit comments

Comments
 (0)