Saghen/blink.cmp

Completion can be very slow on large `.rb` files

Closed this issue · 2 comments

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

I've noticed that when working on large .rb files, getting completions to appear can take 4-5 seconds, which is much slower than the time it takes on other files. Maybe it's unique to ruby files, or similar behavior happens when files are large (1400+ lines) but I've only noticed this on large .rb files.

2024-12-18.10-50-45.mov

Relevant configuration

require("blink-cmp").setup({
  keymap = {
    ["<C-u>"] = { "scroll_documentation_up" },
    ["<C-d>"] = { "scroll_documentation_down" },
    ["<C-n>"] = { "select_next" },
    ["<C-p>"] = { "select_prev" },
    ["<C-e>"] = { "accept" },
    ["<C-space>"] = { "show" },
    ["<C-q>"] = { "hide" },
    ["<C-k>"] = { "show_documentation" },
    ["<C-j>"] = { "snippet_forward" },
    ["<C-h>"] = { "snippet_backward" },
  },
  nerd_font_variant = "mono",
  highlight = {
    use_nvim_cmp_as_default = true,
  },
  windows = {
    documentation = {
      auto_show = true,
    },
  },
  sources = {
    completion = {
      enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" },
    },
    providers = {
      lsp = { fallback_for = { "lazydev" } },
      lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
      snippets = {
        name = "Snippets",
        module = "blink.cmp.sources.snippets",
        score_offset = -3,
        opts = {
          friendly_snippets = true,
          search_paths = { vim.fn.stdpath("config") .. "/snippets" },
          global_snippets = { "all" },
          extended_filetypes = {
            eruby = { "ruby", "javascript" },
            typescript = { "javascript" },
            vue = { "javascript", "html", "css" },
          },
          ignored_filetypes = {},
        },
      },
    },
  },
})

neovim version

v0.10.2

blink.cmp version: branch, tag, or commit

main

This is an issue with your LSP not returning completions, rather than with blink.cmp itself. You might want to look into the issue tracker of the LSP you're using

Got it, thanks a lot @Saghen. Looks like it was because I had this in my config, but didn't have solargraph installed. I guess something was silently erroring out.

lspconfig.solargraph.setup({
  filetypes = { "ruby", "eruby" },
  capabilities = capabilities,
})

After removing this I'm now seeing completions immediately come up