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

Pickers from extensions aren't listed in :Telescope #1969

Closed
9999years opened this issue May 25, 2022 · 3 comments
Closed

Pickers from extensions aren't listed in :Telescope #1969

9999years opened this issue May 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@9999years
Copy link

Description

In my configuration, I set \t to open :Telescope to select any picker I want, and then I have other key bindings for specific pickers, for example I have \f set to find_files.

I recently added some extensions, but unfortunately they don't show up in :Telescope, which only lists builtin pickers.

Is there some way to browse extensions and their associated pickers from within Telescope? If not, could we add one? This could be a consideration for #1228 as well -- if there are no builtins, we certainly want a nice way to browse extensions.

-- Configuration, using packer.
use {
  "nvim-telescope/telescope.nvim",
  config = function()
    -- Set some key bindings; \t for all telescope pickers, others for specific pickers.
    vim.api.nvim_set_keymap("n", "<leader>t", ":<C-u>Telescope<CR>", { noremap = true })
    vim.api.nvim_set_keymap("n", "<leader>f", ":<C-u>Telescope find_files<CR>", { noremap = true })
    -- ...
    require("telescope").setup{}
    -- Load some extensions
    require('telescope').load_extension("fzy_native")
    require("telescope").load_extension("ui-select") -- telescope-ui-select.nvim
    require("telescope").load_extension("gh")  -- telescope-github.nvim
    require("telescope").load_extension("file_browser") -- telescope-file-browser.nvim
    require("telescope").load_extension("packer") -- telescope-packer.nvim
  end,
  requires = {
    "nvim-lua/popup.nvim",
    "nvim-lua/plenary.nvim",
    "nvim-telescope/telescope-fzy-native.nvim",
    "nvim-telescope/telescope-ui-select.nvim",
    "nvim-telescope/telescope-github.nvim",
    "nvim-telescope/telescope-file-browser.nvim",
    "nvim-telescope/telescope-packer.nvim",
  },
}

Neovim version

$ nvim --version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-004.local

Features: +acl +iconv +tui

$ uname -a
Darwin helvetica 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64

Operating system and version

macOS Monterey 12.3.1

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.3.2

## ===== Installed extensions =====

## Telescope Extension: `file_browser`
  - INFO: No healthcheck provided

## Telescope Extension: `fzy_native`
  - INFO: No healthcheck provided

## Telescope Extension: `gh`
  - INFO: No healthcheck provided

## Telescope Extension: `packer`
  - INFO: No healthcheck provided

## Telescope Extension: `ui-select`
  - INFO: No healthcheck provided

Steps to reproduce

  1. nvim -nu minimal.lua: load nvim with Telescope installed and some extensions, e.g. nvim-telescope/telescope-github.nvim.
  2. :Telescope and search for gh; nothing shows up.
  3. :Telescope gh issues can load the GitHub extension, but :Telescope/:Telescope pickers doesn't list it, and :Telescope gh give an error instead of listing pickers from the GitHub extension.

Expected behavior

Pickers from extensions are listed in :Telescope, :Telescope pickers, or similar.

Actual behavior

Pickers from extensions are not listed and must be memorized/bound to keys directly.

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          'nvim-telescope/telescope-github.nvim',
        },
      },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup{}
  require('telescope').load_extension('gh')
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
@9999years 9999years added the bug Something isn't working label May 25, 2022
@Conni2461
Copy link
Member

So they should show up when you autocomplete :Telescope g<tab> should give you the extension (namespace) gh and <tab> should then show the pickers.

Furthermore you can do Telescope builtin include_extensions=true to also get them with :Telescope which is just a shorthand for :Telescope builtin (but our command parser don't supports opts as second argument (yet)). see :help telescope.builtin.builtin()

@9999years
Copy link
Author

Thanks! That worked!

I've replaced my binding:

vim.api.nvim_set_keymap("n", "<leader>t", ":<C-u>Telescope<CR>", { noremap = true })

with

vim.api.nvim_set_keymap("n", "<leader>t", ":<C-u>Telescope builtin include_extensions=true<CR>", { noremap = true })

@gegoune
Copy link

gegoune commented Jun 3, 2022

@9999years That also works and looks bit cleaner imo:

vim.keymap.set('n', '<leader>t', function()
  require('telescope.builtin').builtin { include_extensions = true }
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants