neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.47k stars 956 forks source link

Format coc#on_enter() changes HTML-tags incorrectly #2966

Closed remkop22 closed 3 years ago

remkop22 commented 3 years ago

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 8.2 8022489
node version: v15.9.0
coc.nvim version: 0.0.80-a112e6621b
coc.nvim directory: /home/<>/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2021-03-12T13:42:33.019 INFO (pid:11630) [plugin] - coc.nvim 0.0.80-a112e6621b initialized with node: v15.9.0 after 21ms
2021-03-12T13:44:57.182 INFO (pid:11630) [attach] - receive notification: showInfo

Describe the bug

I am using the following line from the example rc file in the repo:

inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

And when editing HTML I often encounter incorrect formatting caused by pressing enter to place a tag on a new line (see GIF below). I removed all coc-nvim extensions and retried with a minimal .vimrc in order to isolate the problem, but the bug is still there. When removing said line from .vimrc the bug is gone.

Thanks for creating this amazing plugin, it changed the way I work, and thanks in advance for any help with this issue.

Reproduce the bug

.vimrc file used to reproduce the bug:

set nocompatible
filetype plugin indent on
syntax on
set hidden

inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

call plug#begin('~/.vim/plugged')

Plug 'neoclide/coc.nvim', {'branch': 'release'}

call plug#end()

Screenshots (optional)

Peek 2021-03-12 13-37

chemzqm commented 3 years ago

Make sure you have tried with minimal vimrc.

remkop22 commented 3 years ago

I tried it again with this vimrc:

set nocompatible
set runtimepath^=/home/<>/.vim/plugged/coc.nvim
filetype plugin indent on
syntax on
set hidden

inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

And ran it via vim -u mini.vim, and sadly the problem persists. Any pointers on how to debug this?

chemzqm commented 3 years ago

https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim

Maybe some extension is bad, try add let $COC_NO_PLUGINS = '1' at the top of your vimrc, you can enable extensions one by one with :CocList extensions

chemzqm commented 3 years ago

Please upgrade your coc.nvim to latest release branch.