This repository was archived by the owner on Jan 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 52
Add custom formatting functions #378
Open
elkowar
wants to merge
1
commit into
hrsh7th:master
Choose a base branch
from
elkowar:formatting-functions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)
0a5dd39
to
0a134b3
Compare
Done and ready for review! |
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. |
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)
This is not "an issue", it's a PR that someone spent time on. Opened #526 to change the bot's configuration. |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.