ycm-core / YouCompleteMe

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

E523: not allowed here #252

Closed lukeorland closed 11 years ago

lukeorland commented 11 years ago

This meant as a report for future users on preventing a non-bug error I had related to YouCompleteMe and to describe what caused it.

While inserting text into a Python file, I would type self. and a method would be auto-inserted, and then it would get stuck in visual mode. Typing i would not enter insert mode and the error E523: not allowed here would be displayed, and the setting noinsertmode was persistent.

I had the jedi-vim plugin installed alongside YouCompleteMe, because I assumed that it was required. That was the source of the problem.

When I removed the jedi-vim plugin, This annoying issue went away.

lukeorland commented 11 years ago

Actually, I'm still getting this error sometimes after removing jedi-vim, so I'm not sure which other plugin might be interfering. It seems like this error happens whenever a method's documentation or list of arguments is opened in a scratch window.

If anyone else experiences a similar problem, I suppose we can discuss here.

I'm on OS X 10.8.3, attempting to use the skwp/dotfiles MacVim configurations bundle (with the neocomplcache bundle deleted), along with YouCompleteMe.

Valloric commented 11 years ago

Sounds like you still have conflicts with some other plugin.

rattlion commented 11 years ago

Could be related to snipmate as I get this same issue to happen after completing a snippet.

nicetrysean commented 10 years ago

@lukeorland did you find any solutions to your issue?

brc commented 9 years ago

First-time YCM user here... crazy plugin! :smile:

Just experienced this bug after installing YCM and UltiSnips—not sure whether the latter is related—just mentioning it because I installed them at the same time (see my config below). I have never seen such a thing in vim after almost 20 years, so one of them is probably at fault :smile: :wink:

(So you'd think I'd know enough to fix it, then.)

This happened when I used the Down arrow to select a Python method completion (shlex.split()). Now, I normally would never use arrow keys, because I use a custom keymap on a custom keyboard... but I was typing on a QWERTY laptop and went the lazy way!

I quit vim and tried to reproduce it in the same file (same line, same place), but it didn't happen again. For now, I think I will remove <Down> and <Up> from my YCM key list, since those keys send Escape sequences.

Here are the configurations I made to each plugin after installing them.

"""""""""""""""""""""""""""""""""""""""""""""""""""""
""" YouCompleteMe
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Don't use <tab> to cycle thru PUM, use ^n and ^p as we're used to doing.
" This also solves problems with using UltiSnips simultaneously, which uses
" <tab> as its default trigger.
let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']

" read tags file
let g:ycm_collect_identifiers_from_tags_files = 1

