hrsh7th / vim-vsnip-integ

vim-vsnip integrations to other plugins.
MIT License
128 stars 16 forks source link

When complete done. Does not expand snippet.. #32

Closed glepnir closed 4 years ago

glepnir commented 4 years ago

Problem

@hrsh7th It works fine befor. just when I update the latest neovim and update plugins. lspsaga is my custom lsp plugin.maybe you can use nvim-lspconfig.

set rtp+=~/.cache/vim/dein/repos/github.com/nvim-lua/completion-nvim
set rtp+=~/.cache/vim/dein/repos/github.com/hrsh7th/vim-vsnip
set rtp+=~/.cache/vim/dein/repos/github.com/hrsh7th/vim-vsnip-integ

lua require('lspsaga.saga').create_saga_augroup()

let g:completion_enable_auto_popup      = 1
let g:completion_trigger_on_delete      = 1
let g:completion_auto_change_source     = 1
let g:completion_matching_ignore_case   = 1
let g:completion_enable_snippet = 'vim-vsnip'
let g:completion_chain_complete_list = {
            \ 'default': {
            \   'default': [
            \      {'complete_items': ['lsp', 'snippet']},
            \      {'mode': '<c-n>'},
            \   ],
            \   'string': [
            \      {'complete_items': ['path']},
            \   ],
            \   'comment': [
            \      {'complete_items': ['path']},
            \   ],
            \ },
            \ }

let g:completion_confirm_key = ''
imap <expr> <CR>  pumvisible() ?
            \ complete_info()["selected"] != "-1" ? "\<Plug>(completion_confirm_completion)" : "\<c-e>\<CR>" :
            \ "\<CR>"

function! <SID>check_back_space() abort
    let l:col = col('.') - 1
    return !l:col || getline('.')[l:col - 1]  =~# '\s'
endfunction

inoremap <silent><expr> <TAB>
            \ pumvisible() ? "\<C-n>" :
            \ <SID>check_back_space() ? "\<TAB>" :
            \ completion#trigger_completion()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

augroup my_completion_nvim
    autocmd!
    autocmd BufEnter * lua require'completion'.on_attach()
augroup end

set completeopt=menuone,noinsert,noselect
set shortmess=aoOtTIc
set number
set signcolumn=yes

gopls config

  cmd = {"gopls","--remote=auto"};
  filetypes = {'go','gomod'};
  root_patterns = {'go.mod','.git'};
  -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#settings
  init_options = {
    usePlaceholders=true;
    completionDocumentation=true;
    completeUnimported=true;
  };

env

NVIM v0.5.0-aaaad0f
Build type: Release
LuaJIT 2.0.5

preview:

after

hrsh7th commented 4 years ago

Thank you for your report.

It's weird. I will investigate it...

hrsh7th commented 4 years ago

Ah, I understood the reason.

hrsh7th commented 4 years ago

I guess you update neovim recently. The latest neovim has breaking changes for snippet capability at https://github.com/neovim/neovim/pull/13183 .

I think it should support by vim-vsnip-integ automatically.

So I will create PR for it.

glepnir commented 4 years ago

Ok i saw it...tj did not tag me, I ignored this pr

glepnir commented 4 years ago

check https://github.com/nvim-lua/completion-nvim/issues/258 .

hrsh7th commented 4 years ago

@glepnir Could you test with #33 ?

glepnir commented 4 years ago

@hrsh7th Not fix..

hrsh7th commented 4 years ago

@glepnir Sorry... I was overlooked it...

I think we can't register capability automatically. Currently, nvim-lsp needs to register snippetSupport in each users.

glepnir commented 4 years ago

yep. I fixed in my custom lsp plugin.

glepnir commented 4 years ago

Anyway Thanks. closed.

hrsh7th commented 4 years ago

Some LSP client provides let g:***_snippet_enabled = v:true or v:false but nvim-lsp doesn't.

vim-lsc https://github.com/natebosch/vim-lsc/blob/master/plugin/lsc.vim#L18

vim-lsp https://github.com/hrsh7th/vim-vsnip-integ/blob/master/autoload/vsnip_integ/integration/vimlsp.vim#L14

LanguageClient-neovim https://github.com/hrsh7th/vim-vsnip-integ/blob/master/autoload/vsnip_integ/integration/lcn.vim#L5

hrsh7th commented 4 years ago

Thank you for your report!

glepnir commented 4 years ago

Ok I will talk with tj about this. provide an option will be better.