Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Utility Gutter #1272

Closed
wants to merge 3 commits into from

Conversation

dannasessha
Copy link
Contributor

DRAFT. Fixes #1188.

Working toward an additional, configurable gutter, and to make gutters more configurable generally.

The new utility gutter should be able to handle arbitrary text, likely corresponding to the opened document. For example, the gutter could display short commit hashes by line provided by git annotate.

@sudormrfbin
Copy link
Member

We don't have plugins yet, so configuring the utility gutter to show arbitrary text would have to happen through the TOML config, and I'm not sure if we should allow that. I imagine it would need to execute a shell command, clip the output size, conditionally run it, etc. It could grow into a DSL within the toml config and that's something we want to avoid (i.e. strapping on programming features to a config language).

@archseer
Copy link
Member

Yeah, I was expecting the gutter fns themselves be flexible enough that plugins can use them to define new gutters -- rather than one generic utility gutter.

@archseer
Copy link
Member

The config would just be an array of which gutters to use (and the widths?), it would replace the hard-coded gutters in view.rs

@dannasessha
Copy link
Contributor Author

Thank you both for looking over this code.

We don't have plugins yet, so configuring the utility gutter to show arbitrary text would have to happen through the TOML config, and I'm not sure if we should allow that. I imagine it would need to execute a shell command, clip the output size, conditionally run it, etc. It could grow into a DSL within the toml config and that's something we want to avoid (i.e. strapping on programming features to a config language).

I wouldn't want to put scripting into the TOML.

Yeah, I was expecting the gutter fns themselves be flexible enough that plugins can use them to define new gutters -- rather than one generic utility gutter.

Okay. I really don't know what type of interface plugins are going to have, but I do think I understand what you're saying overall.

I think having multiple possible gutters specified by plugins or other means like TOML and making it extensible sounds great! Do you mean by abstracting GUTTERS to iterate over a collection of function calls?

I see #769 but I didn't study it yet.

I was hoping (at least ultimately) to have the ability to do things like pass arbitrary text (maybe plugin or real-time, or pre-generated) to the gutters (which I would imagine would often correspond to line numbers) but I also didn't know exactly how I was going to approach it. Right now the out which prints to the user's gutter is defined in gutters.rs, matching the previously exisiting gutters, maybe we could incorporate reading in another buffer or file, or some kind of similar function within that module..?

Is there a plugin interface that I should look at? Or even a plan for one I could use to demo something?

The config would just be an array of which gutters to use (and the widths?), it would replace the hard-coded gutters in view.rs

Yes, and I have been working locally on some things more in this direction, I think. What you're suggesting might not come online immediately but I'd like to continue on this branch if it's worth people's time to consider.

@irevoire
Copy link
Contributor

irevoire commented Dec 20, 2021

(and the widths?)

I would very much like to not make the width mandatory if possible.

@dannasessha
Copy link
Contributor Author

dannasessha commented Dec 21, 2021

(and the widths?)

I would very much like to not make the width mandatory if possible.

My plan is to make the current two gutters default to on (diagnostic has width 1, no reason to change it by default that I see.) Other non-line-number gutters would not be on by default, they would have to be triggered by virture of a user signal, either by a plugin or a config are my two current thoughts.

The line_number gutter width is currently hard coded to 5, with tests to go along with that setting. I would like to make this width elastic (including allowing 0 by config) - probably matching the number of lines in the file, if that is possible. I will have to test what happens when a document goes above or below a number limited by the number of digits and try to avoid confusing situations. I see that some work has been done around #769, I will investigate.

@dannasessha
Copy link
Contributor Author

I wasn't able to definitively cut into this problem with my level of understanding of helix.

I still think having a configurable utility gutter (and flexible, configurable width gutters) is a good idea, but I was not yet able to make definitive progress. I may try to return to this issue, but I have stopped active attempts for the time being.

@dannasessha
Copy link
Contributor Author

Pushing commits of last changes I was working with locally.

@pickfire pickfire marked this pull request as draft January 9, 2022 15:12
@pickfire
Copy link
Contributor

pickfire commented Jan 9, 2022

@dannasessha I converted it to draft, later once you are done can convert it back.

@the-mikedavis
Copy link
Member

Should we close this out? With #1967 merged it may be easier to restart from master. The customizable "utility" gutters may have to await the plugin system anyways, no?

@archseer
Copy link
Member

Yep, agreed

@archseer archseer closed this Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make gutters more configurable
6 participants