microsoft / lsif-node

Define an index format for Language Servers
MIT License
172 stars 38 forks source link

Incremental Updates to LSIF #120

Open brianshih1 opened 3 years ago

brianshih1 commented 3 years ago

I am still pretty new to the repo and others have probably brought this up already, but how hard would it be to incrementally update the constructed LSIF graph? Currently I only see an lsif function that seems to visit the entire program each time.

dbaeumer commented 3 years ago

What already exists is updating a single project that is part of a larger repository with many projects. No work has started though to update a single project graph incrementally on a file scope.

brianshih1 commented 3 years ago

@dbaeumer Ahh I see, thanks! Also not sure if you've thought a bit about how difficult it would be to update a single project graph incrementally on a file scope, but if I were to do it on my own implementation of LSIF, what might be some tricky aspects and things to consider about?

dbaeumer commented 3 years ago

The TS compiler has an option for incremental update. So we would need to leverage this and store the TS compiler build state somewhere.

brianshih1 commented 3 years ago

@dbaeumer Just curious, what would the final LSIF graph after the incremental update look like? Would we remove all vertices marked by the document begin event vertex and the document end event vertex and just use the same emitter to keep appending vertices to the graph with higher and higher id?

dbaeumer commented 3 years ago

IMO the final graph should only contain the delta to the old graph with their own ids. The tool that imports it into a DB would be responsible to merge these with the original graph based on file names, monikers, ....