[clang-tools-extra] [clangd] Add background index path mapping (PR #180285)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 12:05:21 PST 2026


ArcsinX wrote:

> > This looks important, initially on ClientA there is `--background-index-path-mappings=${workspaceFolder}=/BUILDTOKEN` option. I tried and it works for me too, but does it work if you don't specify this option on Client A? I.e.
> > 
> > * Client A has no `--background-index-path-mappings` option
> > * Client B has `--background-index-path-mappings=${workspaceFolder}=client_a_workspace_folder_here`
> 
> Ah, I see. I was always thinking usage would be "generate a reusable index first." I would have guessed this would work too, but I can investigate why it might not.
> 
Also, in general case the only one mapping is not enough, because users can have different paths to system includes, SDKs, etc. I.e. we need to map not only workspace path, but also some other paths. So, we need to ensure that `--background-index-path-mappings=` works not only with prepared paths and in cases when we have several comma separated mappings

> > P.S. also it seems that modification of compile command doesn't lead to the related file reindexing. Thus, compilation command inside `*.idx` file looks unused. Maybe it's a clangd bug, this needs deeper investigation, but this can be important for path mappings. If this is a bug and it will be fixed, then compile commands paths inside *.idx files also must be mapped
> 
> Interesting! Thanks for the heads up.
I've created issue for this problem https://github.com/llvm/llvm-project/issues/180821



https://github.com/llvm/llvm-project/pull/180285


More information about the cfe-commits mailing list