Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting 'Enter' doesn't select item from the dropdown menu in Vim 8.1 #3030

Closed
1 task
0xadb opened this issue May 21, 2018 · 3 comments
Closed
1 task

Hitting 'Enter' doesn't select item from the dropdown menu in Vim 8.1 #3030

0xadb opened this issue May 21, 2018 · 3 comments

Comments

@0xadb
Copy link

0xadb commented May 21, 2018

Issue Prelude

  • [x ] I have read and understood YCM's CONTRIBUTING document.
  • [x ] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [ x] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [ x] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • [x ] If filing a bug report, I have included the output of vim --version.
  • [ x] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [ x] If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • [ x] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [ x] If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • [ x] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [ x] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Issue Details

  • What did you do?

On Debian 9.4 I upgraded Vim from 8.0 (from repo) to 8.1 (from sources, following instructions from Full Installation Guide), i.e.:

  • removed vim and vim-youcompleteme completely
  • downloaded Clang precompiled binaries of clang-6.0 for Debian 8 x86_64
  • built ycm_core.so using path to clang-6.0 root as -DPATH_TO_LLVM_ROOT=.
    C++ completion works fine, I see a dropdown menu with completion suggestions. But when I choose a suggestion using arrow keys and hit Enter key, the menu doesn't collapse as it's supposed to. Even after several Enters - menu collapses only after Esc.
  1. Create main.cpp with this code:
struct Struct
{
  int intValue;
  char * strValue;
};
  
int main ()
{
  Struct s;
  s // enter '.', select an item and hit 'Enter'
  return 0;
}
  1. After 's' enter '.', select a suggestion from dropdown menu and hit 'Enter'
  • What did you expect to happen?

On vim 8.0 selecting menu item and pressing Enter led to menu collapsing. It was convenient.

  • What actually happened?

Before hitting Enter:
0-before-hitting-enter
After hitting Enter
1-after-hitting-enter

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 17, compiled May 19 2018 11:58:46)
Included patches: 1
Compiled by user@box
Huge version with GTK2 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 +vertsplit
+clipboard +jumplist +persistent_undo +virtualedit
+cmdline_compl +keymap +postscript +visual
+cmdline_hist +lambda +printer +visualextra
+cmdline_info +langmap +profile +viminfo
+comments +libcall -python +vreplace
+conceal +linebreak +python3 +wildignore
+cryptv +lispindent +quickfix +wildmenu
+cscope +listcmds +reltime +windows
+cursorbind +localmap +rightleft +writebackup
+cursorshape +lua +ruby +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: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/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: "/opt/vim-8.1/share/vim"
f-b for $VIMRUNTIME: "/opt/vim-8.1/share/vim/vim81"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -ldl -L/usr/lib -llua5.1 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.24/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_c0qz25yi.log
-- Server Python interpreter: /usr/bin/python3.5
-- Server Python version: 3.5.3
-- Server has Clang support compiled in: True
-- Clang version: clang version 6.0.0 (tags/RELEASE_600/final)
-- Extra configuration file found and loaded
-- Extra configuration path: /home/user/.ycm_extra_conf.py
-- C-family completer debug information:
-- Compilation database path: None
-- Flags: ['-Wall', '-Wextra', '-Werror', '-Wc++98-compat', '-Wno-long-long', '-Wno-va
riadic-macros', '-fexceptions', '-DNDEBUG', '-DUSE_CLANG_COMPLETER', '-std=c++11', '-x',
'c++', '-isystem', '/home/user/../BoostParts', '-isystem', '/System/Library/Framew
orks/Python.framework/Headers', '-isystem', '/home/user/../llvm/include', '-isystem
', '/home/user/../llvm/tools/clang/include', '-I', '/home/user/.', '-I', '/hom
e/user/./ClangCompleter', '-isystem', '/home/user/./tests/gmock/gtest', '-isys
tem', '/home/user/./tests/gmock/gtest/include', '-isystem', '/home/user/./test
s/gmock', '-isystem', '/home/user/./tests/gmock/include', '-resource-dir=/home/bere
govoy/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-check
ing']
-- Translation unit: /home/user/playground/ycm_test/main.cpp
-- Server running at: http://127.0.0.1:58487
-- Server process ID: 21461
-- Server logfiles:
-- /tmp/ycmd_58487_stdout_vlihtjga.log
-- /tmp/ycmd_58487_stderr_jwq1mtmn.log

Contents of YCM, ycmd and completion engine logfiles

ycm_c0qz25yi.log
ycmd_58487_stderr_jwq1mtmn.log
ycmd_58487_stdout_vlihtjga.log

OS version, distribution, etc.

$ uname -a
Linux box 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

$ cat /etc/debian_version
9.4

@0xadb 0xadb changed the title Hitting 'Enter' doesn't select item from completion menu Hitting 'Enter' doesn't select item from the dropdown menu May 21, 2018
@0xadb 0xadb changed the title Hitting 'Enter' doesn't select item from the dropdown menu Hitting 'Enter' doesn't select item from the dropdown menu in Vim 8.1 May 21, 2018
@micbou
Copy link
Collaborator

micbou commented May 21, 2018

I can't reproduce the issue. Did you remap the <Enter> key? Does the command

:inoremap <Enter>

return anything? By default, the <Enter> key should always insert a new line even in completion mode. If you want this key to confirm the selection instead of inserting a new line, you should add it to the g:ycm_key_list_stop_completion option:

let g:ycm_key_list_stop_completion = [ '<C-y>', '<Enter>' ]

@micbou
Copy link
Collaborator

micbou commented May 21, 2018

By the way, you should be able to install YCM with the install.py script instead of following the full instructions on Debian. The command

./install.py --clang-completer

should work. Don't worry if it's downloading the Clang binaries for Ubuntu 14.04. They are compatible with Debian.

@0xadb
Copy link
Author

0xadb commented May 21, 2018

:inoremap <Enter>

i * pumvisible() ? "<C-Y>" : "<C-G>u<CR>"

I am a moron, totally forgot about OmniCompletion enabled:

"" Enable OmniCompletion
" http://vim.wikia.com/wiki/Omni_completion
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" "
" " " Configure menu behavior
" " " http://vim.wikia.com/wiki/VimTip1386
set completeopt=longest,menuone
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
  \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
  \ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'

I'm sorry and thank you.

Works now as I expect it to.

@0xadb 0xadb closed this as completed May 21, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants