Coc.nvim: Something wrong with textEdit from completeItem

Created on 5 Jun 2020  Â·  1Comment  Â·  Source: neoclide/coc.nvim

Result from CocInfo

vim version: NVIM v0.5.0-nightly-438-g8c588246a
node version: v10.16.0
coc.nvim version: 0.0.78-d5471449bf
coc.nivm directory: /Users/chenguangzhou/.configrc/nvim/viml/plugins/coc.nvim
term: xterm-kitty
platform: darwin

Describe the bug

Sometimes apply completeItem will delete the character after cursor.

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=/path/to/coc.nvim
    filetype plugin indent on
    syntax on
    set hidden
    
  • Start (neo)vim with command: vim -u mini.vim

  • Operate vim.

  • Install coc-html extension or other extension will return completeItem with textEdit.

Step 1

open t.html, | is cursor.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script type="text/javascript" src="//g.alicdn.com/AWSC/AWSC/awsc.js"></script>
  <title>Document</title>
</head>
<body>
  <div|></div>
</body>
</html>

type with different speed <space> + cl and select class completeItem. Sometimes it will delete the character >. I have seen this issue with coc-angular, coc-html, coc-flutter extension. All this extension will return completeItem with insertTextFormat: 2 and with textEdit. I checkout the output channel it seems it will send two completionItem/resolve request for the same completeItem.

this log does not delete the character >
log1.log

this log delete the character >
log2.log

bug

>All comments

I guess the line used for applyEdits could be wrong when you type fast

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iago-lito picture iago-lito  Â·  3Comments

cvlmtg picture cvlmtg  Â·  3Comments

rkulla picture rkulla  Â·  3Comments

npearson72 picture npearson72  Â·  3Comments

FrankLA0203 picture FrankLA0203  Â·  3Comments