nvim-compe icon indicating copy to clipboard operation
nvim-compe copied to clipboard

Add custom formatting functions

Open elkowar opened this issue 4 years ago • 4 comments

This PR adds new configuration options to allow advanced users to configure everything in how their results and documentation get's displayed. It does this by adding a new field to the configuration table. This may, for example, be used to achieve the feature requested in #209, by adding a simple function (which is used as an example in the readme). That configuration example results in the list as shown on this screenshot: image

Rationale

I spend a lot of time in my editor, mostly in a single language (rust). Optimizing small stuff is thus not only fun, but also worth it for me - and many others. Increasing flexibility like this allows advanced users to tweak the plugin to exactly what they need, and may have result in some popular snippets that everyone benefits from. For me specifically, I use this feature in my fork now, to show the mentioned type/function signature, as well as slightly clean up how results are displayed.

As a lot of this is very language server/source specific, its infeasible to add first-class support for the kind of small tweaks that I (and probably many others) would like to have. By allowing users to tweak this themselves, its possible to still be open for these kinds of changes.

Still, I of course see how this opens up a lot of internal API, which you may not be comfortable with. An alternative solution would be limiting the scope of these functions to only changing specific things about the results, and only showing the user a small, controlled subset of the data. If you feel uncomfortable merging this with the current amount of freedom, I'd of course be happy to adjust, limit or fully rethink how this flexibility is provided.

elkowar avatar May 16 '21 16:05 elkowar

The provided example config is still rather suboptimal right now, I'll fix that later.

elkowar avatar May 16 '21 17:05 elkowar

Done and ready for review!

elkowar avatar May 17 '21 12:05 elkowar

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '21 12:08 stale[bot]

This is not "an issue", it's a PR that someone spent time on. Opened #526 to change the bot's configuration.

kamalmarhubi avatar Aug 13 '21 22:08 kamalmarhubi