Skip to content
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

fix(suggestion): Trigger suggestion on InsertEnter #318

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsongerber
Copy link

This pull request make that the suggestion get triggered when entering insert mode.
It was not working because both InsertEnter and CursorMovedI would fire at the same time and the timer variable would be messed up in the debounce function like this:

  • InsertEnter is called, copilot.timer is set to timer id 1
  • CursorMovedI is called, copilot.timer is set to timer id 2
  • Debounce function 1 is called, timer is 1, copilot.timer is 2, early return, copilot.timer is set to nil
  • Debounce function 2 is called, timer is 2, copilot.timer is nil, early return

This pull requests fixes this, I'm testing this since yesterday and it's working fine, but I don't know the codebase very well so I'm hoping I'm not breaking something.

Also the debounce function doesn't seem to be working (with or without this pull request), it works only as a timeout, does this need to be fixed or is this the intended behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant