解决方案:
手动生成compile_commands.json:
xmake project -k compile_commands
然后把它拷贝到.vscode中即可。
c_cpp_properties.json(参考)
{ "configurations": [ { "compileCommands": ".vscode/compile_commands.json", "intelliSenseMode": "windows-msvc-x64", "cStandard": "c17", "cppStandard": "c++17" } ], "version": 4 }