Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.

Add custom formatting functions #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elkowar
Copy link

@elkowar elkowar commented May 16, 2021

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 elkowar changed the title Add custom formatting functions WIP: Add custom formatting functions May 16, 2021
@elkowar
Copy link
Author

elkowar commented May 16, 2021

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

The custom formatters allow users to intercept the data in different
places, providing the option for them to re-format text or change
how/what data is getting displayed. (fixes hrsh7th#209)
@elkowar elkowar force-pushed the formatting-functions branch from 0a5dd39 to 0a134b3 Compare May 17, 2021 12:54
@elkowar elkowar changed the title WIP: Add custom formatting functions Add custom formatting functions May 17, 2021
@elkowar
Copy link
Author

elkowar commented May 17, 2021

Done and ready for review!

@stale
Copy link

stale bot commented Aug 13, 2021

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 stale bot added the wontfix This will not be worked on label Aug 13, 2021
kamalmarhubi added a commit to kamalmarhubi/nvim-compe that referenced this pull request Aug 13, 2021
I dislike bots like this generally, but I especially think it's disheartening to auto-reject PRs. I'd think more than twice about contributing to a project if I thought my contribution would eventually be closed by a bot. See hrsh7th#378 (comment).
kamalmarhubi added a commit to kamalmarhubi/nvim-compe that referenced this pull request Aug 13, 2021
I dislike bots like this generally, but I especially think it's
disheartening to auto-reject PRs. I'd think more than twice
about contributing to a project if I thought my contribution
would eventually be closed by a bot. For an example, see
  hrsh7th#378 (comment)
@kamalmarhubi
Copy link
Contributor

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

@stale stale bot removed the wontfix This will not be worked on label Aug 13, 2021
hrsh7th pushed a commit that referenced this pull request Aug 14, 2021
I dislike bots like this generally, but I especially think it's
disheartening to auto-reject PRs. I'd think more than twice
about contributing to a project if I thought my contribution
would eventually be closed by a bot. For an example, see
  #378 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants