Regarding incremental didChange #550
DanielViberg
started this conversation in
Ideas
Replies: 3 comments
-
|
#551 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Solved using cached buffer state and diff(): https://github.com/DanielViberg/lsp/blob/3bcea47377598e5bba9b5d47da34296dba5c9f3e/lib/Features/DocumentSync.vim#L79C1-L122C7 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
After testing, multiple hunks require reversed order: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As of now we're limited to full document synchronization because of, to my understanding, the events provided by listener_add report changes that dont match what the lsp servers want vim/vim#11385. For fast servers this is not an issue, but some ts based backends are slow and take time to process large documents. So it would be beneficial to enable incremental synchronization.
I've been looking around for different solutions and have found that others seems to have:
A solution where the latest buffer change is compared to a cached buffer from before last change, the first and last diff is taken out and the range between those are sent to the server.
https://github.com/natebosch/vim-lsc/blob/14203f07add90e273020f626e6d1a79b9fd694c4/autoload/lsc/file.vim#L115
A solution where it seems the buffer is also cached, but listener_add is still used, I'm looking more in to this solution currently. https://github.com/govim/govim/blob/669f6011070ba6b303ff3c1ea4c5243ec1e56878/cmd/govim/buffer_events.go#L119
I understand we have to possibility to utilize diff() in combination with TextChanged to achive similar results as above and introduce buffer caching. But since @yegappan is fairly active in vim development, i would like your input on what way you think is most suitable.
Correct listener_add with flags maybe? Or try to implement one of the above solutions in this client?
Beta Was this translation helpful? Give feedback.
All reactions