completion-nvim icon indicating copy to clipboard operation
completion-nvim copied to clipboard

Sumneko-lua showing out of context autocomplete selections

Open McArdellje opened this issue 4 years ago • 1 comments

My testing minimal init.vim

" install plugins
call plug#begin('~/.vim/vimplug')
    Plug 'neovim/nvim-lspconfig'
    Plug 'nvim-lua/completion-nvim'
call plug#end()

" configure autocomplete
lua << EOF
require'lspconfig'.sumneko_lua.setup {
    cmd = {"/usr/bin/lua-language-server"},
    settings = {},
    on_attach=require'completion'.on_attach
}
EOF

How to reproduce make a new lua file and type

local tbl = {key = "value"}

then (on a new line) type tbl. and look at the autocomplete suggestions

Expected behavior one suggestion appears named key (like it does in the vscode extension that the language server is from)

Current behaviour all variables and snippets appear even though they would be invalid in that context

McArdellje avatar May 27 '21 18:05 McArdellje

I also find another problem. When g:completion_enable_server_trigger is set to 1, and auto popup is enabled (which is default), it will trigger auto pop up even on space, which is annoying. I find sumneko-lua will provide '\n', '\t', ' ', ... as trigger characters. But in VSCode, it will not trigger auto popup.

PascalZh avatar Sep 01 '21 08:09 PascalZh