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

[BUG] Should popups be transparent with transparent_mode = true ? #333

Open
timsofteng opened this issue May 3, 2024 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@timsofteng
Copy link

Describe the bug

  1. With active transparent mode popups looks weird.

Expected behaviour

We need to mark popups somehow (to keep background or add borders)

Screenshots

изображение
изображение

@timsofteng timsofteng added the bug Something isn't working label May 3, 2024
@xudyang1
Copy link
Contributor

xudyang1 commented May 7, 2024

gruvbox.nvim is a colorscheme and it does not configure the floating window. If you are using language servers from lspconfig, you can set up borders in your own config like this:

local lsp = vim.lsp

vim.api.nvim_create_autocmd("LspAttach", {
  group = vim.api.nvim_create_augroup("UserLspConfig", {}),
  callback = function(event)
    lsp.handlers["textDocument/hover"] = lsp.with(lsp.handlers.hover, { border = "rounded" })
    lsp.handlers["textDocument/signatureHelp"] = lsp.with(lsp.handlers.signature_help, { border = "rounded" })

    local opts = { buffer = event.buf }
    local map = vim.keymap.set
    local lsp_buf = lsp.buf

    map("n", "K", lsp_buf.hover, opts)
    map("n", "gs", lsp_buf.signature_help, opts)
    -- more keymaps
  end,
})

@timsofteng
Copy link
Author

timsofteng commented May 7, 2024

@xudyang1 this issue is related to all popup windows.
Here is how which-key looks without and with transparent mode
image
image

@xudyang1
Copy link
Contributor

xudyang1 commented May 8, 2024

@timsofteng For whichkey, you can set up border style by calling require('which-key').setup({ window = { border = "single" }).

Generally, if you want to configure all these plugin popup windows, you have to refer to the plugin's github page. Most configuration options are available in the README, so updating your config may not take too long.

Again, gruvbox.nvim is only a colorscheme and it does not have the capability to set up the border style (you can find details about border styles from :help nvim_open_win()). gruvbox.nvim only sets some plugins' border highlight or links them into existing highlight groups (see :h 'highlight', :h highlight-groups, and :h :highlight-link).

If you want to customize the popup border:

  1. enable the plugin popup window border in the your config

  2. then, if you want to change the border highlight (e.g., color), you can search for the highlight group of the plugin popup window border. Next, override it in gruvbox.nvim's config. For example:

require("gruvbox").setup({
  overrides = { 
    LspInfoBorder = {
      link = "FloatBorder",
    },
  }
})

@ellisonleao
Copy link
Owner

hey @timsofteng not sure if that's a bug, and honestly I don't use transparent mode so I am a little biased on how to process with this. If you think you have a good suggestion using an override that can be the default color please open a PR, add some screenshots and we can discuss. How about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants