neovim / neovim

Vim-fork focused on extensibility and usability
https://neovim.io
Other
83.01k stars 5.69k forks source link

Add a way to have NormalNC effect specific highlights. #24461

Closed A-Lamia closed 1 year ago

A-Lamia commented 1 year ago

Problem

Good day :),

For a little background i maintain AstroTheme and i have found something that is bothering, I've spent days trying to workaround it but it seems LSP hovers and documentation has destroyed me.

At first i thought the solution could be to have the same ability to change the default highlights for LSP as you can with nvim-cmp but this just adds more complexity with figuring out how to change user config settings and restoring them (Something a theme should not be doing imo).

Currently most floats / popups are using NormalFloat, FloatBorder FloatTitle, when using NormalNC for dimming it's nice to set the "Floating" windows to the base color the issue is this will effect every floating window including things like CMP and LSP causing these types of popup windows to now have no distinguishing background, if using LSP document and focus the popup you will then get a nice shade change from NormalNC but not in reverse.

From a UX point of view there are 2 types of windows in neovim Popups / Menus and Floating windows. A floating window would want to take your focus but a "popup" is supplementary to the current window though we have no way of distinguishing between them when using NormalNC.

Expected behavior

Having a way to distinguish between floats and popups.

I had thought of 3 solutions but only 1 of them seems viable currently:

  1. Add the ability to change the LSP highlight defaults.

    • This has the issue of themes needing to alter user config settings.
  2. Add NormalFloatNC.

    • At first i thought this would be a good idea but how do you control the background for the border and title, doesn't seem viable.
  3. Add a property when setting highlights that would allow that highlight group to be effected by NormalNC.

    • I'm unsure of the complexity of this solution but currently it seems like the most flexible option something like nc = true.

Anyway thanks for reading my ramble looking forward to getting crushed by reality! 🏋️

A-Lamia commented 1 year ago

An other interesting idea could be deprecating NormalNC (or leaving it for compatibility reasons) and instead of having a toggle being able to set an inactive color to the highlight group eg:

vim.api.nvim_set_hl(0, "Normal",
    {
        fg = "#E0E0E0",
        bg = "#1A1D23",
        nc = "#16181D",
    }
)
clason commented 1 year ago

:h nvim_win_set_hl_ns

Not clear why it needs a new API, or massively breaking changes.

A-Lamia commented 1 year ago

I tried playing around with this and don't really understand how this would work with a popup window (it's never active), do you have an example ?

clason commented 1 year ago

There is no "popup window" in Neovim. (You may be thinking of the Pmenu?) This is one of the major differences to Vim.

A-Lamia commented 1 year ago

popup menu in the context of what I'm talking about in my above post, i call them that so that it's distinct that I'm talking specifically about "supplementary" or "menu" windows such as the ones made by lsp, nvim-cmp, my whole issue is that there is no way to distinguish between the 2 even though from a UX point of view they are very different, eg "popups" are not active windows by default.

clason commented 1 year ago

But I'm telling you that there is no difference; everything is just a "floating window". If you want a different UX for some of them, you're responsible for implementing it yourself.

A-Lamia commented 1 year ago

once again i know, that is the issue, but lsp doesn't supply separate highlights to target it specifically, and there is no way of modifying the defaults (that I'm aware of, i looked through the docs and found nothing.) like you can with nvim-cmp.

clason commented 1 year ago

So maybe you can describe your actual problem (since your proposed "solution" is overkill and not feasible).

A-Lamia commented 1 year ago

Apologies maybe my first half of the post was not specific enough.

justinmk commented 1 year ago

Is the title still accurate? If so, this is wontfix.

A-Lamia commented 1 year ago

yes the title is accurate, it seems i miss understood what a feature request is this can be closed if it's out of scope, thanks.

clason commented 1 year ago

No, it's a feature request alright. But you're asking for a lot without really making the case why that massive change is necessary to achieve what you're actually after. (Which I'm still not clear on, for the record.)

A-Lamia commented 1 year ago

Thanks but I'll be closing this, it seems the direction of this post has already been set, I'd rather not waste time trying to build a case and gather images when i already know what the outcome is.

For future reference next time instead of being dismissive just say It's out of scope so we can all move on.