zk-org / zk-nvim

Neovim extension for zk
https://github.com/zk-org/zk
GNU General Public License v3.0
503 stars 41 forks source link

's: expected string, got nil' on :ZkNotes #44

Closed lukamanitta closed 2 years ago

lukamanitta commented 2 years ago

When :ZkNotes is executed, the following error occurs:

Error executing vim.schedule lua callback: vim/shared.lua:63: s: expected string, got nil
stack traceback:
    [C]: in function 'error'
    vim/shared.lua:608: in function 'validate'
    vim/shared.lua:63: in function 'gsplit'
    vim/shared.lua:128: in function 'split'
    ...e/pack/packer/start/zk-nvim/lua/zk/pickers/telescope.lua:53: in function 'define_preview'
    ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:386: in function 'preview'
    ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1066: in function 'refresh_previewer'
    ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1015: in function 'set_selection'
    ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1351: in function '_do_selection'
    ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1313: in function 'cb'
    vim.lua:285: in function <vim.lua:285>

Once the error is dismissed, the Telescope picker is opened, with an empty results field. When something is typed, the field populates with results, and when the input prompt is cleared (last character is deleted), the above error occurs again, identically.

Neovim version 0.6.1

guzmonne commented 2 years ago

I was getting the same error and I was able to track the bug to this line:

https://github.com/mickael-menu/zk-nvim/blob/d705faa82da042e7a75f7d244afd27c2d8f20830/lua/zk/lsp.lua#L10

For some reason the value of config.options.lsp.config is wrong. I don't know when it gets mutated though.

A workaround to make this work is updating the this value to config.defaults.lsp.config.

If I found the place where these table is mutated I'll submit a PR.

zhengpd commented 2 years ago

I also got this and traced back to

https://github.com/mickael-menu/zk-nvim/blob/d705faa82da042e7a75f7d244afd27c2d8f20830/lua/zk/pickers/telescope.lua#L53

The first note in my notes list is empty, which might cause vim.split(entry.value.rawContent, "\n") to be nil, raising the error.

The problem is gone after adding a line into the empty note file.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 5 days with no activity.

zhengpd commented 2 years ago

Just submitted a fix https://github.com/mickael-menu/zk-nvim/pull/49

mickael-menu commented 2 years ago

Perfect, thanks!