Skip to content

Error on startup when applying user capabilities #2379

@presjpolk

Description

@presjpolk

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

Issue #2288 complained that a user's vim.lsp.config would be overridden. So the start of blink-cmp.lua does this now:

if vim.fn.has('nvim-0.11') == 1 and vim.lsp.config then
  local user_caps = vim.lsp.config['*'].capabilities

  vim.lsp.config('*', {
    capabilities = require('blink.cmp').get_lsp_capabilities(user_caps),
  })
end

This fails if vim.lsp.config['*'] is not set by the user before blink-cmp loads, because it's indexing into a nil value instead of a table.

Proposed fix: change line 2 to

local user_caps = vim.lsp.config['*'] and vim.lsp.config['*'].capabilities or {}

Relevant configuration

Happens with any config.

neovim version

0.11

blink.cmp version

1.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions