Skip to content

LSP function parameter expansion doesn't work #19

@cjun714

Description

@cjun714

Plugin can complete function name, but it can't expand any function parameters,.
The language is go, using go-langserver as lsp.
All plugins and lsp are newest, neovim 0.4.0 on Linuxmint 19.04

I use key '(' to trigger parameter expansion.

Expected behaviour:
void foo ----------> void foo( -----------> void foo(a int, b int)

Below setting worked fine before(few months ago), but it can't work any more now.

" vim-plug {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')

" snippets
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'cjun714/vim-snippets-plus'

" lsp
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }

" ncm2
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
if !has("nvim")
  Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'ncm2/ncm2-ultisnips'

call plug#end()

" }}}

" SirVer/ultisnips {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger='<C-f>'
let g:UltiSnipsJumpBackwardTrigger='<C-h>'

" }}}
" autozimu/LanguageClient-neovim {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> gf :call LanguageClient#textDocument_references()<CR>
nnoremap <leader> rn :call LanguageClient#textDocument_rename()<CR>

let g:LanguageClient_loadSettings = 1
let g:LanguageClient_settingsPath = expand('~/.vim/languageclient.json')

let g:LanguageClient_completionPreferTextEdit = 1 " ?
let g:LanguageClient_diagnosticsEnable = 1
let g:LanguageClient_selectionUI = 'quickfix'
let g:LanguageClient_serverCommands = {}
let g:LanguageClient_serverCommands.go = ['go-langserver']
let g:LanguageClient_serverCommands.rust = ['rls']
let g:LanguageClient_serverCommands.vue = ['vls']
let g:LanguageClient_serverCommands.javascript = ['javascript-typescript-stdio']
let g:LanguageClient_serverCommands.typescript = ['javascript-typescript-stdio']

" }}}
" ncm2/ncm2 {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufEnter *.rs,*.go,*.html,*.ts,*.js,*.css,*.vue,*.md call ncm2#enable_for_buffer()
set shortmess+=c
set completeopt=noinsert,menuone,noselect
au TextChangedI * call ncm2#auto_trigger()

inoremap <c-c> <ESC> " map C-c to trigger InsertLeave autocmd
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
"inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

" }}}
" ncm2/ncm2-ultisnips {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" use '(' to trigger snippet expansion
inoremap <silent> <expr> ( ncm2_ultisnips#expand_or("()", 'n')

" imap <c-u> <Plug>(ultisnips_expand)
"let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
let g:UltiSnipsJumpForwardTrigger = "<c-f>"
let g:UltiSnipsJumpBackwardTrigger  = "<c-h>"
let g:UltiSnipsRemoveSelectModeMappings = 0

" }}}

I also use settings in ncm2/ncm2#19 (comment), but it also can't work now.

Please help, thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions