[clangd-dev] Multi-project workflow via multiple CDBs

Nathan Ridge via clangd-dev clangd-dev at lists.llvm.org
Sun Mar 10 19:13:10 PDT 2019

>> Out of curiosity, though - if a client wanted to send all the CDBs upfront, to avoid the 
>> requirement that you have to open a file from each project, would that be a reasonable 
>> capability to add?
> That seems doable. The way this currently works is:
>  - A CDB is "discovered" the first time we try to get the command for a file under its directory
>  - once a CDB is "discovered", the auto-index loads any index shards that exist for the CDB, 
> and starts indexing files that don't have an up-to-date shard
> So we could add a custom command or a startup option to make clangd discover particular 
> CDBs (e.g. by looking for a compile command for dir/dummy.txt, and then throwing it away).

It has since come to my attention that the LSP has recently gained a new workspace/workspaceFolders request [1], which is a mechanism for the server to learn about multiple root folders in the workspace, for editors that support such things. This request is not currently implemented in clangd.

Do you think this would be a good fit for telling the server about multiple CDBs as well? We could implement this request, and as an extension, support an additional field in the WorkspaceFolder struct to specify the CDB path.


[1] https://microsoft.github.io/language-server-protocol/specification#workspace_workspaceFolders

More information about the clangd-dev mailing list