I had to put clangd commands in a *.code-workspace file for it to work. Here's my file contents. It's for Windows but you should be able to adapt it:
{
"folders": [
{
"name": "FPS5_2",
"path": "."
},
{
"name": "UE5",
"path": "E:\\Program Files\\Epic Games\\UE_5.2"
}
],
"settings": {
"typescript.tsc.autoDetect": "off",
"editor.inlayHints.fontSize": 0,
"clangd.detectExtensionConflicts": false,
"clangd.arguments": [
"-header-insertion=iwyu",
"-header-insertion-decorators=true",
"-all-scopes-completion=true",
"-limit-results=100",
"-background-index=true",
"-limit-references=2000",
"-completion-style=detailed",
"-compile-commands-dir=e:\\Users\\ME\\Documents\\Unreal Projects\\FPS5_2\\.vscode\\unreal-clangd"
],
"clangd.path": "c:\\Program Files\\LLVM-15\\bin\\clangd.exe",
"files.associations": {
"*.clangd": "yaml",
"*.clang-format": "yaml",
"*.clang-tidy": "yaml"
},
"workbench.colorCustomizations": {
"editorInlayHint.foreground": "#a2a2a2c0",
"editorInlayHint.background": "#00000000"
},
"editor.suggestFontSize": 0
},
"extensions": {
"recommendations": [
"ms-vscode.cpptools",
"ms-dotnettools.csharp"
]
}
}