uga-rosa / cmp-dictionary

A dictionary completion source for nvim-cmp
MIT License
236 stars 16 forks source link

Very long delay after a buffer is opened #55

Closed farzadmf closed 5 months ago

farzadmf commented 5 months ago

Hi, first of all, thank you for the plugin. It's a life saver for me, being an old CoC user, which had this feature.

I think it's a recent issue I'm noticing, but when I open a buffer in Neovim, I saw a HUGE delay until my cursor becomes interactive (the UI is basically frozen).

I do have A LOT of plugins, however I managed to pin the issue down to this plugin: when I disable this, my cursor is instantly interactive and I can immediately start interacting with the buffer, but if it's enabled, I have that delay.

I'm not configuring anything for the plugin and just loading it as a dependency (like below). Is there a setting I can configure to avoid the delay?

I'm using lazy.nvim as my package manager:

-- nvim-cmp
return {
  'hrsh7th/nvim-cmp',
  event = 'VeryLazy',
  dependencies = {
    -- other sources ...
    'uga-rosa/cmp-dictionary'
  },
  -- other settings for nvim-cmp
}
uga-rosa commented 5 months ago

As noted in the documentation, this plugin works without setup. The path to the dictionary is referenced by &dictionary. In other words, you have a huge dictionary set up in &dictionary, and there is probably a delay in reading it.

uga-rosa commented 5 months ago

I plan to rewrite the asynchronous area using plenary, but I am currently busy with my graduate school graduation coming up, so I am not sure when it will be completed.

farzadmf commented 5 months ago

but I am currently busy with my graduate school graduation coming up

Totall understandable, I hope everything goes well for you.

so I am not sure when it will be completed

I'm busy myself as well, but I might be able to try to take a stab at it, if you can share some pointers etc. to what's involved (if you have time of course).

If you think you'd have time for reviews, then maybe we can make some progress while you're busy.

A lot of _if_s here at play 😆

uga-rosa commented 5 months ago

I'm working on the v3 branch. I decided to use luv directly instead of plenary, but I was able to avoid blocking the mainframe. Merge is close :)

mkalinski commented 5 months ago

As noted in the documentation, this plugin works without setup. The path to the dictionary is referenced by &dictionary. In other words, you have a huge dictionary set up in &dictionary, and there is probably a delay in reading it.

Please note, that this bug started happening only after d17bc1f87736b6a7f058b2f246e651d34d648b47 . If I roll that one commit back, then the huge delay completely disappears, with the same dictionary file size, and dictionary completion still works.

farzadmf commented 5 months ago

Merge is close :)

Oh wow, I hope it happens soon 😛

farzadmf commented 5 months ago

that this bug started happening only after d17bc1f

Oh good to know, so I was not hallucinating. I was like "man, was this delay always here and I never noticed??", but I doubted myself and said "yeah, I guess I didn't notice it before!"

uga-rosa commented 5 months ago

I released v3. Some options have been sorted out, so please see #56 (See doc for details).

farzadmf commented 4 months ago

@uga-rosa sorry for the SUUUUPER long delay. I just recently got back to this.

I had disabled cmp-dictionary in my config because of the delay, and I've now enabled it. But, I don't seem to see any words from the "dictionary"?

Are the settings mentioned in the README now mandatory? I think it was working before without custom settings (I may be totally wrong!)

I do see dictionary in CmpStatus, but let's say if I open a new empty buffer and type he or hel, I expect to see hell, hello, etc. being suggested, but I don't see any.


EDIT: tried with the options in the README and still no luck


EDIT2: seems like the following options are mandatory?

paths = { '/usr/share/dict/words' },
exact_length = 2,
first_case_insensitive = true,

(or at least the paths one). Can you please confirm if that's the epxected behavior? I'm pretty sure it was working before without me specifying which file to use

mkalinski commented 4 months ago

Can you please confirm if that's the epxected behavior? I'm pretty sure it was working before without me specifying which file to use

I can confirm that. Previously this plugin used the dictionary nvim option, now it doesn't do that and setup with paths is mandatory.

farzadmf commented 4 months ago

Ah OK, makes sense.

And @mkalinski Do you know if the dictionary entires are the ones appearing as Text type in the completion menu?

mkalinski commented 4 months ago

Yes, entries from dictionary completion are Text. Though other sources could be Text as well, depending on what you're using, cmp doesn't show entry source by default.