Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

LanguageClient-neovim cquery auto-snippets leaving <|0|> at the end of snippet #463

Closed peopleskai closed 5 years ago

peopleskai commented 5 years ago

I am trying to setup neosnippet, deoplete and languageclient-neovim. I have to experiencing an issue with auto complete snippets leaving the end marker as plain text in the file. I believe I have all plugins updated to date (Monday , Feb. 11, 2019 PST)

screen shot 2019-02-11 at 12 10 04 pm

neovim version:

NVIM v0.3.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS
-D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20190113-94620-d8vv4n/neovim-0.3.4/build/config -I/tmp/neovim-20190113-94620-d8vv4n/neovim-0.3.4/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/u
sr/include -I/tmp/neovim-20190113-94620-d8vv4n/neovim-0.3.4/build/src/nvim/auto -I/tmp/neovim-20190113-94620-d8vv4n/neovim-0.3.4/build/include
Compiled by brew@Mojave.local

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.4/share/nvim"

neovim checkhealth:


health#deoplete#check
========================================================================
## deoplete.nvim
  - OK: exists("v:t_list") was successful
  - OK: has("timers") was successful
  - OK: has("python3") was successful
  - OK: Python3.5+ was successful
  - INFO: If you're still having problems, try the following commands:
    $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    $ nvim
    $ cat /tmp/log_{PID}
    and then create an issue on github

health#LanguageClient#check
========================================================================
  - OK: binary found: /Users/tonyyuen/.config/nvim/plugged/LanguageClient-neovim/bin/languageclient
  - OK: languageclient 0.1.139 8eba06bf6540915deeae7da9b239f0f918e20cd9

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='iTerm.app'
  - INFO: $COLORTERM='truecolor'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/local/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python does not have the "neovim" module. :help |provider-python|
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/local/bin/python3
  - INFO: Python version: 3.7.0
  - INFO: pynvim version: 0.2.6 (outdated; from /usr/local/lib/python3.7/site-packages/neovim)
  - WARNING: Latest pynvim is NOT installed: 0.3.2

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v8.10.0
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

Minimal init.vim as follows:

" Enable full vim features
set nocompatible

" python version
let g:pymode_python = 'python3'

" set leader to ";"
let mapleader=";"

" hybrid line number
set number relativenumber

" Specify a directory for plugins
call plug#begin('~/.config/nvim/plugged')

Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets'

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }

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

call plug#end()

" Snippet settings
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)
xmap <C-k>     <Plug>(neosnippet_expand_target)
" For conceal markers.
if has('conceal')
  set conceallevel=2 concealcursor=niv
endif

" deoplete settings
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1
let deoplete#tag#cache_limit_size = 5000000
call deoplete#custom#option({
    \ 'auto_complete_delay': 0,
    \ 'auto_refresh_delay' : 100,
    \ })
call deoplete#custom#source('LanguageClient',
            \ 'min_pattern_length',
            \ 2)

" LanguageClient-neovim settings
set signcolumn=yes
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
    \ 'cpp': ['cquery', '--log-file=/tmp/cq.log'],
    \ 'c': ['cquery', '--log-file=/tmp/cq.log'],
    \ }
let g:LanguageClient_loadSettings = 1
let g:LanguageClient_settingsPath = '/Users/tonyyuen/.config/nvim/settings.json'

function SetLSPShortcuts()
  nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
  nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
  nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
  nnoremap <leader>lt :call LanguageClient#textDocument_typeDefinition()<CR>
  nnoremap <leader>lx :call LanguageClient#textDocument_references()<CR>
  nnoremap <leader>la :call LanguageClient_workspace_applyEdit()<CR>
  nnoremap <leader>lc :call LanguageClient#textDocument_completion()<CR>
  nnoremap <leader>lh :call LanguageClient#textDocument_hover()<CR>
  nnoremap <leader>ls :call LanguageClient_textDocument_documentSymbol()<CR>
  nnoremap <leader>lm :call LanguageClient_contextMenu()<CR>
endfunction()
augroup LSP
  autocmd!
  autocmd FileType cpp,c call SetLSPShortcuts()
augroup END
Shougo commented 5 years ago

It is the feature of LanguageServer (cquery). Closing.

peopleskai commented 5 years ago

But after expanding the snippet with neosnippet, the last marker can't be jumped to. The last marker <|0|> is also not removed after expansion, resulting in compilation failure.

So neosnippet and cquery with LanguageClient-neovim is just not compatible?

Thanks!

Shougo commented 5 years ago

I have confirmed.

Shougo commented 5 years ago

Fixed.

peopleskai commented 5 years ago

Thanks @Shougo!! It works great now!