hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Announcement: Breaking changes

hrsh7th opened this issue · comments

Announcement: Breaking changes

Use floating window instead of native menu #224

The user must change the configuration as the following.

Change feeding <C-n>/<C-p> and vim.fn.pumvisible() == check

You should change the configuration.

cmp.setup {
  mapping = {
    ['<Tab>'] = function(fallback)
      if vim.fn.pumvisible() == 1 then
        vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), true)
      else
        fallback()
      end
    end
  }
}

↓↓↓

cmp.setup {
  mapping = {
    ['<Tab>'] = function(fallback)
      if cmp.visible() then
        cmp.select_next_item()
      else
        fallback()
      end
    end
  }
}

SourceConfig.opts is deprecated #561

cmp.setup {
  sources = {
    {
      name = 'buffer',
      opts = {
        get_bufnrs = function() return { vim.api.nvim_get_current_buf() } end
      }
    }
  }
}

↓↓↓

cmp.setup {
  sources = {
    {
      name = 'buffer',
      option = {
        get_bufnrs = function() return { vim.api.nvim_get_current_buf() } end
      }
    }
  }
}

The cmp.complete arguments was changed

cmp.setup {
  mapping = {
    ['<C-x><C-s>'] = cmp.mapping.complete({
      sources = {
        { name = 'vsnip' }
      }
    }),
  }
}

↓↓↓

cmp.setup {
  mapping = {
    ['<C-x><C-s>'] = cmp.mapping.complete({
      config = {
        sources = {
          { name = 'vsnip' }
        }
      }
    }),
  }
}

The cmp#ready autocmd renamed to CmpReady

autocmd User cmp#ready ...

↓↓↓

autocmd User CmpReady ...

Remove experimental.native_menu and add view.entries = 'native' instead.

cmp.setup {
   ...
  experimental = {
    native_menu = true
  }
  ...
}

↓↓↓

cmp.setup {
   ...
  view = {
    entries = 'native'
  }
  ...
}

Remove documentation and add window.documentation instead.

cmp.setup {
   ...
  documentation = false,
  ...
}

↓↓↓

cmp.setup {
   ...
  window = {
    documentation = false,
  }
  ...
}

NOTE: I'm planning the window configuration option will be deprecated. I think it should be merged to view configuration option.

Remove all default key mappings (workaround is existing)

All key mappings have been removed by 93cf84f.

If you want to achieve the previous behavior, you can use the built-in helper as below.

cmp.setup {
  ...
  mapping = cmp.mapping.preset.insert({
    -- Your configuration here.
  })
  ...
}

cmp.setup.cmdline {
  ...
  mapping = cmp.mapping.preset.cmdline({
    -- Your configuration here.
  })
  ...

}

nvim-cmp will only work on nvim v0.7.x or higher.

status: applied

The nvim v0.7.0 contains the Lua version APIs.
So nvim-cmp will use it and drop supporting the previous version of nvim.

  1. vim.api.nvim_create_autocmd
  2. vim.api.nvim_set_hl
  3. vim.api.nvim_create_user_command

Related

source[n].max_item_count is removed

This is minor breaking change.
The source[n].max_item_count is now removed.

Now performance.max_view_entries can be used for performance.