"""""""""""""""""""""""""""""""""""""""""""""""""""""
""" UltiSnips
"""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:UltiSnipsExpandTrigger="<Tab>"
let g:UltiSnipsJumpForwardTrigger="<Tab>"                                           
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"

Just confirming presence of this issue in the latest version. Thanks for the great contribution - this is one of the most thorough, computer-sciency Vim plugins I've seen yet!

puremourning commented 9 years ago

@invsblduck out of curiosity, how did you install YouCompleteMe/UltiSnips

I just set up a clean user and installed both using Vundle, I have to exit vim and run ./install.sh --clang-completer --etc,. Then when I open up a python file, I am not able to reproduce this. Are you somehow "installing both" at the same time from within vim? I believe this is possible with neobundle?

It would help us track it down if you could give us a sort of step-by-step what you did. As you probably know, there are tons of ways of using vim (that's why we love it, right?!) and so reproducing these edge cases requires some head scratching.

Also, thanks for posting your take on the "YCM vs UltiSnips" default key bindings. There are a number of different suggestions around the issue tracker.

rookiepig commented 9 years ago

I have the same problem both in editing c++ and python file when YCM starts showing the function or class member document. I think the E532 comes because the current focusing window is the drop-list window.

Update:

I choose to close the preview window of complete:

set completeopt-=preview

And the problem is solved

unphased commented 8 years ago

I have an issue which I don't know if is related to this one. Neovim-specific, and after a good amount of time using YCM the entire editor starts to prevent insert mode with E523: Not allowed here.

It's rather a pain to reproduce and therefore debug because it takes me using the nvim instance for hours but it does reliably happen. It's back to using vim again.

brc commented 8 years ago

@puremourning Gah!! I never responded 😞 It's been a year, so Happy Birthday :-)

The good news is: I haven't seen the issue since that single occurrence a year ago. But I did remove the <Up> and <Down> keys from my config, as I said I would. That's the only thing that's changed in the last year apart from me updating YCM a couple times.

To answer your question: Nothing crazy as far as installing—just Git submodule the repo into my ~/.vim/bundle/ directory and use Pathogen. I had submoduled YCM and UltiSnips in the same day before running into the issue, so that's why I brought up the other plugin at all.

Since I've only seen the issue once ever, not sure that I could recommend a way to help reproduce it. It's mostly just been a joy to use, though...so thank you!

sanjayankur31 commented 6 years ago

I seem to be able to reliably reproduce it with this nonsensical code snippet:

#!/usr/bin/env python3

class foobar():

    """Single neuron simulation code for Sinha2018"""

    def __init__(self):
        """Initialise everything """
        self.dt = 0.1

        # Growth curve parameters
        self.a_e_e = 0.001
        self.a_e_i = 0.001
        self.a_i_e = 0.001
        self.a_i_i = 0.001

        self.tau_den_e_e = self.a_e_e * 0.1
        self.tau_den_e_i = self.a_e_i * 0.1
        self.tau_den_i_e = self.a_i_e * 0.1
        self.tau_den_i_i = self.a_i_i * 0.1

        # Initial values
        # Different values for butz neuron, and our neuron
        self.psi = 10.
        self.eps_den_e_eg = self.psi
        self.eps_den_e_ig = self.psi * 1.75
        self.eta_den_e_eg = self.psi * 0.25
        self.eta_den_e_ig = self.psi

    def close_files(self):
        """Close files."""
        self.psi = 0.

Try writing self.clo and when the popup comes up, use ctrl n to select close_files. That's when it happens. If one doesn't select the method, but goes on typing close_files(), it won't happen. I'm also uploading my vimrc---vimrc.txt. As you'll see, I disabled a majority of the plugins i'm using, but the error still persists.

As @rookiepig says, using set completeopt-=preview does seem to fix it. Any hints/ideas? I'm happy to help debug this.

Cheers! Thanks for the great plug-in, of course :)

puremourning commented 6 years ago

Does the error occur with this specific vimrc (replacing the path as necessary)

set rtp+=/path/to/YouCompleteMe
filetype plugin indent on

Save that as ycm.vim and run with vim -Nu ycm.vim

sanjayankur31 commented 6 years ago

Yep. Even with this vimrc, the bug persists.

(ins)[asinha@ankur  ycm-bug]$ vim -Nu ycm.vim test.py                                                                                                                   
(ins)[asinha@ankur  ycm-bug]$ cat ycm.vim 
set rtp+=/home/asinha/.vim/plugged/YouCompleteMe
filetype plugin indent on

Where test.py is the python code I've mentioned above. In this case too, adding set completeopt-=preview to the vimrc file stops the bug from happening.

I forgot to mention the vim info:

$ vim --version
VIM - Vi IMproved 8.1 (2018 May 17, compiled Jun  6 2018 10:52:01)
Included patches: 1-35
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl/dyn          +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           +python/dyn        +vreplace
+conceal           +linebreak         +python3/dyn       +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua/dyn           +ruby/dyn          +X11
+dialog_con_gui    +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             +xim
+digraphs          +modify_fname      +smartindent       +xpm
+dnd               +mouse             +startuptime       +xsmp_interact
-ebcdic            +mouseshape        +statusline        +xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim81"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libdrm -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -pthread    -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/python3.6m -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lfribidi -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXpm -lXt -lX11 -lSM -lICE  -lm  -lselinux   -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc
micbou commented 6 years ago

I think you are experiencing this Vim regression fixed in patch 8.1.0042.

sanjayankur31 commented 6 years ago

Ugh, that was it. Updating to the patch level fixes it. :disappointed: Sorry for the noise.

dubst3pp4 commented 6 years ago

Same annoying problem here with Vim 8.1 and patches 1-37... waiting for patch 42 to arrive ;-)

teekennedy commented 6 years ago

If you, like me, ran into this issue from upgrading to the latest MacVim on Homebrew, note that you can downgrade to the last known good version like so:

Hope this helps!