hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.45k stars 370 forks source link

[NEED HELP] What kind of popup is this? It blocks the completion list and I can’t see it. #1874

Closed xusd320 closed 2 months ago

xusd320 commented 2 months ago

FAQ

Announcement

Minimal reproducible full config

return {
  {
    "hrsh7th/nvim-cmp",
    dependencies = {
      "f3fora/cmp-spell",
    },
    opts = function(_, opts)
      local has_words_before = function()
        unpack = unpack or table.unpack
        local line, col = unpack(vim.api.nvim_win_get_cursor(0))
        return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
      end

      local luasnip = require("luasnip")
      local cmp = require("cmp")

      opts.window = {
        documentation = cmp.config.window.bordered(),
        completion = cmp.config.window.bordered(),
      }

      opts.confirm_opts = {
        behavior = cmp.SelectBehavior.Replace,
        select = false,
      }

      opts.mapping = vim.tbl_extend("force", opts.mapping, {
        ["<Tab>"] = cmp.mapping(function(fallback)
          if cmp.visible() then
            cmp.select_next_item()
          elseif luasnip.expand_or_jumpable() then
            luasnip.expand_or_jump()
          elseif has_words_before() then
            cmp.complete()
          else
            fallback()
          end
        end, { "i", "s" }),
        ["<S-Tab>"] = cmp.mapping(function(fallback)
          if cmp.visible() then
            cmp.select_prev_item()
          elseif luasnip.jumpable(-1) then
            luasnip.jump(-1)
          else
            fallback()
          end
        end, { "i", "s" }),
      })

      opts.performance = {
        debounce = 180,
        throttle = 90,
        fetching_timeout = 500,
        confirm_resolve_timeout = 80,
        async_budget = 1,
        max_view_entries = 200,
      }

      opts.experimental = {
        ghost_text = false,
      }

      table.insert(opts.sources, {
        name = "spell",
        option = {
          keep_all_entries = false,
          enable_in_context = function()
            return false
          end,
        },
      })
    end,
  },
}

Description

Just like the issue title.

Steps to reproduce

Nothing

Expected behavior

I can disable the popup, or it show at other position.

Actual behavior

Don't how to disable it or adjust it's postion.

Additional context

image

xusd320 commented 2 months ago

Sorry, this is not a bug. I just need some help.

Shougo commented 2 months ago

It seems documentation feature in items.

Please see this.

https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L1019

xusd320 commented 2 months ago

It seems documentation feature in items.

Please see this.

https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L1019

That's great.Thanks very much.