Shougo / ddc-source-lsp

lsp source for ddc.vim
Other
66 stars 20 forks source link

The source becomes slow in non-lsp buffer #22

Closed matsui54 closed 2 years ago

matsui54 commented 2 years ago

Problems summary

Nvim-lsp source becomes very slow in buffers which language server doesn't attach.

Expected

Completion menu appears immediately after typing.

Environment Information

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

set runtimepath+=~/.cache/dein/repos/github.com/vim-denops/denops.vim/
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc.vim
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc-nvim-lsp
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc-around
set runtimepath+=~/.cache/dein/repos/github.com/neovim/nvim-lspconfig

call ddc#custom#patch_global('sources', ['nvim-lsp', 'around'])
call ddc#custom#patch_global('sourceOptions', {
      \ 'around': {'mark': 'A'},
      \ 'nvim-lsp': {'mark': 'lsp'},
      \ })
call ddc#enable()
lua require'lspconfig'.clangd.setup{}

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Start nvim and type something like hoge ho.
  2. Complete menu appears with delay of few seconds (This does not occur in c buffer which server attaches).

The delay time seems 2000 ms which is timeout of ddc-source-option. I tried this config and the delay became shorter.

call ddc#custom#patch_global('sourceOptions', {'_': {'timeout': 100}})

Screenshot (if possible)

https://user-images.githubusercontent.com/63794197/136915709-cdbefcdb-5b12-4f0e-b134-077d20d22cc0.mp4

matsui54 commented 2 years ago

The problem occurs after #21.

Shougo commented 2 years ago

Oh, Ping @LumaKernel

Shougo commented 2 years ago

Reproduced.

Shougo commented 2 years ago

I will add the check.

LumaKernel commented 2 years ago

can you let me check the value of echo luaeval("(function()local x,y=vim.lsp.buf_request(0, 'textDocument/completion', vim.lsp.util.make_position_params(), function(_,a,b)end); return {x,y}end)()") when lsp is working?

matsui54 commented 2 years ago

[[5], function('<lambda>2757')] First item is request id and this value is empty when lsp is not working.

LumaKernel commented 2 years ago

thank you. https://github.com/Shougo/ddc-nvim-lsp/pull/23 may fix this.

matsui54 commented 2 years ago

I tried the PR and it seems to be fixed. Thank you!