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

reactive.nvim integration breaks colors from colorful-menu.nvim #817

Open
xfzv opened this issue Jan 4, 2025 · 0 comments
Open

reactive.nvim integration breaks colors from colorful-menu.nvim #817

xfzv opened this issue Jan 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@xfzv
Copy link

xfzv commented Jan 4, 2025

Description

Original issue


I'm using colorful-menu.nvim along with blink.cmp.

If using reactive.nvim integration from catppuccin, the colors from colorful-menu.nvim are disappearing when the documentation window from blink.cmp is drawn (after hovering an item in the completions list).

Keeping reactive.nvim enabled but disabling catppuccin integration solves the issue.

  • With reactive.nvim catppuccin integration:
    with_theme

  • Without:
    without_theme

Neovim version

% nvim -v                                         
NVIM v0.11.0-dev-1465+ga09c7a5d57
Build type: RelWithDebInfo
LuaJIT 2.1.1734355927
Run "nvim -V1 -v" for more info

Terminal and multiplexer

kitty 0.36.4

Catppuccin version / branch / rev

main branch @ f67b886 (latest commit)

Steps to reproduce

  1. Using repro.lua provided below, run:
% nvim -u repro.lua -c ':TSUpdateSync lua'
  1. Open any Lua file: nvim -u repro.lua /path/to/lua_file.lua
% nvim -u repro.lua /path/to/lua_file.lua
  1. Enter insert mode and start typing to trigger completions
  2. Hover e.g. a function to trigger blink.cmp documentation window
  3. Completions items colors disappear when the documentation window shows up
  4. Close Neovim
  5. Disable reactive.nvim catppuccin integration in repro.lua:
  {
    "rasulomaroff/reactive.nvim",
    event = { "BufEnter", "WinEnter" },
    opts = {
-      load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
+      -- load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
    },
  },
  1. Repeat 2-4
  2. Completion items colors are still visible this time around

Expected behavior

Colors from colorful-menu.nvim remain visible when blink.cmp documentation window is drawn.

Actual behavior

Colors from colorful-menu.nvim are no longer visible when blink.cmp documentation window is drawn.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "catppuccin/nvim",
    init = function()
      vim.cmd.colorscheme("catppuccin")
    end,
    name = "catppuccin",
    opts = {
      integrations = {
        blink_cmp = true,
      },
    },
  },
  -- add any other plugins here
  {
    "xzbdmw/colorful-menu.nvim",
    opts = {},
  },
  {
    "rasulomaroff/reactive.nvim",
    event = { "BufEnter", "WinEnter" },
    opts = {
      -- load = { "catppuccin-mocha-cursor", "catppuccin-mocha-cursorline" },
    },
  },

  {
    "saghen/blink.cmp",
    dependencies = {
      "xzbdmw/colorful-menu.nvim",
      "rafamadriz/friendly-snippets",
    },
    event = "InsertEnter",
    version = "*",
    opts = {
      keymap = { preset = "enter" },
      appearance = {
        use_nvim_cmp_as_default = false,
        nerd_font_variant = "mono",
      },
      completion = {
        menu = {
          auto_show = true,
          draw = {
            components = {
              label = {
                width = { fill = true, max = 60 },
                text = function(ctx)
                  local highlights_info = require("colorful-menu").highlights(ctx.item, vim.bo.filetype)
                  if highlights_info ~= nil then
                    return highlights_info.text
                  else
                    return ctx.label
                  end
                end,
                highlight = function(ctx)
                  local highlights_info = require("colorful-menu").highlights(ctx.item, vim.bo.filetype)
                  local highlights = {}
                  if highlights_info ~= nil then
                    for _, info in ipairs(highlights_info.highlights) do
                      table.insert(highlights, {
                        info.range[1],
                        info.range[2],
                        group = ctx.deprecated and "BlinkCmpLabelDeprecated" or info[1],
                      })
                    end
                  end
                  for _, idx in ipairs(ctx.label_matched_indices) do
                    table.insert(highlights, { idx, idx + 1, group = "BlinkCmpLabelMatch" })
                  end
                  return highlights
                end,
              },
            },
            treesitter = { "lsp" },
          },
        },
        documentation = {
          auto_show = true,
          auto_show_delay_ms = 200,
          window = { border = "rounded" },
        },
      },
    },
  },
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    cmd = { "TSUpdate", "TSUpdateSync" },
    event = { "BufReadPost", "BufNewFile" },
    opts = {
      auto_install = true,
      highlight = {
        enable = true,
        additional_vim_regex_highlighting = false,
        indent = { enable = true },
        ensure_installed = {
          "lua",
        },
      },
      config = function(_, opts)
        require("nvim-treesitter.configs").setup(opts)
      end,
    },
  },
  {
    "williamboman/mason-lspconfig.nvim",
    dependencies = {
      "williamboman/mason.nvim",
      "neovim/nvim-lspconfig",
    },
    event = { "BufReadPre", "BufNewFile" },
    config = function()
      require("mason-lspconfig").setup_handlers({
        function(server_name)
          require("lspconfig")[server_name].setup({
            capabilities = require("blink.cmp").get_lsp_capabilities(),
          })
        end,
        ["lua_ls"] = function()
          require("lspconfig")["lua_ls"].setup({})
        end,
      })
    end,
  },
  {
    "williamboman/mason.nvim",
    build = ":MasonUpdate",
    opts = {},
  },

  {
    "WhoIsSethDaniel/mason-tool-installer.nvim",
    opts = {
      auto_update = true,
      run_on_start = true,
      ensure_installed = {
        "lua-language-server",
      },
    },
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
-- add anything else here
@xfzv xfzv added the bug Something isn't working label Jan 4, 2025
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

1 participant