[clangd-dev] textDocument/didOpen, file tracking, reading files from disk, etc.

Ken Domino via clangd-dev clangd-dev at lists.llvm.org
Sat Nov 23 18:03:58 PST 2019


Folks,

I'm currently writing a bunch of extensions for Visual Studio 2019 to 
exercise the client-side functionality against different LSP servers. 
The VS2019 client code makes a textDocument/documentSymbol request just 
after initialization, which is perfectly fine according to the LSP spec. 
However, in Clangd, if it hadn't received the textDocument/didOpen 
request first, it returns an error because the file is untracked in 
DraftMgr--which is an equally fine interpretation of the spec. So, the 
VS2019 client never works with Clangd. I have a patch to Clangd to fix 
this, reading the file from the file system and then adding the doc so 
it is tracked. But the question is whether people are going to balk 
because from a purist point of view, Clangd only gets the file contents 
from the client. I have no control over the client because it's MS code, 
and I'd rather not write a client from scratch at this point--I'd rather 
spend time working on my server for Antlr and other programming 
languages. What do people think about having Clangd read from disk for 
any untracked docs?

Note, I'm sending this to the old mail list instead of Discourse or 
Discord or whatever people call it--not many are using it, the UI isn't 
easy, and not as simple as sending an email.

Ken Domino



More information about the clangd-dev mailing list