nvim-telescope / telescope-ui-select.nvim

MIT License
774 stars 18 forks source link

[Feature]: expose and allow wrapping `telescope_ui_select()` #8

Open rebelot opened 2 years ago

rebelot commented 2 years ago

It would be great to have the opportunity to wrap https://github.com/nvim-telescope/telescope-ui-select.nvim/blob/master/lua/telescope/_extensions/ui-select.lua#L13 into a user-defined function, so that users can run arbitrary checks to infer who is the caller of vim.ui.select and set picker layout / theme / options accordingly.

eg:

vim.ui.select = function(items, opts, on_choice)
    if opts.kind and opts.kind == "codeaction" then
        tops = require'telescope.themes'.get_cursor()
    end
    require'telescope'.extensions.telescope_ui_select.telescope_ui_select(items, opts, on_choice, tops or {})
end
Conni2461 commented 2 years ago

I finish up #7 after that we can do that

yetone commented 2 years ago

@Conni2461 Sorry, I've looked at the PR https://github.com/nvim-telescope/telescope-ui-select.nvim/pull/7 code and still can't figure out how to set a separate theme for codeaction

Conni2461 commented 2 years ago

I said that i'll implement this feature request after #7 is done. I most likely will find some time for it tomorrow. Currently you can still set a global theme for all vim.ui.select calls:

https://github.com/nvim-telescope/telescope-ui-select.nvim#telescope-setup-and-configuration

just put this in your config

require("telescope").setup {
  -- ...
  extensions = {
    -- ...
    ["ui-select"] = {
      require("telescope.themes").get_dropdown {
        -- even more opts
      }
    }  
  }
}
devansh08 commented 7 months ago

@Conni2461 anything new on this feature ? Or if there is any other way to achieve this now ?