tweekmonster / deoplete-clang2

MIT License
90 stars 17 forks source link

`deoplete` throws error when start using this plugin #13

Open imcvampire opened 7 years ago

imcvampire commented 7 years ago

This is full messages:

[deoplete] Exception during clang2.on_event for event 'Init': Expecting value: line 1 column 1 (char 0).  Use :messages for error details.                                                      
[deoplete] Traceback (most recent call last):                                                   
[deoplete]   File "/home/nqa/dein.vim/.cache/init.vim/.dein/rplugin/python3/deoplete/deoplete.py", line 454, in on_event                                                                        
[deoplete]     source.on_event(context)                                                         
[deoplete]   File "/home/nqa/dein.vim/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 151, in on_event                                                         
[deoplete]     cmd, flags = self.build_flags(context)                                           
[deoplete]   File "/home/nqa/dein.vim/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 503, in build_flags                                                      
[deoplete]     db_flags = self.find_db_flags(context)                                           
[deoplete]   File "/home/nqa/dein.vim/.cache/init.vim/.dein/rplugin/python3/deoplete/sources/deoplete_clang2.py", line 347, in find_db_flags                                                    
[deoplete]     for entry in json.load(fp):                                                      
[deoplete]   File "/usr/lib/python3.6/json/__init__.py", line 299, in load                      
[deoplete]     parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)        
[deoplete]   File "/usr/lib/python3.6/json/__init__.py", line 354, in loads                     
[deoplete]     return _default_decoder.decode(s)                                                
[deoplete]   File "/usr/lib/python3.6/json/decoder.py", line 339, in decode                     
[deoplete]     obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                
[deoplete]   File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode                 
[deoplete]     raise JSONDecodeError("Expecting value", s, err.value) from None                 
[deoplete] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)              
[deoplete] Exception during clang2.on_event for event 'Init': Expecting value: line 1 column 1 (char 0).  Use :messages for error details.  
tweekmonster commented 7 years ago

Sorry for the delay. What's the contents of compile_commands.json? This sounds like it's a problem with that file not being valid JSON.

imcvampire commented 7 years ago

Sorry but I can't get your point. What do you mean about compile_commands.json?

ghost commented 7 years ago

@imcvampire he means http://clang.llvm.org/docs/JSONCompilationDatabase.html

imcvampire commented 7 years ago

I just tested with a single .cpp file with no compile_commands.json

aurieh commented 7 years ago

@imcvampire You can make a file like that yourself, but you should use CMake. CMake versions 2.8 and above with

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

somewhere in CMakeLists.txt should do just fine. Some references: Official tutorial Documentation All links above should be available in the man database, if you have cmake installed. If you want to write the file yourself, however, see the link @toogley gave you.

jheidbrink commented 6 years ago

I'm facing the same issue. I modified deoplete_clang2.py so that it would show me the contents of the json file if the json.load fails. The result is that the file exists but is empty. I have checked out the deoplete-clang commit 8877dda0a474824. I'm on Archlinux using the clang package version 5.0.1-2.