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

LuaSnip may disappear while inputting #1224

Open
2 tasks done
Kaiser-Yang opened this issue Feb 15, 2025 · 4 comments
Open
2 tasks done

LuaSnip may disappear while inputting #1224

Kaiser-Yang opened this issue Feb 15, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@Kaiser-Yang
Copy link
Contributor

Kaiser-Yang commented Feb 15, 2025

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

When I input fore, I can see the lua snippets:

Image

But when I input forea, the completion menu just disappears:

Image

When I delete the a, I can see it again:

Image

It seems that when there are only Snip items in the completion menu, the completion menu will disappear.

Relevant configuration

See blink_cmp.lua.

neovim version

v0.10.4

blink.cmp version

v0.12

@Kaiser-Yang Kaiser-Yang added the bug Something isn't working label Feb 15, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 15, 2025

Could you create a minimal repro.lua for this?

@Kaiser-Yang
Copy link
Contributor Author

Open a java file, then input sysout to test:

-- Run with `nvim -u repro.lua`

local lazypath = ".repro/lazy.nvim"
---@diagnostic disable-next-line: undefined-field
if not (vim.uv or vim.loop).fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable", -- latest stable release
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

---@diagnostic disable-next-line: missing-fields
require('lazy').setup({
    spec = {
        {
            'saghen/blink.cmp',
            version = '*',
            dependencies = {
                {
                    'L3MON4D3/LuaSnip',
                    version = 'v2.*',
                    build = 'make install_jsregexp',
                    dependencies = {
                        'rafamadriz/friendly-snippets',
                    },
                    config = function()
                        require('luasnip.loaders.from_vscode').lazy_load()
                    end,
                },
            },

            ---@module 'blink.cmp'
            ---@type blink.cmp.Config
            opts = {
                keymap = {
                    preset = 'none',
                    ['<cr>'] = { 'accept', 'fallback' },
                    ['<tab>'] = { 'snippet_forward', 'fallback' },
                    ['<s-tab>'] = { 'snippet_backward', 'fallback' },
                    ['<c-u>'] = { 'scroll_documentation_up', 'fallback' },
                    ['<c-d>'] = { 'scroll_documentation_down', 'fallback' },
                    ['<c-j>'] = { 'select_next', 'fallback' },
                    ['<c-k>'] = { 'select_prev', 'fallback' },
                    ['<c-x>'] = { 'show', 'fallback' },
                    ['<c-c>'] = { 'cancel', 'fallback' },
                },
                snippets = { preset = 'luasnip' },
                sources = {
                    default = {
                        'lsp',
                        'snippets',
                    },
                },
            },
            opts_extend = { 'sources.default' }
        },
        {
            'neovim/nvim-lspconfig',
            dependencies = {
                'nvim-java/nvim-java',
            },
            config = function()
                local lsp_capabilities = vim.lsp.protocol.make_client_capabilities()
                lsp_capabilities = require('blink.cmp').get_lsp_capabilities(lsp_capabilities)
                require('java').setup({
                    capabilities = lsp_capabilities,
                    root_markers = vim.g.root_markers,
                    jdk = {
                        auto_install = false,
                    },
                })
                local lspconfig = require('lspconfig')
                lspconfig.jdtls.setup({
                    capabilities = lsp_capabilities,
                    handlers = {
                        ['$/progress'] = function(_, _, _) end,
                    },
                })
            end,
        },
    },
})

@Kaiser-Yang

This comment has been minimized.

@kulalax

This comment has been minimized.

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