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

Ilya Biryukov via clangd-dev clangd-dev at lists.llvm.org
Tue Mar 12 07:22:07 PDT 2019


Hi Nathan,

Unless there are issues that would prevent auto-discovery from working, I
think we should prefer it instead.
One strong reason is that auto-discovery would work regardless of the
client support.

Even if we take workspace folders into account and load CDBs from those, I
think it's not enough.
A workspace folder represents a path to a project open in the editor.
However, one does not typically open
all of their dependencies in the same editor but would want to discover
CDBs for those dependencies.

+1 to Doug's suggestion, if we there's a client that has a legitimate need
to send all CDBs upfront, let's extend LSP
to allow this instead of assigning our own semantics to the existing
methods.


On Mon, Mar 11, 2019 at 3:13 AM Nathan Ridge via clangd-dev <
clangd-dev at lists.llvm.org> wrote:

> >> 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.
>
> Thanks,
> Nate
>
> [1]
> https://microsoft.github.io/language-server-protocol/specification#workspace_workspaceFolders
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>


-- 
Regards,
Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190312/ba8e7607/attachment.html>


More information about the clangd-dev mailing list