hrsh7th / nvim-cmp

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

cmp.mapping.confirm in VHDL file breaks nvim #734

Closed miklhh closed 2 years ago

miklhh commented 2 years ago

FAQ

Issues

Neovim Version

NVIM v0.6.1 Build type: Gentoo Lua 5.1 Compilation: /usr/bin/x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/var/tmp/portage/app-editors/neovim-0.6.1/work/neovim-0.6.1_build/config -I/var/tmp/portage/app-editors/neovim-0.6.1/work/neovim-0.6.1/src -I/usr/include -I/var/tmp/portage/app-editors/neovim-0.6.1/work/neovim-0.6.1_build/src/nvim/auto -I/var/tmp/portage/app-editors/neovim-0.6.1/work/neovim-0.6.1_build/include Compiled by portage@localhost Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "/etc/vim/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info

Minimal reproducible config

The minimal config used to reproduce this issue is exactly matching the example minimal reproducible config.

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = {
    { name = "nvim_lsp" },
    { name = "buffer" },
  },
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())

require'lspconfig'.cssls.setup {
  capabilities = capabilities,
}
EOF

Description

See: Steps to reproduce.

Steps to reproduce

(1) Files used to reproduce error.

> ls
minimal-init.vim  test.vhdl

(2) Bare minimum VHDL file with preamble only.

> cat test.vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

(3) Open test.vhdl with nvim using the minimal config.

> nvim -u minimal-init.vim test.vhdl

(4) Create a new line at the bottom of the file. Start inserting iee and let cmp-buffer suggest ieee from the nvim-cmp drop down menu. Select ieee from the drop down menu and use <CR> to call cmp.mapping.confirm({ select = true }) from the minimal config.

(5) Observe.

1

2

E518: Unknown option: ,=~is,=~select,=~when,=~if,=~then,=~elsif,=~else,=~case,=~loop,=~for,=~generate,=~record,=~units,=~process,=~block,=~function,=~component,=~procedure,=~architecture,=~configuration,=~entity,=~package

Expected behavior

Normal autocompletion, as it works for all other filetypes, beside the VHDL file type.

Actual behavior

E518: Unknown option: ,=~is,=~select,=~when,=~if,=~then,=~elsif,=~else,=~case,=~loop,=~for,=~generate,=~record,=~units,=~process,=~block,=~function,=~component,=~procedure,=~architecture,=~configuration,=~entity,=~package

Additional context

No response

miklhh commented 2 years ago

I've now asked a friend of mine to reproduce this issue aswell, from a different system:

NVIM v0.6.1
Build type: Release
LuaJIT 2.0.5
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

He experiences the same issue.