Sharing symbols between language servers

Hi, im pretty new to LLVM and clangd.
I currently have an custom IDE where a user can create a project containing both C/C++ and Structured Text code. When compiling the project both c/c++ and structured text is compiled to the same target and header files are created from the structured text so that the C/C++ code is able to include them and call the Structured Text code.

We’re currently adding a custom language-server based on langium for Structured Text. For C/C++ language support were currently using the vscode clangd extension.
The idea now is that our custom language server somehow would share this information about the available symbols and (not yet generated) header files with clangd to make them appear as code completion and not show any errors when the user uses them.

Just to throw some ideas out there, would it maybe be somehow possible to modify clangd’s index or somehow make some in-memory header files available to clangd?

The clangd server does internally use a “virtual filesystem” abstraction from the LLVM libraries, llvm::vfs::Filesystem.

So, if you’re willing to build a modified clangd server, you can replace the filesystem object that’s passed as the second argument to the ClangdLSPServer constructor with your own implementation, which looks in the real filesystem first, and for files not found there, provides access to your in-memory header files (possibly even generating their contents on the fly if desired).

Thanks alot, that sounds very interesting