Что я делаю не так с моим .ycm_extra_conf.py?C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Что я делаю не так с моим .ycm_extra_conf.py?

Сообщение Anonymous »

Я успешно установил плагин Youcompleteme для VIM, и он уже работает, однако я не могу заставить его работать над реальным проектом. По какой -то причине я не могу создать .ycm_extra_conf.py < /code>, который на самом деле работает.

Код: Выделить всё

~/project
со следующей структурой:

Код: Выделить всё

~/project
~/project/.ycm_extra_conf.py
~/project/code
~/project/code/example.cpp
~/project/include
~/project/include/example.hpp
< /code>
Ничего особенного. Когда я редактирую example.cpp 
я пытаюсь #include "example.hpp" , но он уже не удается, потому что YCM говорит, что не может найти файл (

Код: Выделить всё

'example.hpp' file not found [pp_file_not_found]
).
vim обнаруживает файл .ycm_extra_conf.py и пытается его загрузить, однако я не уверен, работает ли он правильно.

Код: Выделить всё

Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_bgv1ytg4.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.10.4
-- Server has Clang support compiled in: True
-- Clang version: clang version 13.0.0 (https://github.com/ycm-core/llvm 02d1fa3185f1beeebb182b8911bfe09d3429707f)
-- Extra configuration file found and loaded
-- Extra configuration path: ~/project/.ycm_extra_conf.py
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 58005
--   Clangd executable: ['~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_part
y/clang/lib/clang/13.0.0', '-limit-results=500']
--   Clangd logfiles:
--     /tmp/clangd_stderr2sp81d3p.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: ~/project
--   Clangd Settings: {}
--   Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:55029
-- Server process ID: 57976
-- Server logfiles:
--   /tmp/ycmd_55029_stdout_lm0galgv.log
--   /tmp/ycmd_55029_stderr_myqhxgqt.log
my .ycm_extra_config.py выглядит так:

Код: Выделить всё

import os
import ycm_core

flags = [
'-Wall',
'-O3',
'-I../include',
'-I./include',
]

def FlagsForFile(filename, ** kwargs):
return
{
'flags': flags,
'do_cache': True
}
< /code>
Вывод из временных файлов журнала заключается в следующем.I[16:52:02.713] clangd version 13.0.0 (https://github.com/ycm-core/llvm 02d1fa3185f1beeebb182b8911bfe09d3429707f)
I[16:52:02.713] Features: linux
I[16:52:02.713] PID: 58005
I[16:52:02.713] Working directory: ~/project
I[16:52:02.713] argv[0]: ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
I[16:52:02.713] argv[1]: -header-insertion-decorators=0
I[16:52:02.713] argv[2]: -resource-dir=~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/13.0.0
I[16:52:02.713] argv[3]: -limit-results=500
I[16:52:02.713] Starting LSP over stdin/stdout
I[16:52:02.714]  reply:initialize(1) 1 ms
I[16:52:02.716] 
2022-06-08 16:52:01,284 - INFO - Completion config: 50, detailing -1 candiates
2022-06-08 16:52:01,284 - INFO - Completion config: 50, detailing -1 candiates
2022-06-08 16:52:01,285 - INFO - Completion config: 50, detailing -1 candiates
2022-06-08 16:52:01,286 - INFO - Completion config: 50, detailing -1 candiates
127.0.0.1 - - [08/Jun/2022 16:52:01] "GET /ready HTTP/1.1" 200 4

2022-06-08 16:52:01,382 - INFO - Clangd executable found at ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin and up to date
2022-06-08 16:52:01,383 - INFO - Using Clangd from ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
2022-06-08 16:52:01,383 - INFO - Computed Clangd command: ['~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/13.0.0', '-limit-results=500']
2022-06-08 16:52:01,383 - INFO - Completion config: 50, detailing -1 candiates
2022-06-08 16:52:01,383 - INFO - Returning cached Clangd command: ['~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/13.0.0', '-limit-results=500']
127.0.0.1 - - [08/Jun/2022 16:52:01] "GET /signature_help_available?subserver=cpp HTTP/1.1" 200 23
127.0.0.1 - - [08/Jun/2022 16:52:01] "POST /event_notification HTTP/1.1"  200 2
Traceback (most recent call last):
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 868, in _handle
return route.call(**args)
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1748, in wrapper
rv = callback(*a, **ka)
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/watchdog_plugin.py", line 97, in wrapper
return callback( *args, **kwargs )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/hmac_plugin.py", line 62, in wrapper
body = callback( *args, **kwargs )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 63, in EventNotification
response_data = getattr( _server_state.GetFiletypeCompleter( filetypes ),
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 1787, in OnFileReadyToParse
self._StartAndInitializeServer( request_data )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 1773, in _StartAndInitializeServer
self._extra_conf_dir = self._GetSettingsFromExtraConf( request_data )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 1741, in _GetSettingsFromExtraConf
module = extra_conf_store.ModuleForSourceFile( request_data[ 'filepath' ] )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/extra_conf_store.py", line 55, in ModuleForSourceFile
return Load( ModuleFileForSourceFile( filename ) )
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/extra_conf_store.py", line 66, in ModuleFileForSourceFile
if Load( module_file ):
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/extra_conf_store.py", line 151, in Load
if not force and not _ShouldLoad( module_file, is_global ):
File "~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/extra_conf_store.py", line 134, in _ShouldLoad
raise UnknownExtraConf( module_file )

(Question can be turned off with options, see YCM docs)
127.0.0.1 - - [08/Jun/2022 16:52:01] "POST /event_notification HTTP/1.1" 500 2671
127.0.0.1 - - [08/Jun/2022 16:52:01] "POST /semantic_completion_available HTTP/1.1" 200 4
127.0.0.1 - - [08/Jun/2022 16:52:02] "POST /load_extra_conf_file HTTP/1.1" 200 4

2022-06-08 16:52:02,704 - INFO - Starting Clangd: ['~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/13.0.0', '-limit-results=500']
2022-06-08 16:52:02,706 - INFO - Clangd started with PID 58005
127.0.0.1 - - [08/Jun/2022 16:52:02] "POST /event_notification HTTP/1.1" 200 2
2022-06-08 16:52:02,716 - INFO - cfamily: Language server does not require resolve request
2022-06-08 16:52:02,716 - INFO - cfamily: Language server requires sync type of Incremental
2022-06-08 16:52:02,716 - INFO - cfamily: Using characters for signature triggers: (,,
127.0.0.1 - - [08/Jun/2022 16:52:02] "POST /receive_messages HTTP/1.1" 200 4
127.0.0.1 - - [08/Jun/2022 16:52:03] "POST /receive_messages HTTP/1.1" 200 1472
127.0.0.1 - - [08/Jun/2022 16:52:05] "POST /debug_info HTTP/1.1" 200 960
127.0.0.1 - - [08/Jun/2022 16:52:13] "POST /receive_messages HTTP/1.1" 200 4

Любая помощь будет оценена!
Ура

Подробнее здесь: https://stackoverflow.com/questions/725 ... ra-conf-py
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»