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

Separate completion.menu.draw.components.label into label and label_details #843

Open
WieeRd opened this issue Jan 1, 2025 · 3 comments
Labels
feature New feature or request windows Module which displays UI

Comments

@WieeRd
Copy link

WieeRd commented Jan 1, 2025

Feature Description

I find it a little weird that label details are hardcoded into label instead of being a separate component.
Currently, there is no way to remove or rearrange label details from the label without rewriting the whole label components.

Was there a particular reason to having them bundled together?
If not, can we have them separated into label and label_details, to allow for greater customizability?

@WieeRd WieeRd added the feature New feature or request label Jan 1, 2025
@Saghen
Copy link
Owner

Saghen commented Jan 1, 2025

I agree but we'd need to add support for different gaps between components. I'd imagine it'd work like gap = { 0, 1 } (components a and b have no gap, components b and c have gap of 1). PR is welcome if you're interested in working on this

@WieeRd
Copy link
Author

WieeRd commented Jan 1, 2025

Ahh, so it was because you preferred to not have any gaps between the label and label details.
{ { "label", "label_details", "label_description" } } removes the gap between the details and the description,
While { { "label", "label_details" }, { "label_description" } } sends the description to the next alignment column.

One way to work around this without reworking gap is to add a "space" component, which does nothing but return a single space.

completion.menu.draw = {
  columns = { { 'kind_icon' }, { 'label', 'label_details', 'space' 'label_description' } },
  components = {
    space = { text = function(_) return " " end },
    ...
  },
}

Alternatively, simply including a detail-less version of label in the plugin would make it a lot convenient to customize, although this would be adding an unused code for a potential niche (no idea how many people will want to rearrange label details) use case.

@Saghen
Copy link
Owner

Saghen commented Jan 1, 2025

Ahh, so it was because you preferred to not have any gaps between the label and label details.

Yeah, the spec actually mentions this explicitly

One way to work around this without reworking gap is to add a "space" component, which does nothing but return a single space.

I'd prefer to make the change to gap rather than hacking around it since I think it should be quite easy

@Saghen Saghen added the windows Module which displays UI label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request windows Module which displays UI
Projects
None yet
Development

No branches or pull requests

2 participants