Comments (3)
you need to check clangd logs, which can be done through :CocInfo
. you should see a log line of the form: Loaded compilation database from xxx
. Whenever clangd loads a compilation database.
Also you can look for a log line of the form Updating xxx with comand xxx
to see what compile commands clangd is using for a file.
What if both compile_commands.json and compile_flags.txt are on the same directory. Which one is used?
compile_flags.txt will take precedence.
What if compile_commands.json is on src directory and compile_flags.txt in foo2? Since it starts searching the parent directories I assume it will find compile_commands.json first and stop searching any more.
We search by going up, so assuming the structure of foo1/foo2/foo3/src
and a file inside src/
directory, we'll make use of the compilation database in src
and stop the search.
What if compile_commands.json is on src directory and compile_flags.txt in foo2 but compile_commands is invalid? Is it skipped and the compile_flags.txt in foo2 is used?
it depends on your definition of invalid, as long as the file has valid json contents we'll use it. even if the compile commands don't make sense for clang.
from coc-clangd.
Thank you for your reply
- What I mean by "invalid compile_commands.json" is sth like the example I provided.
[
adfgadgadfadgasdgadga <<<--- INVALID ENTRY. JSON NO LONGER VALID
{ "directory": "/home/user/llvm/build",
"command": "/usr/bin/clang++ -Irelative -DSOMEDEF="With spaces, quotes and \-es." -c -o file.o file.cc",
"file": "file.cc" },
...
]
I was trying to get an error message so I was breaking the json.
-
I wasn't able to find the "Loaded compilation database" string but I could find the command from the complile_commands.json e.g. /usr/bin/c++ --driver-mode=g++ -o CMakeFiles/test.dir/solution.cpp.o -c
-
Moreover I could find a "Failed to find compilation database" message if a complile_commands.json was not present or was invalid and no "compile_flags.txt" was available as well.
-
I could also find the flags from compile_flags.txt when complile_commands.json was not present.
from coc-clangd.
I wasn't able to find the Loaded compilation database string
Ah, you are right this was introduced right after the branch cut. So it didn't make into clangd-10. You would need to use a weekly build for it, or build from source directly. Weekly builds of clangd can be found at https://github.com/clangd/clangd/releases
from coc-clangd.
Related Issues (20)
- stdint.h Library error HOT 1
- Question: navigate to conflicting item/item causing error? HOT 4
- clangd don't start on windows HOT 1
- Unable to locate C/C++ header files (stdio.h, etc.) HOT 1
- coc-clangd still use c++03 to diagnose HOT 1
- some error flag but the code can running HOT 1
- How do I remove the automatically added parameter label in parentheses? HOT 1
- An issue of including libraries HOT 9
- Duplicate references HOT 2
- Command CocCommand clangd.install fails with error 'Failed to install clangd language server' HOT 5
- 这个插件如何在补全头文件比如#include<iostream>时,光标在>的右边,否则每次都多跳过这个符号一次 HOT 1
- [coc.nvim] Connection to server got closed. Server will not be restarted. HOT 4
- 'iostream' file not found (clang pp_file_not_found) HOT 1
- Connection to server got closed HOT 1
- coc-clangd没有输入头文件的情况下也能补全 HOT 4
- Header file not found, even though autocompletion works and include path is added correctly HOT 5
- MinGW issue HOT 1
- MinGW issue
- It can support like [c-mantic] feature? HOT 1
- Env include path not working in header files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coc-clangd.