Coc.nvim: Split closes when floating message such as typedef or linter error goes away

Created on 15 Oct 2020  路  5Comments  路  Source: neoclide/coc.nvim

Result from CocInfo

## versions

vim version: NVIM v0.5.0-nightly
node version: v12.19.0
coc.nvim version: 0.0.79-80ae19dee6
coc.nvim directory: /Users/daniel/.config/nvim/plugged/coc.nvim
term: xterm-kitty
platform: darwin

## Output channel: explorer


## Output channel: prettier


## Output channel: tsserver

[Info  - 3:03:23 PM] Forking TSServer
PATH: /Users/daniel/.pyenv/plugins/pyenv-virtualenv/shims:/Users/daniel/.pyenv/shims:/Users/daniel/.pyenv/bin:/Users/daniel/.nvm/versions/node/v12.19.0/bin:/Users/daniel/.gem/ruby/2.7.0/bin:/Users/daniel/.cargo/bin:/Users/daniel/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/daniel/.antigen/bundles/zsh-users/zsh-syntax-highlighting:/Users/daniel/.antigen/bundles/zsh-users/zsh-autosuggestions:/Users/daniel/.antigen/bundles/lukechilds/zsh-nvm:/Users/daniel/.antigen/bundles/mattberther/zsh-pyenv:/Users/daniel/.antigen/bundles/denysdovhan/spaceship-prompt 
[Info  - 3:03:23 PM] Started TSServer
{
  "path": "/Users/daniel/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib",
  "_pathLabel": "",
  "_api": {
    "versionString": "4.0.3",
    "version": "4.0.3"
  }
}

## Output channel: eslint

[Info  - 3:03:23 PM] ESLint server running in node v12.19.0
[Info  - 3:03:24 PM] ESLint library loaded from: /Users/daniel/Development/gradient/portal/static/node_modules/eslint/lib/api.js
Browserslist: caniuse-lite is outdated. Please run the following command: `npm update`

Describe the bug

Whenever a floating message (such as a type definition or a linter error) would disappear, the focused split gets closed.

Reproduce the bug

Tested on both Neovim 0.4.4 and nightly

  1. Open two splits
  2. In one of the splits, bring up a type definition with K
  3. Press j or k to navigate away from the line so the message closes

The split will immediately close.

This is not specific to type definitions. It will also close the split if you get a linter message and move away from it.

Mini vim file to reproduce

```vim
set nocompatible
set runtimepath^=/Users/daniel/.config/nvim/plugged/coc.nvim
filetype plugin indent on
syntax on
set hidden

" Use K to show documentation in preview window.
nnoremap K :call show_documentation()

function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('')
endif
endfunction
```

Edit: Simplified mini.vim to a more minimal config that still reproduces the bug.

bug

Most helpful comment

The problem is nvim_win_close would close current window when window id is 0, we should avoid that.

All 5 comments

Same issue here after updating today

this has been happening for me today as well.

i had an old version of the show_documentation() function from the readme, so i updated that to the new recommendation, but that hasn't fixed it.

i also have the binding for K to show documentation.

The problem is nvim_win_close would close current window when window id is 0, we should avoid that.

Thank you very much for the fast resolution. Can confirm that the latest release has solved my issues.

thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

czepluch picture czepluch  路  3Comments

FrankLA0203 picture FrankLA0203  路  3Comments

aareman picture aareman  路  3Comments

zhou13 picture zhou13  路  3Comments

npearson72 picture npearson72  路  3Comments