Languageclient-neovim: Calling `s:Debug` triggers substitute?

Created on 12 Nov 2018  路  8Comments  路  Source: autozimu/LanguageClient-neovim

  • ~Did you upgrade to latest plugin version?~ Yes
  • ~Did you upgrade to/compile latest binary? Run shell command
    bin/languageclient --version to get its version number.~ Yes, languageclient 0.1.125 6da13424fcfa3538b7b7e4629c39918d1d2d43e3
  • ~(Neovim users only) Did you check output of :checkhealth LanguageClient?~ Yes, all checks pass.
  • ~Did you check [troubleshooting]?~ Yes, nothing relevant is there.

Describe the bug

Upon entering a buffer that triggers the conditional here: https://github.com/autozimu/LanguageClient-neovim/blob/next/autoload/LanguageClient.vim#L403 and calling any LCN function that eventually uses LanguageClient#Write (which is most after the recent refactoring) an error is thrown: E486: Pattern not found: Debug('Skip sending message'). It appears that Neovim is interpreting s:Debug(...) at https://github.com/autozimu/LanguageClient-neovim/blob/next/autoload/LanguageClient.vim#L404 as a substitute expression rather than a call to the script-local function Debug. I have no idea why this would happen, though.

Environment

  • neovim/vim version (nvim --version or vim --version):
NVIM v0.3.1
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wconversion -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.3.1/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

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

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

Run :checkhealth for more info
  • This plugin version (git rev-parse --short HEAD): 6da1342
  • This plugin's binary version (bin/languageclient --version): languageclient 0.1.125 6da13424fcfa3538b7b7e4629c39918d1d2d43e3
  • Minimal vimrc content (A minimal vimrc is the smallest vimrc that could
    reproduce the issue. Refer to an example here):
call plug#begin('~/.local/share/nvim/plugs')
Plug 'autozimu/LanguageClient-neovim', {
      \ 'branch': 'next',
      \ 'do': 'make -j 8 release',
      \ }
call plug#end()

function! Foo(bar)
  echo 'Called me!'
endfunction
  • Language server link and version: N/A

To Reproduce

Steps to reproduce the behavior:

  1. Save the above minimal vimrc as minrc.vim (or whatever).
  2. Start Neovim: nvim -u minrc.vim
  3. Run (as an example): :call LanguageClient#isAlive(function('Foo'))
  4. Observe the error raised

Current behavior

An error is thrown whenever a LCN function is called in a buffer matching the conditional at https://github.com/autozimu/LanguageClient-neovim/blob/next/autoload/LanguageClient.vim#L403.

Expected behavior

No error should be thrown.

Screenshots

N/A unless you cannot reproduce the error

Additional context

This was discovered because I have the following in my config:

function! LspMaybeHover(is_running) abort
  if a:is_running.result
    call LanguageClient#textDocument_hover()
  endif
endfunction

function! LspMaybeHighlight(is_running) abort
  if a:is_running.result
    call LanguageClient#textDocument_documentHighlight()
  endif
endfunction

augroup lsp_aucommands
  au!
  au CursorHold * call LanguageClient#isAlive(function('LspMaybeHover'))
  au CursorMoved * call LanguageClient#isAlive(function('LspMaybeHighlight'))
augroup END

Upon entering an empty buffer (i.e. just running nvim), these autocommands would cause isAlive to be called and exhibit the error.

All 8 comments

Thanks for reporting.

Thanks for the quick fix!

@autozimu is there is a way to disable this completely? because it gets triggered on every buffer so I get the message on Startify & when I search using fzf.vim etc... so every time I search for a file I get this message _multiple times_ & it hangs the action until I click an extra key. Which is a bit annoying.

Notice how it logs multiple messages when I call :Files from fzf.vim

message

@ahmedelgabri I've just removed that line (call s:Debug('Skip sending message')) from .vim/plugged/LanguageClient-neovim/autoload/LanguageClient.vim.

@semirook this is a temp workaround _which is fine for now_, but it'd better if this is fixed properly

@ahmedelgabri Actually, Goto Definition is broken for me too. So I've reverted to the latest stable state af81ad3 and it's ok now.

I believe you have g:LanguageClient_loggingLevel set in your vimrc.

The latest change removed that and sorry for the inconvenience.

No worries at all!

And yes after I disabled g:LanguageClient_loggingLevel it works fine.

Was this page helpful?
0 / 5 - 0 ratings