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

Documentation window obstructs suggestions window when suggestions window is too wide. #1812

Open
2 tasks done
zuqini opened this issue Feb 3, 2024 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@zuqini
Copy link

zuqini commented Feb 3, 2024

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  view = {
    entries = { name = 'custom', selection_order = 'near_cursor' }
  },
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ["<Tab>"] = cmp.mapping(function(fallback)
      if cmp.visible() then
        cmp.select_next_item()
      else
        fallback()
      end
    end, { "i", "s" }),
  },

  sources = cmp.config.sources({
    { name = "nvim_lsp" },
    { name = "buffer" },
  }),
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').default_capabilities()

require'lspconfig'.pyright.setup {
  capabilities = capabilities,
}
EOF

Description

The documentation window obstructs suggestions window when suggestions window is too wide. This seems to only happen when the windows are set to be bordered and selection_order = 'near_cursor'. See the screenshots below in the "Steps to Reproduce" section.

Steps to reproduce

  1. Ensure the pyright language server is available on the PATH
  2. echo "import sys" > test.py
  3. nvim -u ~/cmp-repro.vim test.py
  4. Drag the window to be narrow width-wise, like in the provided screenshot.
  5. Begin typing in the next line: sys.audit.
  6. Press tab to go to the first result
  7. Observe that the documentation covers the suggestion window. (Note that this does not happen when we don't set cmp.config.window.bordered())
image

This repros the issue by using an extremely narrow window, but here is an example that can happen with a normal window size when the suggestion window is wide from its long method signatures:
image

Expected behavior

We do not expect the documentation to cover the suggestion window. When the bordered window is not set, the documentation either does not show or only takes up the space around the suggestions.
image

Actual behavior

Documentations window blocks the suggestions window. See the screenshot in "Steps to Reproduce" section.

Additional context

No response

@zuqini zuqini added the bug Something isn't working label Feb 3, 2024
@infamous55
Copy link

Hello! I am facing the same problem. Here is a screenshot for reference:
image

weskoerber pushed a commit to weskoerber/dotfiles that referenced this issue Feb 13, 2024
weskoerber pushed a commit to weskoerber/dotfiles that referenced this issue Feb 13, 2024
@Ashe
Copy link

Ashe commented Aug 7, 2024

+1 this is quite annoying!

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