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

[regression] additional_args breaks live_grep #2295

Closed
smjonas opened this issue Jan 1, 2023 · 1 comment · Fixed by #2306
Closed

[regression] additional_args breaks live_grep #2295

smjonas opened this issue Jan 1, 2023 · 1 comment · Fixed by #2306
Labels
bug Something isn't working

Comments

@smjonas
Copy link
Contributor

smjonas commented Jan 1, 2023

Description

:Telescope live_grep does not work at all since 9cf4658 when setting pickers.live_grep.additional_args (bisected).

Neovim version

NVIM v0.9.0-dev-1729+g2d8bbe468                                                                                                                                                                                                         
Build type: Debug                                                                                                                                                                                                                       
LuaJIT 2.1.0-beta3

Operating system and version

Linux 20.2

Telescope version / branch / rev

master (since 9cf4658)

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 11.0.2
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Steps to reproduce

  1. nvim -u minimal.lua minimal.lua
  2. :Telescope live_grep
  3. Type something

Expected behavior

live_grep should work when additional_args is set

Actual behavior

[TL;DR: see the screenshot below]

  • the filename and the contents somehow get merged (when pressing enter, Telescope will try to open this concatenated string as a file, e.g. the filename becomes "test.lua:3:35:vim.api.nvim_create_user_command("Testt", function() end, {" [New] --No lines in buffer--)
  • the preview is empty
  • scrolling down sometimes causes errors when the "filename" contains an opening but not a closing bracket:
Error executing vim.schedule lua callback: Vim:E220: Missing }.
stack traceback:
        [C]: in function 'expand'
        ...packer/start/telescope.nvim/lua/telescope/from_entry.lua:33: in function 'path'
        ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:471: in function 'define_preview'
        ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:388: in function 'preview'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1075: in function 'refresh_previewer'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1028: in function 'set_selection'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1360: in function '_do_selection'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1322: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

telescope_bug

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-treesitter/nvim-treesitter",
					{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
				},
			},
			-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
		},
		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({
		pickers = {
			live_grep = {
				additional_args = { "-tlua" },
			},
		},
	})
	require("telescope").load_extension("fzf")
	-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
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()]])
@smjonas smjonas added the bug Something isn't working label Jan 1, 2023
@smjonas smjonas changed the title additional_args breaks live_grep [regression] additional_args breaks live_grep Jan 2, 2023
@Conni2461
Copy link
Member

Thanks for reporting :) #2306 should fix your issue

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

Successfully merging a pull request may close this issue.

2 participants