Closed zeechs closed 5 years ago
Your template is missing a
Hello
section so I will say hi here in the wrong section :)
True. Hello to you as well.
Flags
Allow me to say... ughh Correctly santizing flags is super difficult and I loath messing with our flags.py
.
I already know why this doesn't work with your setup.
-I
. In other words, stray file names in the command line are a big no-no.-
(or /
if using clang-cl
) is a flag and the rest are files. There are a few exceptions, but nevermind that. This results in YCM throwing out everything that it thinks is a filename, including @foo.rsp
.That's YCM's side. I have no idea if clang knows about @foo.rsp
. I know I see it for the first time.
All that said, I'd love it if clangd knows about this and everything works for you if you just switch to --clangd-completer
. In clangd+compile_commands.json case, YCM completely gets out of the way and goes "Clangd, you figure out the flags!" If that works, just keep using it. If that doesn't work, then we just can't support it.
Thank you for your fast response. I just tested as you said. Clangd seems to have the exact same behavior unfortunately. So if I understand well, as long as Clang does not understand this syntax, it is hopeless.
I might go ahead and script something to reformat the file properly. it should not be too hard. Seems fun anyway.
Another solution would be to drop MinGW in favor of Clang (would have to rebuild Qt, less fun) or msvc (too mainstream, just kidding ;) ).
I just tested as you said. Clangd seems to have the exact same behavior unfortunately. So if I understand well, as long as Clang does not understand this syntax, it is hopeless.
Exactly. To make sure, you can see what clangd is doing in its log (:YcmToggleLogs
) when you turn on debug log level (let g:ycm_log_level='debug'
).
You might want to submit a feature request for clang.
Officially, we don't claim support for MinGW or anything that is POSIX-like on Windows, because of the size of the team behind YCM. If it works, great, but if a problem is specific to MinGW that's a WONTFIX. However, if the flags without @foo.rsp
work, then YCM is working.
If you're using compile_commands.json, then I'd advise you to stay on clangd. If for no other reason then to have GoToReferences
available.
Anyway, I'm going to close this. If clang doesn't understand @foo.rsp
then there's no way YCM could.
Got it, thank you for your time and advice.
Edit: Feature already requested for Clangd https://github.com/clangd/clangd/issues/81
Issue Prelude
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
(orcmake
/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.
Issue Details
Your template is missing a
Hello
section so I will say hi here in the wrong section :)YCM (or Clang?) does not seem to understand the response file syntax (e.g.
@CMakeFiles/MyApp.dir/includes_CXX.rsp
) in thecompile_commands.json
file.This does not work. It says
file not found
on Qt included files:While this works. I manually substituted
@CMakeFiles/MyApp.dir/includes_CXX.rsp
with the content of the fileincludes_CXX.rsp
:I installed YCM plugin Started a sample C++/Qt project with CMake(3.15, but also tried 3.10 and 3.2) Exported compilation database and moved it to project root folder note: the compiler is
MinGW
.Here the
QApplication
and theQWidget
headers are not found.iostream
is found though and completion is triggered after typingstd::
and suggestsstd::cout
etc.The generated
compile_commands.json
should be parsed correctly, and all the headers included in the project should be found by YCM/Clang.The response file inclusions found in the
compile_command.json
file, such as@CMakeFiles/MyApp.dir/includes_CXX.rsp
are ignored, and no include path is taken into account. The compilation fails withfile not found
errors. And YCM does not provide any completion suggestion.Diagnostic data
Output of
vim --version
Output of
YcmDebugInfo
Contents of YCM, ycmd and completion engine logfiles
ycm_ea85ph1n.log
ycmd_51031_stderr_0magf_fw.log
ycmd_51031_stdout_7u49ildp.log
OS version, distribution, etc.
Windows 10 64 bits
Output of build/install commands
Not an installation issue.