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

color theme of floating window look different with others #25

Open
MontiL opened this issue Dec 17, 2022 · 2 comments
Open

color theme of floating window look different with others #25

MontiL opened this issue Dec 17, 2022 · 2 comments

Comments

@MontiL
Copy link

MontiL commented Dec 17, 2022

I am trying to use cmp-nvim-lsp-signature-help
I found the theme of floating window are different
Not sure if I missed something

Screenshot 2022-12-17 at 8 29 42 AM

my config:

-- reference:
-- https://github.com/hrsh7th/nvim-cmp#setup

local status_ok, cmp = pcall(require, "cmp")
if not status_ok then
  return
end

--[[ local check_backspace = function() ]]
--[[   local col = vim.fn.col(".") - 1 ]]
--[[   return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ]]
--[[ end ]]

--   פּ ﯟ   some other good icons
local kind_icons = {
  Text = "",
  Method = "m",
  Function = "",
  Constructor = "",
  Field = "",
  Variable = "",
  Class = "",
  Interface = "",
  Module = "",
  Property = "",
  Unit = "",
  Value = "",
  Enum = "",
  Keyword = "",
  Snippet = "",
  Color = "",
  File = "",
  Reference = "",
  Folder = "",
  EnumMember = "",
  Constant = "",
  Struct = "",
  Event = "",
  Operator = "",
  TypeParameter = "",
}
--- find more here: https://www.nerdfonts.com/cheat-sheet
--[[]]

cmp.setup({
  snippet = {
    expand = function(args)
      --[[ vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. ]]
      require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
    end,
  },
  window = {
    completion = cmp.config.window.bordered(),
    documentation = cmp.config.window.bordered(),
  },
  mapping = cmp.mapping.preset.insert({
    ["<Tab>"] = cmp.mapping.select_next_item(),
    ["<S-Tab>"] = cmp.mapping.select_prev_item(),
    ["<C-j>"] = cmp.mapping.select_next_item(),
    ["<C-k>"] = cmp.mapping.select_prev_item(),
    ['<C-b>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    --[[ ['<C-Space>'] = cmp.mapping.complete(), ]]
    ['<C-e>'] = cmp.mapping.abort(),
    -- Accept currently selected item. If none selected, `select` first item.
    -- Set `select` to `false` to only confirm explicitly selected items.
    ["<CR>"] = cmp.mapping.confirm({ select = true }),
  }),
  sources = cmp.config.sources({
    {
      name = "buffer",
      option = {
        get_bufnrs = function()
          local buf = vim.api.nvim_get_current_buf()
          local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
          if byte_size > 1024 * 1024 then -- 1 Megabyte max
            return {}
          end
          return { buf }
        end,
      },
    },
    { name = "luasnip" }, -- For luasnip users.
    { name = "nvim_lsp" },
    { name = "nvim_lua" },
    --[[ { name = "vsnip" }, -- For vsnip users. ]]
    -- { name = "ultisnips" }, -- For ultisnips users.
    -- { name = "snippy" }, -- For snippy users.
    { name = "buffer" },
    { name = "path" },
    { name = "emoji" },
    { name = 'nvim_lsp_signature_help' }
  }),
  formatting = {
    fields = { "kind", "abbr", "menu" },
    format = function(entry, vim_item)
      -- Kind icons
      vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
      -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind

      vim_item.menu = ({
        luasnip = "[Snippet]",
        --[[ vsnip = "[Snippet]", ]]
        nvim_lsp = "[LSP]",
        nvim_lua = "[NVIM_LUA]",
        buffer = "[Buffer]",
        path = "[Path]",
        emoji = "[Emoji]",
      })[entry.source.name]

      local source_mapping = {
        luasnip = "[Snippet]",
        nvim_lsp = "[LSP]",
        buffer = "[Buffer]",
        nvim_lua = "[Lua]",
        --[[ vsnip = "[Snippet]", ]]
        path = "[Path]",
        emoji = "[Emoji]",
      }

      local menu = source_mapping[entry.source.name]
      vim_item.menu = menu

      return vim_item
    end,
  },
  confirm_opts = {
    behavior = cmp.ConfirmBehavior.Replace,
    select = false,
  },
  experimental = {
    ghost_text = false,
    native_menu = false,
  },
})

-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
  mapping = cmp.mapping.preset.cmdline(),
  sources = {
    { name = 'buffer' }
  }
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
  mapping = cmp.mapping.preset.cmdline(),
  sources = cmp.config.sources({
    { name = 'path' }
  }, {
    { name = 'cmdline' }
  })
})

--- https://github.com/windwp/nvim-autopairs#you-need-to-add-mapping-cr-on-nvim-cmp-setupcheck-readmemd-on-nvim-cmp-repo

local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
  return
end

require("luasnip/loaders/from_vscode").lazy_load()
@MontiL MontiL changed the title window theme look different with others theme of floating window look different with others Dec 17, 2022
@MontiL MontiL changed the title theme of floating window look different with others color theme of floating window look different with others Dec 17, 2022
@Tom-Hadean
Copy link

Tom-Hadean commented Dec 21, 2023

The theme on lsp.buf.signature_help matches my theme well:
image

However the theme from cmp-nvim-lsp-signature-help is somehow not even respecting my font configuration of no italics. The theme is also very bare.
image

I'm on nvim 0.9.4.

@Tom-Hadean
Copy link

I've found the source of the unwanted italics - source._signature_label injecting *** markdown tags. I'm unsure about the rest of the theme issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants