ycm-core / YouCompleteMe

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

YCM didn't works with external Python PySide module #2327

Closed shahrilnet closed 8 years ago

shahrilnet commented 8 years ago

Issue Prelude

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

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

[If filing a bug report, please include a list of steps that describe how to reproduce the bug you are experiencing. Also include test code if relevant.]

vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 16 2016 10:50:38) Included patches: 1-1689 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by pkg-vim-maintainers@lists.alioth.debian.org Huge version with GTK2 GUI. Features included (+) or not (-): +acl +farsi +mouse_netterm +tag_binary +arabic +file_in_path +mouse_sgr +tag_old_static +autocmd +find_in_path -mouse_sysmouse -tag_any_white +balloon_eval +float +mouse_urxvt +tcl +browse +folding +mouse_xterm +terminfo ++builtin_terms -footer +multi_byte +termresponse +byte_offset +fork() +multi_lang +textobjects +channel +gettext -mzscheme +timers +cindent -hangul_input +netbeans_intg +title +clientserver +iconv +packages +toolbar +clipboard +insert_expand +path_extra +user_commands +cmdline_compl +job +perl +vertsplit +cmdline_hist +jumplist +persistent_undo +virtualedit +cmdline_info +keymap +postscript +visual +comments +langmap +printer +visualextra +conceal +libcall +profile +viminfo +cryptv +linebreak -python +vreplace +cscope +lispindent +python3 +wildignore +cursorbind +listcmds +quickfix +wildmenu +cursorshape +localmap +reltime +windows +dialog_con_gui +lua +rightleft +writebackup +diff +menu +ruby +X11 +digraphs +mksession +scrollbind -xfontset +dnd +modify_fname +signs +xim -ebcdic +mouse +smartindent +xsmp_interact +emacs_tags +mouseshape +startuptime +xterm_clipboard +eval +mouse_dec +statusline -xterm_save +ex_extra +mouse_gpm -sun_workshop +xpm +extra_search -mouse_jsbterm +syntax
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" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" 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/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -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 -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -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 -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

:YcmDebugInfo

Printing YouCompleteMe information... -- Server has Clang support compiled in: True -- Clang version: clang version 3.8.0 (tags/RELEASE_380/final) -- JediHTTP running at 127.0.0.1:60721 -- python binary: /usr/bin/python
-- stdout log: /tmp/ycm_temp/jedihttp_60721_stdout.log -- stderr log: /tmp/ycm_temp/jedihttp_60721_stderr.log -- Server running at: http://127.0.0.1:57448 -- Server process ID: 4951 -- Server logfiles: -- /tmp/ycm_temp/server_57448_stdout.log -- /tmp/ycm_temp/server_57448_stderr.log

:YcmToggleLogs stderr

