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

api.nvim_buf_get_var throws error if variable is uninitialized #4

Closed
jose-elias-alvarez opened this issue Nov 2, 2021 · 2 comments
Closed

Comments

@jose-elias-alvarez
Copy link

With a minimal setup (installing sekme.nvim without options.nvim and calling require("sekme").setup(), requesting completion fails with the following error:

Error executing vim.schedule lua callback: ...are/nvim/site/pack/packer/start/sekme.nvim/lua/sekme.lua:242: Key not found: sekme_completion_timeout

This is coming from this line, and I think the root cause is that api.nvim_buf_get_var throws an error when the variable is uninitialized.

It's pretty easy to get around the issue by using something like vim.cmd("autocmd BufEnter * let b:sekme_completion_timeout = 150"), but it might provide a better out-of-the-box experience to either initialize the variable through the plugin or wrap the API call in pcall.

@Furkanzmc
Copy link
Owner

Thanks for reporting!

The optional plugin I use (options.nvim) is biting me in the butt. I have it installed and have foolishly not tried it without it. Options.nvim handles setting that variable by default so I forgot about it. If it's not installed, the default variable should be written as part of set up function.

I'll take a look at this today.

@Furkanzmc Furkanzmc reopened this Nov 2, 2021
@Furkanzmc
Copy link
Owner

I pushed a commit that should this problem. Thanks.

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

No branches or pull requests

2 participants