Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP function parameter expansion doesn't work #19

Open
cjun714 opened this issue May 15, 2019 · 2 comments
Open

LSP function parameter expansion doesn't work #19

cjun714 opened this issue May 15, 2019 · 2 comments

Comments

@cjun714
Copy link

cjun714 commented May 15, 2019

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!

@faulesocke
Copy link

Have exactly the same problem but with Rust instead of go. Not even the settings from ncm2/ncm2#19 did work.

@faulesocke
Copy link

Looks like this is an issue with LanguageClient-neovim. Solution:

let g:LanguageClient_hasSnippetSupport = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants