ncm2 + LanguageClient-neovim + gopls + usePlaceholders
Hi, I am using autozimu/LanguageClient-neovim@1ffab7ef19e2acae6f32c6f3a27581429d28e47b (v0.1.155)
It isn't obvious how to combine the following to have completion insertion automatically populate with placeholders. I have a settings.json for gopls that enables the usePlaceholders experimental function as per gopls/doc/settings.md and I can see from the LanguageClient.log (and also the server gopls -log) that this is being passed to gopls via 'workspace/didChangeConfiguration'. However, I don't see any change in behaviour from ncm2 when I accept a completion:
~/.config/nvim/init.vim
call plug#begin('~/.local/share/nvim/plugged')
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
let g:LanguageClient_autoStart = 1
let g:LanguageClient_autoStop = 1
let g:LanguageClient_hasSnippetSupport = 1
let g:LanguageClient_loadSettings = 1
let g:LanguageClient_settingsPath = $HOME.'/.config/nvim/settings.json'
let g:LanguageClient_serverCommands = {}
let g:LanguageClient_serverCommands.go = ['~/.local/bin/gopls', '-logfile', '/tmp/gopls.log', '-rpc.trace']
let g:LanguageClient_loggingLevel = 'DEBUG'
let g:LanguageClient_loggingFile = expand('~/.local/share/nvim/LanguageClient.log')
let g:LanguageClient_serverStderr = expand('~/.local/share/nvim/LanguageServer.log')
~/.config/nvim/settings.json
{
"gopls": {
"usePlaceholders": true
}
}
Am I misunderstanding how this feature is intended to be used? Using the same settings.json option for placeholders in VSCode is working as expected.
You may need https://github.com/SirVer/ultisnips and https://github.com/ncm2/ncm2-ultisnips to handle placeholders.
I installed ultisnips & ncm2-ultisnips. Placeholder(function parameter expansion) works well with gocode, but failed after migrating to gopls