Repository navigation
Support reference streaming - #164
Nick Snyder (nicksnyder) wants to merge 1 commit into
Conversation
|
Hi Nick Snyder (@nicksnyder), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
|
Hi Nick Snyder (@nicksnyder), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
|
First quick question: why do we need JSON patch for this. If It is real streaming then there is no need to patch something. I would rather prefer not to pull in a library here. |
|
The LSP proposal has an explanation so if you disagree, let's discuss there: Can you clarify why you object to a dependency? Even if we chose to stream parse JSON, I would want to pull in a library for that. If you don't want any dependencies at all then we would need to implement one of these things (JSON patch or a streaming parser). Anyway, the reasons why we propose JSON patch can be discussed in the issue above. |
b5369d5 to
0f0c0ba
Compare
|
I will be out next week on vacation. Will comment when I am back. Please ping if you don't hear anything. |
|
I am not against a dependency also managing it is always overhead. I see the technical beauty of a patch but from an application point of view I don't see a benefit (yet). Patching means that I patch something that I already have. If I think about find references then VS code will receive n matches and hands them off to the UI. Then another batch and hands them off. Why would we patch the original first response with additional items. Re-handing them off to the UI simply causes more work for the UI plus memory overhead. But could be I am missing something :-) My brain is already half on vacation. |
|
Enjoy your vacation!
This is an approach that we considered and would certainly work. There are two benefits of JSON patch
Would rather go down the simpler but less generic path and implement streaming for LSP methods one at a time?
Sure, the UI thread has to more work to re-render the UI more frequently, but we think the work is worth it for the user to see results sooner. |
This PR implements the necessary changes in vscode-languageclient and vscode-jsonrpc to support streaming the response for "Find all references" requests as described in microsoft/vscode#20010 (please read this issue for complete context).
This PR depends on (and should not be merged before):
Implementation details
The vscode-jsonrpc layer applies JSON patches and forwards the cumulative partial result so higher layers don't need to care about the JSON patch format.
Methods in vscode-languageclient may choose to forward this as-is or perform performance optimizations to only send new data since the data gets serialized over RPC. For streaming references I implemented this performance optimization.
Todos: