Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Build a common index using clangd and serve it? #47368

Open
rovere opened this issue Feb 17, 2025 · 6 comments
Open

Build a common index using clangd and serve it? #47368

rovere opened this issue Feb 17, 2025 · 6 comments

Comments

@rovere
Copy link
Contributor

rovere commented Feb 17, 2025

Dear all,
I guess many of us are using editors that, one way or another, are using LSP and clangd to make our coding within CMSSW a more pleasant experience.
Since the introduction of the "compilation commands" via compile_commands.json, our life (mine for sure) became much easier, because we know how to correctly parse our repository.
I was wondering if it could be feasible/useful to have the outcome of the parsing saved somewhere and served to the whole CMS/CMSSW community.

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 17, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

A new Issue was created by @rovere.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor

assign core

@cmsbuild
Copy link
Contributor

New categories assigned: core

@Dr15Jones,@makortel,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks

@smuzaffar
Copy link
Contributor

@iarspider , can you please look in to this?

@iarspider
Copy link
Contributor

iarspider commented Mar 5, 2025

There are, in theory, two methods of using shared index:

The simple one

  • Generate index using clangd-indexer (is not installed automatically so we need to update llvm recipe or use prebuilt executable). Building an index takes about 40 minutes, parallelizes automatically. Not incremental.
  • Push it to cvmfs (single file, ~250 Mb)
  • Download it when running scram project (optional)
  • Tell clangd where to look for prebuilt index:
$ cat .clangd
    Index:
      External:
        File: /path/to/clangd.dex
      Background: Skip
* Path can be relative to `.clangd` location
  • Can use clangd provided by the OS

There is, supposedly, no way to map local paths to build paths when using local index - but there is a way when using clangd-index-server. link

The hard one

  • Generate index using clangd-indexer
  • Serve it using clangd-index-server
    • Requires building llvm with remote capabilities, which add dependency on gRPC and protobuf.
  • Users will need to use clangd with remote capabilities (os-provided one usually does not have remote capabilities)
  • Tell clangd how to connect to index server:
$ cat .clangd
    Index:
      External:
        Server: my.index.server.com:50051
  • Need one server per index (i.e. per release series)

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants