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

Searching for buffer / live grep / colorscheme requires scrolling to reveal first result #3178

Closed
zerogtiger opened this issue Jun 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zerogtiger
Copy link

zerogtiger commented Jun 20, 2024

Description

This is an issue that's affecting multiple telescope features, some I've seen are Telescope buffers, Telescope live_grep, Telescope colorscheme.

When searching for a certain file/text/colorscheme, the first result will require scrolling, as shown below.

  1. :Telescope find_files
  2. type nvim, then esc
    Screenshot 2024-06-20 at 1 47 26 PM
  3. Pressing j
    Screenshot 2024-06-20 at 1 48 08 PM

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info

Operating system and version

macOS 14.5 (23F79)

Telescope version / branch / rev

telescope 0.1.2

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

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

Steps to reproduce

Outlined above. Telescope config below:

local builtin = require('telescope.builtin')

require "telescope".setup {
  pickers = {
    colorscheme = {
      enable_preview = true,
    }
  }
}

vim.keymap.set('n', '<leader><space>', builtin.buffers, { desc = '[ ] Buffers' })
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[F]ind [F]iles' })
vim.keymap.set('n', '<leader>of', builtin.oldfiles, { desc = '[O]ld [F]iles' })
vim.keymap.set('n', '<leader>ht', builtin.help_tags, { desc = '[H]elp [T]ags' })
vim.keymap.set('n', '<leader>lg', builtin.live_grep, { desc = '[L]ive [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>/', builtin.current_buffer_fuzzy_find, { desc = '[/] Fuzzy search in current buffer' })
vim.keymap.set('n', 'gr', builtin.lsp_references, { desc = '[G]oto [R]eference' })
vim.keymap.set('n', '<leader>ws', builtin.lsp_dynamic_workspace_symbols, { desc = '[W]orkspace [S]ymbols' })
vim.keymap.set('n', '<leader>ds', builtin.lsp_document_symbols, { desc = '[D]ocument [S]ymbols' })

-- vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>gs', function()
    builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)

vim.keymap.set('n', '<leader>cl', builtin.colorscheme, { desc = '[C]o[L]orscheme' })

Expected behavior

Telescope automatically scrolls to the first (bottommost) result. This was the behaviour until some point recently.

Actual behavior

It doesn't^

Minimal config

-- DID NOT DO. 
--
--
--
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
@zerogtiger zerogtiger added the bug Something isn't working label Jun 20, 2024
@jamestrew
Copy link
Contributor

You just need to update telescope to the latest stable version. There was a change in neovim 0.10 that required a fix on our side.
You can just put branch = '0.1.x' in your lazy config I believe if you're using lazy.

@zerogtiger
Copy link
Author

Yup, the issue has been addressed. Thanks!

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

2 participants