-
Notifications
You must be signed in to change notification settings - Fork 165
[improvement] Improve active buffer context #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improvement] Improve active buffer context #164
Conversation
|
This looks great! Thank you for implementing this. Your solution looks cleaner then what I was planning. I especially appreciate that we are no longer sending the entire buffer to copilot but only a small change set as needed. |
|
I was doing some more testing on this, and I noticed some issues. First is that Second is that disabling |
|
@CeleritasCelery You are correct on both counts. Looks like it definitely needs a bit more work which I'm hoping to get done this week. It should not be that difficult to remedy though. Thanks for your diligent testing and great feedback. Really appreciate it! 🏆 |
|
Cleanup of |
|
@CeleritasCelery I have to do some more testing but it seems that the mode cleanup body is called for every open buffer when leaving the global mode so it should be fine. Should we send |
I would say yes. We call One other thing I noticed in testing this change is that |
|
I agree. I will implement the As for the Also looks like |
|
I found another issue as I was doing some testing. With the new change, the only time we send the entire buffer to copilot is on the initial call to I noticed this issue because sometimes copilot would just not be sending me any completions, but if I called the old function |
Could we not significantly increase the default limit? |
|
We could, and I have set it to -1 in my case so that it has no limit. But I am still observing the same behavior. copilot will stop sending me completions until I call |
It's not just you. I've been having the exact same problem. Will debug this and report back as well. |
|
I wonder if this is just a case of copilots internal buffer getting screwed up when we accept completions. When we accept a completion we send Also keep in mind that we post-process the completion text via |
|
What you're saying makes a ton of sense... I'm going to use copilot today with At this point I'm just going to try to inspect the agent's internal state... Going to start here: https://github.com/haukot/copilot_specifications#how-to-debug. |
|
The node debugger route wasn't very fruitful. Still testing things out with Another potential bug I've uncovered is that event |
|
Another bug I've found is that in If a change happens in this time window the version increases with Edit: Looks like I was wrong about this, |
|
@CeleritasCelery @MtCoin406 I think this is ready for final review and merge. I will log a separate issue for change in URI when saving an active copilot buffer that was not saved to file before. |
|
Will there be any issues if I enable |
No issues. When activating the mode, the on focus handler is triggered manually which will send the |
I will look into this and see if I can fix it. |
|
@zerolfx I'm not able to reproduce this, could you give me a recipe config maybe? I'm using company and company box but even without company box I can't get anything to modify the actual buffer nor send a copilot event. |
|
Access |
|
@emil-vdw I will review and make any possible fixes this weekend. Hopefully, we can get this PR merged then. |
|
Thanks @zerolfx. That would be great. Let me know if there's anything else I can do. Would love to make more contributions in future. |
|
@emil-vdw what was the fix for the "copilot not sending completions until re-synced" issue? |
|
@CeleritasCelery there were change events that were replacements and not just an insertion or deletion. One example of this is when yanking from the kill ring, I think it inserted the text and then replaced it with text that has the correct text properties. Just had to modify the before and after change hooks to process a deletion for the replaced text in the before hook, and an insertion for the replaced text in the after hook. |
|
@emil-vdw |
|
I have been using the master branch with these changes in it, but I am still experiencing the issue where copilot looses stare until I sync it explicitly. |


Implement the following suggestions from #150:
textDocument/didFocuson focus of already opened buffer (window-selection-change-functionshook)textDocument/didOpenon first focus of buffer (window-selection-change-functionshook)textDocument/didCloseevent on buffer kill (kill-buffer-hookhook)textDocument/didChangeevent on buffer change (before-change-functionshook for deletions andafter-change-functionsfor insertions) with only data relevant to the change not the whole buffer.