Open raymond-w-ko opened 1 year ago
The original pull request would never have worked properly, since I thought nreverse
reversed in place, but it was actually dropping the subsequent set of changes, meaning the buffer would have been desynced.
There is also some other extra stuff here, like the (copilot-resync-buffer)
command, and a rewrite to fix save-*
nesting order.
But assuming this is the wrong way to fix #172, there isn't anything too important here to merge.
But assuming this is the wrong way to fix #172, there isn't anything too important here to merge.
@raymond-w-ko I am confused. does this PR fix the linked issue or not?
I will push changes and get this merged.
One last thing to check is that copilot-panel-complete
also flushes pending messages before requesting completions.
@timcharper Although I did manage to reproduce the problem initially I am also not seeing it anymore on Emacs 29.2
org mode version 9.6.15
.
I do, however, feel like this is a good improvement nonetheless. That being deferring jsonrpc communication with the server to some idle time or until the user requests a completion (as implemented in and shamelessly stolen from eglot
). This can still be "turned off" by setting the idle time low enough.
In any event, the PR title and description needs some work. I will update.
Currently, doc changes (like
textDocument/didChange
) are communicated on every change (essentially every key press). It would make more sense and improve responsiveness to defer communicating with the server until some idle time or until it is actually needed for a completion.To implement this we don't have to reinvent the wheel and can just import most of it from the
eglot
implementation.Implementation
This fixes issue: https://github.com/zerolfx/copilot.el/issues/172 (although this is also seems to not be an issue in newer
org
versions).