Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
1.14k stars 66 forks source link

Snippet gets "stuck" in certain situations #264

Open rawhat opened 4 days ago

rawhat commented 4 days ago

Make sure you have done the following

Bug Description

I've noticed this happening mostly in this particular situation, so I don't know how "general" it is. If I select an LSP completion for a React component prop, I get the associated "bracket" inserted as well (either quotes or brackets, depending). If I swap over from the quotes to a bracket, the plugin enters snippet mode. I'm not sure if that's even expected, but I'm fine with it. If I then type something and press <Tab>, it doesn't complete the snippet. It seems to get "stuck" until something happens? I can't quite tell what triggers exiting the snippet.

Here is an example:

https://github.com/user-attachments/assets/068944c6-56c0-4a80-922c-77a8da58e6b6

Not sure what's going on, but any help would be appreciated 😄

Relevant configuration

opts = {
        highlight = {
            use_nvim_cmp_as_default = true,
        },
        keymap = {
            preset = "super-tab",
        },
        sources = {
            completion = {
                enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" },
            },
            providers = {
                lsp = { fallback_for = { "lazydev" } },
                lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
            },
        },
        trigger = {
            completion = {
                show_in_snippet = false,
            },
        },
        windows = {
            autocomplete = {
                draw = "minimal",
            },
            documentation = {
                auto_show = true,
            },
        },
    },

neovim version

NVIM v0.11.0-dev-1092+g0da4d89558

blink.cmp version: branch, tag, or commit

main

Saghen commented 4 days ago

This seems like an issue with the built-in snippets rather than with blink.cmp. Are you able to reproduce this by using the built-in vim.snippet.expand and vim.snippet.jump?

rawhat commented 3 days ago

Oh interesting, I didn't think about that... the only alternative nvim app I have is based on https://gist.github.com/MariaSolOs/2e44a86f569323c478e5a078d0cf98cc and I'm not totally sure how to replicate what's happening here with that 🤔

I tried just making a keymap for vim.snippet.expand and used tab within it with the setup I'm using from that gist, and it seemed to have no issue. Just for clarity, like:

That seemed to work fine 😕 I did also try adding nvim-autopairs to the mix, since I'm using that as well. It didn't seem to change anything other than placing the brackets and my cursor after them 😬

Edit: also not trying to get you to debug my stuff, if you are fairly confident it's not a blink issue. Just not totally sure how to narrow it down more than this.