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

Allow to customize float window appearance e.g. of the doctor #579

Open
lervag opened this issue Jun 27, 2023 · 2 comments
Open

Allow to customize float window appearance e.g. of the doctor #579

lervag opened this issue Jun 27, 2023 · 2 comments
Labels
enhancement New feature or request feedback wanted

Comments

@lervag
Copy link

lervag commented Jun 27, 2023

Describe the feature

The doctor float window is created here:

local float = Float.percentage_range_window(0.6, 0.4, { winblend = 0 }, {
title = args.title,
titlehighlight = "MetalsTitle",
topleft = "",
topright = "",
top = "",
left = "",
right = "",
botleft = "",
botright = "",
bot = "",
})

It has hardcoded parameters for creating the window and relies on plenary. I would be very happy if this could be more customizeable. I.e., I would want to do something like this to specify configuration:

require("metals").setup {
  floats = {
    window_options = {
      width = 0.9,
      height = 0.9,
      title_pos = "left",
    },
    border = {
      style = "double",
    },
  },
}

where window_options and border have are similar to the options for the builtin nvim_open_win.

Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here? It provides something that is more in line with nvim_open_win and that it may be easier to customize; possibly.

Potential ways to implement

I could possibly help with implementing this, but I would need some guidance and I think it should be done for more than just the doctor. That is, I would want to allow custom configuration for all the floating windows similar to the doctor using the same mechanism.

@ckipp01
Copy link
Member

ckipp01 commented Jun 29, 2023

Thanks for opening this up @lervag. I can understand why someone may want a bit more control here.

Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here?

I don't think I really want to switch at this time. I use Plenary for a couple other modules throughout nvim-metals, like Path, etc, so it's not as easy to swap it out, even if I wanted to. I also wouldn't want to require another dependency.

Let me think on this a bit and I'll see if I can come up with a direction I feel comfortable with that would allow something like this. It's also worth being said that I've purposefully kept configuration in nvim-metals very minimal just to make maintenance easier, so I also want to be a bit careful here.

@ckipp01 ckipp01 added enhancement New feature or request feedback wanted labels Jun 29, 2023
@lervag
Copy link
Author

lervag commented Jul 1, 2023

Perhaps it would make sense to rely on Popup from nui.nvim instead of plenary here?

I don't think I really want to switch at this time. I use Plenary for a couple other modules throughout nvim-metals, like Path, etc, so it's not as easy to swap it out, even if I wanted to. I also wouldn't want to require another dependency.

Ok, that's fine and understandable.

Let me think on this a bit and I'll see if I can come up with a direction I feel comfortable with that would allow something like this.

Cool!

It's also worth being said that I've purposefully kept configuration in nvim-metals very minimal just to make maintenance easier, so I also want to be a bit careful here.

Yes, I like that idea personally. But on this specific topic, I think there is a reason to allow more flexibility. I've tried to make all my floating windows have a consistent style. I believe for everyone who wants to do that, we actually need a way to provide this configuration. Of course, we will use sensible defaults that many people will be fine with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback wanted
Projects
None yet
Development

No branches or pull requests

2 participants