Vscode
key bindings names
https://code.visualstudio.com/docs/getstarted/keybindings
C/C++ configs
There are two popular C/C++ plugins: C/C++ IntelliSense provided by Microsoft and Clangd provided by LLVM. Usually, I installed both, but IntelliSense has conflict with Clangd, so I have below configs to disable IntelliSense.
1
2
3
4
5
6
7
8
9
10
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.defines": [
],
"C_Cpp.default.enableConfigurationSquiggles": false,
"[cpp]": {
},
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.fallbackFlags": [
"-D_LIBCPP_STD_VER=17"
]
When Clangd is enabled, vscode parses files using Clangd and therefore the macros. For example, when I read llvm source code, there are a lot of codes like #if _LIBCPP_STD_VER >= 17
. In order to correctly highlight these blocks, I need to tell Clangd the value of this macro. The vscode clangd plugin has a configuration parameter clangd.fallbackFlags
for it. See below logs of how this parameter is used to create the build command.
1
2
3
4
I[11:56:10.293] Failed to find compilation database for /Users/xiongding/code/llvm-project/libcxx/include/variant
I[11:56:10.293] ASTWorker building file /Users/xiongding/code/llvm-project/libcxx/include/variant version 1 with command clangd fallback
[/Users/xiongding/code/llvm-project/libcxx/include]
/Library/Developer/CommandLineTools/usr/bin/clang -xobjective-c++-header -D_LIBCPP_STD_VER=17 -resource-dir=/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3 -- /Users/xiongding/code/llvm-project/libcxx/include/variant
This post is licensed under CC BY 4.0 by the author.