0

I'm use vim with the YouCompleteMe plugin. One day it have fail to finding STL files. :YcmDebugInfo

Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_squvcfr3.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.10.6
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 1295096
--   Clangd executable: ['/home/vailii/.vim/plugged/YouComplet
eMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-
header-insertion-decorators=0', '-resource-dir=/home/vailii/.v
im/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/li
b/clang/15.0.1', '-limit-results=500']
--   Clangd logfiles:
--     /tmp/clangd_stderr8_kc02pn.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /home/vailii/src/testTest
--   Clangd Settings: {}
--   Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:43779
-- Server process ID: 1295083
-- Server logfiles:
--   /tmp/ycmd_43779_stdout_3fzpz77h.log
--   /tmp/ycmd_43779_stderr_clzjpieb.log
-- Semantic highlighting supported: True
-- Virtual text supported: False
-- Popup windows supported: True

clangd log:

2023-04-09 23:05:26,531 - INFO - Completion config: 50, detailing -1 candiates
2023-04-09 23:05:26,531 - INFO - Completion config: 50, detailing -1 candiates
2023-04-09 23:05:26,531 - INFO - Completion config: 50, detailing -1 candiates
2023-04-09 23:05:26,532 - INFO - Completion config: 50, detailing -1 candiates
127.0.0.1 - - [09/Apr/2023 23:05:26] "GET /ready HTTP/1.1" 200 4
2023-04-09 23:05:26,546 - INFO - Adding buffer identifiers for file: /home/vailii/src/testTest/src/main.cpp
2023-04-09 23:05:26,572 - INFO - Clangd executable found at /home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin and up to date
2023-04-09 23:05:26,572 - INFO - Using Clangd from /home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
2023-04-09 23:05:26,572 - INFO - Computed Clangd command: ['/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/15.0.1', '-limit-results=500']
2023-04-09 23:05:26,573 - INFO - Completion config: 50, detailing -1 candiates
2023-04-09 23:05:26,573 - INFO - Returning cached Clangd command: ['/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/15.0.1', '-limit-results=500']
2023-04-09 23:05:26,574 - INFO - Starting Clangd: ['/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/vailii/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/15.0.1', '-limit-results=500']
127.0.0.1 - - [09/Apr/2023 23:05:26] "GET /signature_help_available?subserver=cpp HTTP/1.1" 200 23
127.0.0.1 - - [09/Apr/2023 23:05:26] "POST /event_notification HTTP/1.1" 200 2
2023-04-09 23:05:26,576 - INFO - Clangd started with PID 1295096
127.0.0.1 - - [09/Apr/2023 23:05:26] "POST /event_notification HTTP/1.1" 200 2
2023-04-09 23:05:26,601 - INFO - cfamily: Language server does not require resolve request
2023-04-09 23:05:26,601 - INFO - cfamily: Language server requires sync type of Incremental
2023-04-09 23:05:26,601 - INFO - cfamily: Using characters for signature triggers: (,),{,},<,>,,
127.0.0.1 - - [09/Apr/2023 23:05:26] "POST /semantic_completion_available HTTP/1.1" 200 4
127.0.0.1 - - [09/Apr/2023 23:05:26] "POST /receive_messages HTTP/1.1" 200 3017
127.0.0.1 - - [09/Apr/2023 23:05:31] "POST /debug_info HTTP/1.1" 200 800
127.0.0.1 - - [09/Apr/2023 23:05:36] "POST /receive_messages HTTP/1.1" 200 4
127.0.0.1 - - [09/Apr/2023 23:05:46] "POST /receive_messages HTTP/1.1" 200 4
127.0.0.1 - - [09/Apr/2023 23:05:56] "POST /receive_messages HTTP/1.1" 200 4
127.0.0.1 - - [09/Apr/2023 23:06:07] "POST /receive_messages HTTP/1.1" 200 4
127.0.0.1 - - [09/Apr/2023 23:06:17] "POST /receive_messages HTTP/1.1" 200 4

Anybody know how to fix ycm (clangd?) for find STL files?

Also I see in YcmDebugInfo :

-- Server has Clang support compiled in: False
-- Clang version: None

but clangd is running. Is it OK?

I have try to reconfigure ycm by run 'python3 install.py --clangd-completer'. I have try to use system clangd by configure g:ycm_clangd_binary_path. Anyway ycm doesn't find STL files.

  • 1
    Use the plugin's official support channels. – romainl Apr 09 '23 at 17:15
  • I found the solution myself. The problem reason is clangd can't find headers in /usr/include/c++/11/ Some details of the environment: the compilator is accessible by /usr/bin/g++ . The STL library is accessible by /usr/include/c++/11/ . Solution: add to .vimrc `let g:ycm_clangd_args = [ '--query-driver=/usr/bin/c++' ]` There are g:ycm_clangd_args is the ycm option for add flags to clangd, --query-driver is the clangd flag for find STL, /usr/bin/c++ is magic string clangd find STL in /usr/include/c++/11/ – Vasilii Apr 16 '23 at 08:55
  • Well, make it an answer. – romainl Apr 16 '23 at 09:21

0 Answers0