From c5bf83dc614b14c6926b738a54c6d059de974f75 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 11 Mar 2022 12:49:55 +0100 Subject: [PATCH] fix: allow Number type should be allowed for option keys (#1782) * Number type should be allowed for option keys Some extension (e.g. `dap`) use integer numbers for their selector options instead of strings. Before this commit, the interface for these plugins breaks when using `ui-select` with a stack trace like the following: Error detected while processing function StartDebugger: line 33: E5108: Error executing lua .../telescope.nvim/lua/telescope/pickers.lua:1359: Should be string, found: number stack traceback: [C]: in function 'assert' .../.vim/bundle/telescope.nvim/lua/telescope/pickers.lua:1359: in function 'new' ...e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:22: in function 'pick_one' .../nvim-dap/lua/dap/ui.lua:32: in function 'pick_if_many' .../nvim-dap/lua/dap.lua:225: in function 'select_config_and_run' .../nvim-dap/lua/dap.lua:551: in function 'continue' [string ":lua"]:1: in main chunk * style Co-authored-by: Simon Hauser --- lua/telescope/pickers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index be8e672..0e26781 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -1359,7 +1359,7 @@ pickers.new = function(opts, defaults) local result = {} for k, v in pairs(opts) do - assert(type(k) == "string", "Should be string, opts") + assert(type(k) == "string" or type(k) == "number", "Should be string or number, found: " .. type(k)) result[k] = v end