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(lsp): schedule api calls in on_exit #267

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Conversation

tomtomjhj
Copy link
Contributor

Problem:
Error when stopping the server:
"E5560: nvim_del_user_command must not be called in a lua loop callback"

on_exit runs in :h lua-loop-callbacks and thus most vim.api functions can't be run in it.

Solution:
vim.schedule() the api calls.

Problem:
Error when stopping the server:
"E5560: nvim_del_user_command must not be called in a lua loop callback"
`on_exit` runs in `:h lua-loop-callbacks` and thus most `vim.api`
functions can't be run in it.

Solution:
`vim.schedule()` the api calls.
Copy link
Contributor

github-actions bot commented Mar 1, 2024

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

  • For example, fix(lsp): some lsp-related bugfix

  • Pull request title has the appropriate conventional commit prefix.

If applicable:

  • Tested
    • Tests have been added.
    • Tested manually (Steps to reproduce in PR description).
  • Updated documentation.
  • Updated CHANGELOG.md

Copy link
Owner

@mrcjkb mrcjkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Strange that I haven't encountered this myself, but lgtm 😃

@mrcjkb mrcjkb changed the title fix: defer api calls in on_exit fix(lsp): schedule api calls in on_exit Mar 1, 2024
@mrcjkb mrcjkb enabled auto-merge (squash) March 1, 2024 15:17
@mrcjkb mrcjkb disabled auto-merge March 1, 2024 15:54
@mrcjkb mrcjkb merged commit 001dd49 into mrcjkb:master Mar 1, 2024
6 checks passed
@tomtomjhj tomtomjhj deleted the defer-api branch March 1, 2024 16:02
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.

None yet

2 participants