hrsh7th / nvim-cmp

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

`open_docs` not working #1745

Closed Myzel394 closed 4 months ago

Myzel394 commented 8 months ago

FAQ

Announcement

Minimal reproducible full config

Copy the example from the text:

  cmp.setup {
    ...
    mapping = {
      ['<C-g>'] = function()
        if cmp.visible_docs() then
          cmp.close_docs()
        else
          cmp.open_docs()
        end
      end
    }
    ...
  }

(<C-g> seems to be captured by my terminal, I used <C-f> instead)

Doesn't work :/

Description

No popup shown at all

Steps to reproduce

  1. Write something that has docs
  2. Go to normal mode
  3. Go to insert mode
  4. Enter - no popup shown

Expected behavior

A popup should be shown

Actual behavior

No popup shown

Additional context

No response

qxb3 commented 4 months ago

Are there any updates on this?

Old-Farmer commented 4 months ago

Similar problem for me. don't toggle docs when cmp menu is not visible.

pavelz commented 4 months ago

i will try to fix this I would really want to have this so I don't have to interweb for docs.

igords-goncalves commented 4 months ago

Same problem here, I set up my mappings but it doesn't work!

['C-Space'] = cmp.mapping.open_docs(),

I found this resource in https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt

qxb3 commented 4 months ago

For now i just use the neovim's lsp built-in function:

vim.lsp.buf.hover()
hrsh7th commented 4 months ago

The cmp.open_docs is used to change documentation window visibility.

I'm worried that this issue misunderstands the cmp.open_docs purpose.

https://github.com/hrsh7th/nvim-cmp/assets/629908/efd23db0-57be-49ab-a677-6901f1d18041