quangnguyen30192 / cmp-nvim-ultisnips

nvim-cmp source for ultisnips
Apache License 2.0
145 stars 19 forks source link

feat, refactor: make use of new parser for nicer cmp preview docs #21

Closed smjonas closed 2 years ago

smjonas commented 2 years ago

Now the parser introduced in #20 is utilized to provide more info to cmp items. This info is used to improve the cmp documentation / preview window (currently defaults to a hardcoded implementation showing the description and snippet contents).

Snippets with option 'r' or 'e' are parsed but not passed on to cmp at the moment.

Here is a screenshot for a snippet with the following definition:

snippet tabt "Some description"
The snippet contents
endsnippet

cnu-documentation_preview

The documentation is provided by a function that takes the snippet info table as a parameter and returns a string. We could let users overwrite this so they can display whatever they want, e.g. also show the options associated with a snippet.

I have tested this and it should work (also the tests still pass). But please test this PR first before merging :) Suggestions for improvement / changes are welcome.

smjonas commented 2 years ago

Force pushed to remove cur_info.ft = in line 30

quangnguyen30192 commented 2 years ago

Thanks, tested it and displayed nicely