2016-09-12 18:56:06,603 - INFO - Received health request 2016-09-12 18:56:06,610 - INFO - Received filetype completion available request 2016-09-12 18:56:06,612 - INFO - Starting JediHTTP server 2016-09-12 18:56:06,614 - INFO - using port 60721 2016-09-12 18:56:06,621 - INFO - Received event notification 2016-09-12 18:56:06,627 - INFO - Received event notification 2016-09-12 18:56:06,628 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 18:56:07,454 - INFO - Received completion request 2016-09-12 18:56:07,590 - INFO - Received completion request 2016-09-12 18:56:07,772 - INFO - Received completion request 2016-09-12 18:56:07,988 - INFO - Received completion request 2016-09-12 18:56:08,139 - INFO - Received completion request 2016-09-12 18:56:08,280 - INFO - Received completion request 2016-09-12 18:56:08,378 - INFO - Received event notification 2016-09-12 18:56:08,382 - INFO - Adding ONE buffer identifier for file: /home/shahril/git/ss/qt/test.py 2016-09-12 18:56:08,388 - INFO - Received completion request 2016-09-12 18:56:08,432 - INFO - Received completion request 2016-09-12 18:56:08,542 - INFO - Received completion request 2016-09-12 18:56:08,577 - INFO - Received completion request 2016-09-12 18:56:08,767 - INFO - Received event notification 2016-09-12 18:56:08,767 - INFO - Adding ONE buffer identifier for file: /home/shahril/git/ss/qt/test.py 2016-09-12 18:56:08,775 - INFO - Received completion request 2016-09-12 18:56:08,915 - INFO - Received completion request 2016-09-12 18:56:09,078 - INFO - Received completion request 2016-09-12 18:56:09,234 - INFO - Received completion request 2016-09-12 18:56:09,363 - INFO - Received completion request 2016-09-12 18:56:09,448 - INFO - Received completion request 2016-09-12 18:56:09,558 - INFO - Received completion request 2016-09-12 18:56:09,642 - INFO - Received event notification 2016-09-12 18:56:09,643 - INFO - Adding ONE buffer identifier for file: /home/shahril/git/ss/qt/test.py 2016-09-12 18:56:09,651 - INFO - Received completion request 2016-09-12 18:56:09,824 - INFO - Received completion request 2016-09-12 18:56:09,831 - INFO - Starting new HTTP connection (1): 127.0.0.1 2016-09-12 18:56:10,564 - INFO - Received event notification 2016-09-12 18:56:10,569 - INFO - Received event notification 2016-09-12 18:56:10,570 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 18:56:10,585 - INFO - Received event notification 2016-09-12 18:56:12,033 - INFO - Received event notification 2016-09-12 18:56:14,737 - INFO - Received completion request 2016-09-12 18:56:15,321 - INFO - Received event notification 2016-09-12 18:57:55,461 - INFO - Received completion request 2016-09-12 18:57:58,146 - INFO - Received event notification 2016-09-12 18:58:00,107 - INFO - Received event notification 2016-09-12 18:58:08,209 - INFO - Received completion request 2016-09-12 19:10:53,557 - INFO - Received event notification 2016-09-12 19:10:54,443 - INFO - Received debug info request 2016-09-12 19:11:16,416 - INFO - Received completion request 2016-09-12 19:11:16,419 - INFO - Starting new HTTP connection (1): 127.0.0.1 2016-09-12 19:11:17,252 - INFO - Received completion request 2016-09-12 19:11:17,606 - INFO - Received completion request 2016-09-12 19:11:17,881 - INFO - Received event notification 2016-09-12 19:11:17,882 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 19:11:17,889 - INFO - Received event notification 2016-09-12 19:11:17,890 - INFO - Adding ONE buffer identifier for file: /home/shahril/git/ss/qt/test.py 2016-09-12 19:11:17,935 - INFO - Received event notification 2016-09-12 19:11:17,935 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 19:11:18,364 - INFO - Received event notification 2016-09-12 19:11:18,364 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 19:11:21,544 - INFO - Received event notification 2016-09-12 19:11:21,544 - INFO - Adding buffer identifiers for file: /home/shahril/git/ss/qt/test.py 2016-09-12 19:11:23,149 - INFO - Received debug info request 2016-09-12 19:13:54,504 - INFO - Received event notification

OS that I use right now

Ubuntu 16.04

Problem

Recently I have a personal project, and I planned to use some GUI library for my program's interface.

However, when I included PySide through import into my project, and trying to use YCM, it does not show any autocomplete for me. For internal modules such as sys and tkinter, autocomplete works without any problem.

Before, I suspected that maybe Jedi is the source of this problem. But when I use plugin that utilize the same Jedi in another editor (autocomplete-python in Atom), it has no problem showing autocomplete for PySide.

Here is some screenshots :

Vim + YCM (Jedi)

image

Atom + autocomplete-python

image

shahrilnet commented 8 years ago

Alright, I am an idiot.

After setting up this option in my .vimrc : let g:ycm_python_binary_path = '/usr/bin/python3'

The autocomplete works!

This is because the module was installed using pip3, which will only work for Python 3 interpreter.

GopherJ commented 5 years ago

Thanks @shahril96 I have nearly the same problem ~

bstaletic commented 5 years ago

Note that setting g:ycm_python_binary_path is the old way to do it and has been deprecated in favour of having per-project settings in a local .ycm_extra_conf.py.