Skip to content

bug: scroll weird behavior with blink-cmp #1687

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

Open
4 tasks done
destngx opened this issue Apr 4, 2025 · 3 comments
Open
4 tasks done

bug: scroll weird behavior with blink-cmp #1687

destngx opened this issue Apr 4, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@destngx
Copy link

destngx commented Apr 4, 2025

Did you check docs and existing issues?

  • I have read all the snacks.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of snacks.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.11.0

Operating system/version

MacOS

Describe the bug

Screen.Recording.2025-04-04.at.22.15.08.mov

As you can see in the video, scroll animation is weird when used with blink-cmp, here I use the code companion.nvm source with blink-cmp

Steps To Reproduce

  1. open code-companion chat
  2. type slash to trigger slash command suggest of blink-cmp
  3. C-n or C-p to scroll up and down
  4. When scroll to next page, the issue happens

Expected Behavior

When disabling snacks scroll, the issue gone

I hope to find a way to disable it only for the suggestion command or something like that

Disabling the scroll in the CodeCompanion buffer does not help.

Repro

@destngx destngx added the bug Something isn't working label Apr 4, 2025
@dpetka2001
Copy link
Contributor

You can try the following (not 100% sure how it'll work)

local autocmd = vim.api.nvim_create_autocmd

autocmd("InsertEnter", {
  callback = function()
    vim.g.snacks_scroll = false
  end,
})

autocmd("InsertLeave", {
  callback = function()
    vim.g.snacks_scroll = true
  end,
})

@destngx
Copy link
Author

destngx commented Apr 8, 2025

@dpetka2001 Thank you for your suggestion, It does work nicely.

I also wrote a manual filter based on the doc to disable scroll on some buffer types and file types as a workaround.

scroll = {
      filter = function(buf)
        local buftype_pattern = { "help", "lazy", "Oil", "neo-tree", "dashboard", "packer", "startify", "fzf", "fugitive",
          "spectre_panel", "CodeCompanion" }
        local filetype_pattern = { "nofile" }
        local buftype = vim.bo[buf].buftype
        local filetype = vim.bo[buf].filetype

        -- Check if buftype or filetype is in the exclude pattern
        for _, p in ipairs(buftype_pattern) do
          if buftype == p then
            return false
          end
        end
        for _, p in ipairs(filetype_pattern) do
          if filetype == p then
            return false
          end
        end
        return vim.g.snacks_scroll ~= false and vim.b[buf].snacks_scroll ~= false and buftype ~= "terminal"
      end,
    }

@SheffeyG
Copy link
Contributor

snacks.scroll has has some incompatibility with bordered float menu, here is a workaround Saghen/blink.cmp#1446

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