trouble.nvim icon indicating copy to clipboard operation
trouble.nvim copied to clipboard

Telescope configuration in the README does not work

Open raj-magesh opened this issue 3 years ago • 8 comments

As far as I can tell, the Telescope configuration suggested in the README of this repo doesn't work.

local actions = require("telescope.actions")
local trouble = require("trouble.providers.telescope")

require('telescope').setup {
    defaults = {
        -- Default configuration for telescope goes here:
        mappings = {
          i = { ["<c-e>"] = trouble.open_with_trouble },
          n = { ["<c-e>"] = trouble.open_with_trouble },
        }
        -- remaining config
    }
}

It also differs markedly from other Telescope extensions which require something like require('telescope').load_extension("dap"), for instance.

raj-magesh avatar May 09 '22 09:05 raj-magesh

Is this work for you?

["<C-e>"] = function(prompt_bufnr, _mode)
    require("trouble.providers.telescope").open_with_trouble(prompt_bufnr, _mode)
end,

diegodox avatar May 24 '22 06:05 diegodox

On a side note, I don't really understand what the configs do. I don't think it's supposed to open the diagnostics in Telescope, but any Telescope panel inside Trouble's?

baggiponte avatar Oct 14 '22 15:10 baggiponte

@baggiponte you can open search results from Telescope in Trouble.

Like live-grep in Telescope, hit <c-t> and you have all the resulsts in trouble

folke avatar Oct 14 '22 16:10 folke

I'm also running into this issue, I would try to debug but when I try to open telescope results with trouble it appears to just hang, until I hit ctrl-c

EDIT: This is the error I get when trying to open in trouble:

Logs...
 ï™™  Error  12:48:36 msg_show.lua_error E5108: Error executing lua Vim(append):Error executing lua callback: ...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:22: Error executing lua: ...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:23: Keyboard interrupt
stack traceback:
	[C]: in function 'nvim_cmd'
	...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:23: in function <...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:22>
	[C]: in function 'nvim_buf_call'
	...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:22: in function <...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:11>
	[C]: in function 'bufload'
	...site/pack/packer/start/trouble.nvim/lua/trouble/util.lua:153: in function 'item_to_result'
	...r/start/trouble.nvim/lua/trouble/providers/telescope.lua:39: in function 'open_with_trouble'
	[string "..."]: in function 'key_func'
	...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
	[string ":lua"]:1: in main chunk
stack traceback:
	[C]: in function 'nvim_buf_call'
	...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:22: in function <...brew/Cellar/neovim/0.8.0/share/nvim/runtime/filetype.lua:11>
	[C]: in function 'bufload'
	...site/pack/packer/start/trouble.nvim/lua/trouble/util.lua:153: in function 'item_to_result'
	...r/start/trouble.nvim/lua/trouble/providers/telescope.lua:39: in function 'open_with_trouble'
	[string "..."]: in function 'key_func'
	...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
	[string ":lua"]:1: in main chunk
stack traceback:
	[C]: in function 'bufload'
	...site/pack/packer/start/trouble.nvim/lua/trouble/util.lua:153: in function 'item_to_result'
	...r/start/trouble.nvim/lua/trouble/providers/telescope.lua:39: in function 'open_with_trouble'
	[string "..."]: in function 'key_func'
	...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
	[string ":lua"]:1: in main chunk

The error I get seems to sometimes come almost always during this method

avegancafe avatar Nov 18 '22 17:11 avegancafe

Anyone figured it out ?

pythops avatar Jan 12 '23 17:01 pythops

Unfortunately no @pythops , still happening :/ such a bummer 'cause I love trouble and telescope. A smidge difficult to debug without knowing both well though

avegancafe avatar Jan 17 '23 23:01 avegancafe

I have encountered this issue too.

ADkun avatar Mar 07 '23 11:03 ADkun

Anyone got it working? Seems like it still hangs when trying to send the telescope results to trouble...

jla2000 avatar Jul 25 '23 08:07 jla2000

This solution works for me, I use nvchad , so lazy.nvim.

{
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "folke/trouble.nvim",
    },
    config = function(_, opts)
      local actions = require("telescope.actions")
      local trouble = require("trouble.providers.telescope")
      opts.defaults.mappings  = {
            i = { ["<c-o>"] = trouble.open_with_trouble },
            n = { ["<c-o>"] = trouble.open_with_trouble },
      }
      require("telescope").setup(opts)
    end,
  }

wambldor avatar Aug 11 '23 17:08 wambldor

Development on the main branch is EOL.

Trouble has been rewritten and will be merged in main soon.

This issue/feature either no longer exists or has been implemented on dev.

For more info, see https://github.com/folke/trouble.nvim/tree/dev

folke avatar Mar 29 '24 07:03 folke