ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.5k stars 98 forks source link

Various completion glitches #99

Open YodaEmbedding opened 3 years ago

YodaEmbedding commented 3 years ago

Reproducible environment

Copy and paste this into your terminal:

mkdir -p ~/.local/share/nvim/site/pack/bundle
cd ~/.local/share/nvim/site/pack/bundle
git clone https://github.com/neovim/nvim-lspconfig
git clone https://github.com/ms-jpq/coq_nvim
echo '
let $PLUGIN_DIRECTORY = "~/.local/share/nvim/site/pack/bundle"
set runtimepath^=$PLUGIN_DIRECTORY/nvim-lspconfig
set runtimepath^=$PLUGIN_DIRECTORY/coq_nvim

lua << EOF
local nvim_lsp = require("lspconfig")
local coq = require("coq")
nvim_lsp.pyright.setup {}
vim.cmd [[COQdeps]]
vim.cmd [[COQnow -s]]
EOF
' > ~/init_tmp.vim
nvim --clean -u ~/init_tmp.vim tmp.py

Test cases

  1. idefault<Tab><CR><Esc>

    Expected:

    from collections import defaultdict
    
    defaultdict

    Actual:

    from collections import defaultdict
    
    default
  2. idefaultdict<Esc>Icollect<Tab><CR>.<Esc>

    Expected:

    import collections
    
    collections.defaultdict

    Actual:

    import collections
    
    collectdefa.ultdict
  3. iimport collections<CR><CR>defaultdict<Esc>Icollect<Tab><CR>.<Esc>

    Expected:

    import collections
    
    collections.defaultdict

    Actual:

    import collections
    
    collections.
  4. ihello<CR>hello<Esc>*cgnimp<C-n><CR><Esc>.

    Expected:

    import
    import

    Actual:

    import
    imp

    (Adapted from: https://github.com/ms-jpq/coq_nvim/issues/47.)

I think the first two only happen in new and empty files. The third and fourth ones are the important ones since they happen very often in non-empty files.

ms-jpq commented 3 years ago

thank you this is gonna be next PR

ms-jpq commented 3 years ago

i think most of the issues come from the fact that I I didn't write my code to handle multiple edits on the same line, which happens for 1) and 2).

the . one might not be doable, at least not without hampering fuzzy searching

ms-jpq commented 3 years ago

https://github.com/ms-jpq/coq_nvim/pull/130 fixes 1) and 2), but the . still needs investigating

dtomvan commented 3 years ago

If I complete anything (including snippets), coq spits out complete nonsense. Help?

ms-jpq commented 3 years ago

please post a screenshot, i dont know what do you mean by that

YodaEmbedding commented 3 years ago

@dtomvan It might be better to create a new issue since it might not be related to these.

dtomvan commented 3 years ago

Im’ma make a GIF in a new issue.

Edit: in a couple of hours

dtomvan commented 3 years ago

This is https://github.com/ms-jpq/coq_nvim/issues/34?

dtomvan commented 3 years ago

Okay, now I have this output. My coq install seems very broken.

end_col out of bounds
Traceback (most recent call last):
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_
pp/logging.py", line 31, in with_suppress
    yield None
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_
pp/lib.py", line 43, in wrapper
    return await aw
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/server/registrants/omnifunc.py", line 189, in
 cont
    inserted = await async_call(
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_
pp/lib.py", line 83, in async_call
    return await loop.run_in_executor(None, fut.result)
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 445, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_
pp/lib.py", line 74, in cont
    ret = fn(*args, **kwargs)
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/server/registrants/omnifunc.py", line 191, in
 <lambda>
    lambda: edit(
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/server/edit.py", line 372, in edit
    inserted = _restore(nvim, buf=buf, pos=state.context.position, before=before)
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/server/edit.py", line 356, in _restore
    nvim.api.buf_set_text(buf, row, l1, row, h1, (replace,))
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim/
api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/home/tomvd/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim/
msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: end_col out of bounds

Edit: my configs: https://github.com/dtomvan/.config Edit: I changed my configs to temporarily not include any auto pairs plugin. coq just lags out when I try to use it tho.

dtomvan commented 3 years ago

Video: https://imgur.com/z09aJSs