hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
8.16k stars 407 forks source link

Error: "snippet engine is not configured" #268

Closed itaranto closed 3 years ago

itaranto commented 3 years ago

Hello,

I don't use a snippet engine, every time the confirm mapping is called, nvim-cmp fails with error:

E5108: Error executing lua ...site/pack/paqs/start/nvim-cmp/lua/cmp/config/default.lua:26: snippet engine is not configured.

And after this nvim-cmp stops working.

This is my current configuration:

-- Set completeopt to have a better completion experience
vim.opt.completeopt = 'menuone,noselect'

-- nvim-cmp setup
local cmp = require('cmp')
cmp.setup {
  mapping = {
    ['<Tab>'] = cmp.mapping.select_next_item(),
    ['<S-Tab>'] = cmp.mapping.select_prev_item(),
    ['<C-d>'] = cmp.mapping.scroll_docs(4),
    ['<C-u>'] = cmp.mapping.scroll_docs(-4),
    ['<CR>'] = cmp.mapping.confirm {
      behavior = cmp.ConfirmBehavior.Replace,
      select = true,
    },
  },
  sources = {
    { name = 'nvim_lsp' },
    { name = 'buffer' },
    { name = 'calc' },
    { name = 'path' },
    { name = 'spell' },
  },
  formatting = {
      format = function(entry, vim_item)
        vim_item.menu = ({
          nvim_lsp = '[LSP]',
          buffer = '[Buffer]',
          calc = '[Calc]',
          path = '[Path]',
          spell = '[Spell]',
        })[entry.source.name]
        return vim_item
      end,
  },
}

Is this expected behavior? Why someone should be forced to use a snippet engine?

hrsh7th commented 3 years ago

You can manage the snippet by yourself.

https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#no-snippet-plugin

Why someone should be forced to use a snippet engine?

That is just my decision.

itaranto commented 3 years ago

You can manage the snippet by yourself.

https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#no-snippet-plugin

Why someone should be forced to use a snippet engine?

That is just my decision.

Well, that's unfortunate...

Is there some simple configuration to disable snippets?

I believe a completion plugin should not force users to use a snippet engine.

hrsh7th commented 3 years ago

I think disabling the snippet feature will make a lot of issues (and I have to support it). In fact, your LSP server returns snippet items.

You can use other completion engines like ddc.vim etc.