cmp-nvim-lsp icon indicating copy to clipboard operation
cmp-nvim-lsp copied to clipboard

keyword_length option for other sources

Open fastbodin opened this issue 3 years ago • 4 comments

Hi there,

Again, thank you for all your work on this plugin. A while ago you kindly fixed an issue I raised here

https://github.com/hrsh7th/nvim-cmp/issues/444

I was wondering how difficult it would be to add this sort of feature to other sources? Like nvim-lsp or latex-symbols for example?

Thanks again!

fastbodin avatar Nov 26 '21 02:11 fastbodin

Your description is hard to understand for me. Can you describe the feature more clearly? It is keyword length sort?

Note: It seems keyword length option in buffer source for other sources.

Shougo avatar Nov 26 '21 03:11 Shougo

Apologies, I thought referencing the original issue would make it clear. I hope the following is makes it clear.

In the (resolved) issue referenced above, I was asking if it was possible to add a configuration to sources that would exclude all suggestions of words that were less than X characters in length (the feature being able to change the value of X). After this request, this configuration was added to

https://github.com/hrsh7th/cmp-buffer

The new option was keyword_length. So, if add the following to my cmp_config

sources = cmp.config.sources({ { name = 'buffer', option = {keyword_length = 6} } }

then all words of length < 6 are not included as suggestions in the drop down menu.

This has been a fantastic feature for me. This has been implemented as a configuration option in buffer sources but I was wondering if it is possible to add it as a configuration option in other sources like

https://github.com/hrsh7th/cmp-nvim-lsp

or

https://github.com/kdheepak/cmp-latex-symbols

for instance.

I should also note, I (qualitatively) have found this feature has decreased the lag I sometimes experience while typing when I am working in a really large file. This is partially why I was interested in having this feature in other sources.

fastbodin avatar Nov 26 '21 03:11 fastbodin

OK. The description is clear.

Note: The issue title is not clear for me. It should be renamed.

My suggestion is: keyword_length option for other sources

Shougo avatar Nov 26 '21 03:11 Shougo

Done!

fastbodin avatar Nov 26 '21 04:11 fastbodin