Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:
vim --version.:YcmDebugInfo.:YcmToggleLogs command.install.py (or cmake/make/ninja) including its invocationThank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Provide a clear description of the problem, including the following key
questions:
What did you do?
I used ./install.py --all
Include steps to reproduce here.
used on a bunch of c++ files tried using Ctrl+Space I got no completion after std
I've also tried other languages
Include description of a minimal test case, including any actual code required
to reproduce the issue.
What did you expect to happen?
have std : : produce a completion window
Include description of the expected behaviour.
have a window that gives me choices of code to complete
vim --versionPlace the output here, or a link to a gist.
YcmDebugInfoPlace the output here, or a link to a gist.
Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by:YcmToggleLogs.
Include system information here.
Include link to a gist containing the invocation and entire output of
install.pyif reporting an installation issue.
Log1:
17 self._response = self.PostDataToHandler( request_data, 'debug_info' )
18 File "/home/ben/.vim/bundle/youcompleteme/autoload/../python/ycm/client/base_request.py", line 79, in PostDataToHandler
19 timeout ) )
20 File "/home/ben/.vim/bundle/youcompleteme/autoload/../python/ycm/client/base_request.py", line 192, in JsonFromFuture
21 raise MakeServerException( response.json() )
22 ycmd.responses.ServerError: IndentationError: unindent does not match any outer indentation level (.ycm_extra_conf.py, line 138)
Log2:
19 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/utils.py", line 400, in LoadPythonSource
20 return imp.load_source( name, pathname )
21 File "/home/ben/.ycm_extra_conf.py", line 138
22 return flags
23 ^
24 IndentationError: unindent does not match any outer indentation level
Log3:
serving on http://127.0.0.1:35977
You have an error in your .ycm_extra_conf.py file. The indentation is wrong at line 138. If you don't mind sharing the contents of your .ycm_extra_conf.py file, we can take a look and tell you exactly what's wrong.
For the record, the clue was:
21 File "/home/ben/.ycm_extra_conf.py", line 138
22 return flags
23 ^
24 IndentationError: unindent does not match any outer indentation level
turns out there was an empty space before the return flags that I couldn't see, let me see if it works now
turns out I fixed the error and the c++ semantic completion still isn't working i have no clue what else to do
What's the output of :YcmDebugInfo? Do you get errors when running the :YcmDiags command?
YcmDebugInfo
Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_o1qms88m.log
-- Server Python interpreter: /usr/bin/python
-- Server Python version: 2.7.12
-- Server has Clang support compiled in: True
-- Clang version: clang version 5.0.0 (tags/RELEASE_500
/final)
-- Extra configuration file found and loaded
-- Extra configuration path: /home/ben/.ycm_extra_conf.
py
-- Server running at: http://127.0.0.1:37009
-- Server process ID: 11947
-- Server logfiles:
-- /tmp/ycmd_37009_stdout_73ikv7zi.log
-- /tmp/ycmd_37009_stderr_7gsj41oi.log
YcmDiags
I get No Warning or errors detected for my cpp file
Sorry, I should've asked you to run :YcmDebugInfo while editing your C++ file. What's the output in that case?
Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_n17gi_h_.log
-- Server Python interpreter: /usr/bin/python
-- Server Python version: 2.7.12
-- Server has Clang support compiled in: True
-- Clang version: clang version 5.0.0 (tags/RELEASE_500
/final)
-- Extra configuration file found and loaded
-- Extra configuration path: /home/ben/.ycm_extra_conf.
py
-- Server running at: http://127.0.0.1:37241
-- Server process ID: 12788
-- Server logfiles:
-- /tmp/ycmd_37241_stdout_osz80lhw.log
-- /tmp/ycmd_37241_stderr_ildd56jn.log
There are still probably errors in your .ycm_extra_conf.py file. Could you attach the contents of the ycmd stderr logfile after trying to get completions?
1 2018-02-09 13:32:48,810 - DEBUG - No global extra conf, not calling method YcmCorePreload
2 2018-02-09 13:32:48,896 - INFO - Received ready request
3 2018-02-09 13:32:48,910 - INFO - Received event notification
4 2018-02-09 13:32:48,910 - DEBUG - Event name: BufferVisit
5 2018-02-09 13:32:48,917 - INFO - Received event notification
6 2018-02-09 13:32:48,917 - DEBUG - Event name: FileReadyToParse
7 2018-02-09 13:32:48,918 - INFO - Adding buffer identifiers for file: /home/ben/dev/school/cpp/homework/challanges/ch4/challenge3/MagicDates.cpp
8 Traceback (most recent call last):
9 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle
10 return route.call(*args)
11 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
12 rv = callback(a, *ka)
13 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
14 return callback( *args, *kwargs )
15 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
16 body = callback( args, *kwargs )
17 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
18 event_handler )( request_data )
19 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 385, in OnFileReadyToParse
20 flags = self._FlagsForRequest( request_data )
21 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 468, in _FlagsForRequest
22 return self._flags.FlagsForFile( filename, client_data = client_data )
23 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 128, in FlagsForFile
24 client_data )
25 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 159, in _GetFlagsFromExtraConfOrDatabase
26 return _CallExtraConfFlagsForFile( module, filename, client_data )
27 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 256, in _CallExtraConfFlagsForFile
28 if inspect.getargspec( module.FlagsForFile ).keywords:
29 AttributeError: 'module' object has no attribute 'FlagsForFile'
30 2018-02-09 13:32:49,023 - INFO - Received filetype completion available request
31 2018-02-09 13:32:54,723 - INFO - Received debug info request
32 2018-02-09 13:32:54,725 - ERROR - 'module' object has no attribute 'FlagsForFile'
33 Traceback (most recent call last):
34 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/handlers.py", line 238, in DebugInfo
35 request_data ).DebugInfo( request_data )
36 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 439, in DebugInfo
37 flags = self._FlagsForRequest( request_data ) or []
38 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 468, in _FlagsForRequest
39 return self._flags.FlagsForFile( filename, client_data = client_data )
40 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 128, in FlagsForFile
41 client_data )
42 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 159, in _GetFlagsFromExtraConfOrDatabase
43 return _CallExtraConfFlagsForFile( module, filename, client_data )
44 File "/home/ben/.vim/bundle/youcompleteme/third_party/ycmd/ycmd/../ycmd/completers/cpp/flags.py", line 256, in _CallExtraConfFlagsForFile
45 if inspect.getargspec( module.FlagsForFile ).keywords:
46 AttributeError: 'module' object has no attribute 'FlagsForFile'
47 2018-02-09 13:33:02,373 - INFO - Received event notification
48 2018-02-09 13:33:02,374 - DEBUG - Event name: BufferUnload
32 2018-02-09 13:32:54,725 - ERROR - 'module' object has no attribute 'FlagsForFile'
Your .ycm_extra_conf.py doesn't have def FlagsForFile( filename ):. That's the function we call to get your flags.
What @bstaletic said. Here's a minimal working example:
# Add your flags to this list.
flags = [
'-x',
'c++',
]
def FlagsForFile(filename):
return {'flags': flags}
See the docs for more info on how to write that file.
do I have to use something like make when I build my project for single files? because I just ran a config_gen and it apprently collected 0 relevent entries for C / c++ collection
No, but you have to provide some flags somehow. For simple, single file code what @micbou posted about should be sufficient.
I'm 100% sure that the issue here is with your extra conf file, and carefully reading the user guide should be enough to get you working. as such i'm closing this. if you do discover a reproducible YCM bug, then we can either re-open or open a new issue (preferred)
so somehow my vim and everything got deleted I'm now having trouble as I have a g_ycm_global_ycm_extra_conf set but everytime I open a vim file I get no extra conf detected
Never mind i'm an idiot I just realized my error
Hey, did you solve this? The README says that the .ycm_extra_conf.py file calls the Settings function. Nowhere does it stipulate the requirement for FlagsForFile function. Can you please clarify?
FlagsForFile is the historical method, now deprecated and replaced by Settings. Both are supported still, but you should use Settings per the docs. https://github.com/valloric/ycmd#user-level-customization
Most helpful comment
What @bstaletic said. Here's a minimal working example:
See the docs for more info on how to write that file.