When I try to save a .c or .cc source file using :w command, at the first time I input :w command, it will raise ValueError: Still no compile flags, no completions yet error. If I input the :w command at the same line again, it will not raise this error.
However, if I move the cursor to next line and input :w command again, it will raise that error again.
So I think the problem is that it will raise ValueError at the first time I input :w command at each line.
This will not happen if I try to save a .py source file using :w.
I don't know if this is a real bug/problem. I think it is better if we can get rid of it.
The following is the debug information
- INFO - Received event notification
- DEBUG - Event name: FileReadyToParse
- INFO - Adding buffer identifiers for file: /Users/Chen/Developer/Temp/gcd.cpp
Traceback (most recent call last):
File "/Users/Chen/.janus/YCM/third_party/bottle/bottle.py", line 861, in _handle
return route.call(**args)
File "/Users/Chen/.janus/YCM/third_party/bottle/bottle.py", line 1725, in wrapper
rv = callback(*a, **ka)
File "/Users/Chen/.janus/YCM/python/ycm/server/../../ycm/server/watchdog_plugin.py", line 76, in wrapper
return callback( *args, **kwargs )
File "/Users/Chen/.janus/YCM/python/ycm/server/../../ycm/server/handlers.py", line 68, in EventNotification
event_handler )( request_data )
File "/Users/Chen/.janus/YCM/python/ycm/server/../../ycm/completers/cpp/clang_completer.py", line 194, in OnFileReadyToParse
raise ValueError( NO_COMPILE_FLAGS_MESSAGE )
ValueError: Still no compile flags, no completions yet.
You get this error because you're ycm_extra_conf.py file is not providing YCM with compilation flags. See the docs for details.
Got it. Thanks.
Set below in vimrc works fine.
let g:ycm_global_ycm_extra_conf = 'path to .ycm_extra_conf.py'
Intrusive messages like this are extremely annoying if you happen to be working with a project you don't want/care about YCM support for. If the completion is going to fail I'd rather it just failed and maybe put something in a log file than block the whole UI.
Agreed: Once YCM is installed it means we need to have ycm_extra_conf.py in every projects even if we don't need it. Is there anyway to have ycm_extra_conf.py in the .vimrc folder instead of the project directory ?
@fabiensanglard I use a default .ycm_extra_conf.py stored at my home directory. It's always loaded when there isn't a local project one.
@fabiensanglard ah yes, I also put this on my .vimrc to make it the default:
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
@fabiensanglard I mean, you guys may be confusing something because, that's a default configuration, but it doesn't overwrite the local search for a .ycm_extra_conf.py file. YCM tries to find one such file going up the directory structure of the opened source file, if it doesn't find one, it uses the global default.
.ycm_extra_conf.py is in ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm
Thanks for answer, I've fixed it by adding those lines in ~/.vimrc file
"Youcompleteme fix
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
You almost certainly do not want to do that. The README explains what you need to do as do the comments in that file.
even after following above suggestions for adding to .vimrc file - it does not work for me when i use vim inside tmux setup - error still shows
I still get the same mistake, but only on osx. I used this tutorial (http://bastian.rieck.ru/blog/posts/2015/ycm_cmake/) to get my .ycm_extra_conf.py running.
This works on my second laptop running linux, but not on my primary macbook.
My compile_commands.json file looks like this
[
{
"directory": "/Users/arwed/Development/c/sat-interpreter.h/build",
"command": "/usr/local/opt/llvm/bin/clang++ -I/Users/arwed/Development/c/sat-interpreter.h/include -isystem /usr/local/include -g -std=gnu++14 -o CMakeFiles/test-tokenizer.dir/test/tokenizer.cpp.o -c /Users/arwed/Development/c/sat-interpreter.h/test/tokenizer.cpp",
"file": "/Users/arwed/Development/c/sat-interpreter.h/test/tokenizer.cpp"
},
...
]
My guess was that it might be because the osx clang is some specific apple clang.
Therefore I installed clang manually /usr/local/opt/llvm/bin/clang++ and set it as the default compiler.
This did not work however.
Does anybody experience the same behaviour, knows a fix to it or can tell me how to debug this?
@Pfeifenjoy The tutorial that you linked is outdated. Make sure you have the latest version of YCM and read this section of the docs. If it still doesn't work after following the instructions, come to the Gitter room and we'll try to figure out the issue.
@micbou I followed the instructions and afterwards realized that I haven't
described the problem correctly.
It works as expected if I have a hpp and a cpp file.
However sometimes if I only have an hpp file I get the error message.
After of using YCM for a while this error seemed to appear only randomly,
therefore I don't really care about the message anymore.
Thanks for your help.
If you only have a header, you will need an extra conf. A compilation database won't do.
Most helpful comment
Intrusive messages like this are extremely annoying if you happen to be working with a project you don't want/care about YCM support for. If the completion is going to fail I'd rather it just failed and maybe put something in a log file than block the whole UI.