Hey there, Karthik! I've had a similar idea, though not tied to LSP or anything. I created a =org-contextual-src-mode= [1] ir order to have completion working on Ledger and LaTeX source buffers. It also handles tangling! I have made a Gist explaining, in a literate style, my process of building such a mode.
I think the contextual src block could be split from the LSP functionality, since it could be used in other contexts other than dealing with language servers. My iteration is not tied to anything in particular and simply creates a source buffer with the whole context for that tangled file. Hope this can help you in some way! [1] https://gist.github.com/bigodel/15599f3c1da23d1008b7d7d4ff8bff77 Cheers, -- João Pedro de A. Paula IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)