LSIF: Implement basic diff pushing
Created by: efritz
Currently, a user browsing commit c
which is not indexed will get precise code intelligence via a nearest index at (for example) commit c-n
. If there are changes to this file between these commits, then the user may be requesting a range that is not equivalent between the two commits. (Specifically, if there are additions before it then the range's offset is too high; if there are deletions then it's too low).
See for a recent example of this behavior.
This PR uses the git diff between the requested and the indexed commit and adjusts the line offset before hitting the LSIF backend. This works for all cases where the input range is not directly modified between these commits (that particular line has not been edited or added after the index was generated).
Future work:
- the TODOs noted in this PR; specifically, we will jump to the indexed commit on j2d and find-refs, where we should be trying to find the equivalent location in the requested commit to keep the user's viewing context
- performance analysis and optimization (we first need to see what improvements are necessary)
- batch git diff requests
- cache adjustment results