ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

YCM inserts extra characters ('fd' is remapped to esc + typing fast) #2732

Closed aldanor closed 7 years ago

aldanor commented 7 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Issue Details

I use fd as esc in my vimrc, like so:

set timeoutlen=333 ttimeoutlen=10
inoremap fd <Esc>`^

It seems like it somehow interferes with ycm, given that completions after f are sometimes inserting an extra random character.

Given this source Python file (incomplete, as if mid-editing):

def ext(data_
    if not os.path.isfile(data_
    return os.path.splitext(data_file)[1]

If positioned in insert mode at the end of the first line, if I quickly type fi, ycm inserts fia:

def ext(data_fia

If positioned in insert mode at end of the second line, if I quickly type fi, ycm inserts fif:

    if not os.path.isfile(data_fif

It seems like it also depends on the contents of the third line. If I change it to

    return os.path.isfile(data_file)[1]

then ycm completes fil in the second case (which is also wrong).

Diagnostic data

Output of vim --version

$ nvim --version
NVIM v0.2.1-404-g69e9cda5a

Output of YcmDebugInfo

YcmDebugInfo

Contents of YCM, ycmd and completion engine logfiles

(nothing in jedi / ycm logs)

OS version, distribution, etc.

macOS 10.12.5

vheon commented 7 years ago

Does this also happen with vim and not NeoVim?

aldanor commented 7 years ago

Yep it does, in exactly the same way.

$ /usr/local/bin/vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 29 2017 00:11:49)
MacOS X (unix) version