vscode-clangd
vscode-clangd copied to clipboard
hope to add this feature,add `-I$(find ${workspaceFolder} -name "*.h" -exec dirname {} \; | sort | uniq)` in `Clangd: Fallback Flags `
I want to add
-I$(find ${workspaceFolder} -name "*.h" -exec dirname {} \; | sort | uniq) in Clangd: Fallback Flags , but it not work , I hope to add this feature because it is really useful
There are two ways to think about this request:
- Add support for vscode-clangd (or the clangd server itself) executing an arbitrary command in "fallback flags" via
$(command). I don't particularly have an opinion on this, but others may have thoughts on the security aspects. - Add support for some way to achieve what your command is trying to do, which is to add
-Iflags for every subdirectory of your workspace folder than contains.hfiles. Something like this has been proposed in https://github.com/clangd/clangd/issues/349 and https://github.com/clangd/clangd/issues/458.
In the meantime, my suggestion would be to put the command into a shell script which generates a clangd config file containing the flags like this:
CompileFlags:
Add: [
-Isubdirectory1
-Isubdirectory2
]
and then invoke the script before using clangd (perhaps as part of your project's build).