bbchung / clighter8

VIM C++ semantic syntax highlight plugin
GNU General Public License v3.0
48 stars 3 forks source link

Plugin does not work, no useful error message #6

Closed petersohn closed 7 years ago

petersohn commented 7 years ago

I installed the plugin, and set the libclang path (I have both 3.8 and 3.9 installed, but the problem persists with any of these). After starting vim, I get no error message, but the result of :ClShowCompileInfo is the following: v:null, and nothing is highlighted. The log contains the following:

2017-01-04 14:03:10,333 - INFO - server start at 127.0.0.1:8787
2017-01-04 14:03:10,366 - INFO - accept a vim client
2017-01-04 14:03:10,366 - INFO - config libclang path

After restarting vim (but leaving the clighter server running), the following warning appears in the log:

2017-01-04 14:05:53,448 - INFO - accept a vim client
2017-01-04 14:05:53,449 - WARNING - library file must be set before before using any other functionalities in libclang.

The functionality is the same, though. I get the v:null and no highlighting.

I have Clang bindings installed for both the Python 2 and 3.

% pip2 show clang
Name: clang
Version: 3.8
Summary: libclang python bindings
Home-page: https://github.com/llvm-mirror/clang/bindings/python
Author: Loic Jaquemet
Author-email: loic.jaquemet+python@gmail.com
License: License :: OSI Approved :: University of Illinois/NCSA Open Source License
Location: /usr/local/lib/python2.7/dist-packages
Requires:
% pip3 show clang
Name: clang
Version: 3.8
Summary: libclang python bindings
Home-page: https://github.com/llvm-mirror/clang/bindings/python
Author: Loic Jaquemet
Author-email: loic.jaquemet+python@gmail.com
License: License :: OSI Approved :: University of Illinois/NCSA Open Source License
Location: /usr/local/lib/python3.5/dist-packages
Requires:

My vim has also both Python2 and Python3 support, as well as everything mentioned by clighter8:

% vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 02 2017 06:40:50)
Included patches: 1-134
Modified by pi-rho
Compiled by buildd@lcy01-12
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   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: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/-I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -Wall -Wextra -g -O2 -fPIE -Wformat -Werror=format-security -fstack-protector-all -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,-z,nodlopen -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,noexecheap -Wl,--as-needed -o vim  -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux   -lacl -lattr -lgpm -ldl   -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
petersohn commented 7 years ago

It seems that the problem is that the compile commands are not recognized. If I open a header file (that is not present in the compile_commands.json), then clighter8 works, but without any information gathered from the compilation database. However, for source files that are present in the database, no compile commands are recognized and there is no highlighting.

bbchung commented 7 years ago

can you post the compilation database snippet?

petersohn commented 7 years ago

Looking deeper into the problem, it seems that the problem comes up when there is a --sysroot in the compile commands. I'll write a new issue about it.

petersohn commented 7 years ago

Or more precisely, if there is anything after the file name in the command, the problem comes up.