uga-rosa / cmp-dictionary

A dictionary completion source for nvim-cmp
MIT License
237 stars 17 forks source link

Possibility to show which dictionary does a word belong to ? #5

Closed vorban closed 2 years ago

vorban commented 2 years ago

For example, with the cmp-path plugin, the type (file/folder) of each choice is displayed:

image

Is there any way to get the source dictionary in the same way ?

For example, I have two dictionary files: path/to/dic/EN and path/to/dic/FR. I would like, instead of the Text placeholder, have the corresponding file (EN/FR in my case) :

image

I don't have any dev experience in lua nor vim so I really don't know how feasible that would be based on your implementation.

Regardless, thank you for your time and efforts with this nice plugin 😃

uga-rosa commented 2 years ago

That's a feature embedded in the main unit. As you can see here, what I can specify from the source are 25 enums (which are actually numbers) that correspond to LSP items, and the corresponding text is displayed. "Text" itself is not specified by this plugin (maybe).

https://github.com/hrsh7th/nvim-cmp/blob/286b9f78d1013d4f4d3a70efcc803d00912dfe35/lua/cmp/types/lsp.lua#L108

uga-rosa commented 2 years ago

Oh, I asked hrsh7th about it, and it looks like it can be done, so I'll try it when I wake up (it's midnight in my country now, so I'm going to bed).

uga-rosa commented 2 years ago

I have dictionary=/usr/share/dict/words, so it shows up like this. What do you think?

image

uga-rosa commented 2 years ago

There's no reply, so I'll close it.

vorban commented 2 years ago

My apologies, I was incapacitated for the past few months.

This is indeed what I was looking for, thank you very much !