diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-10-07 08:25:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 08:25:13 -0700 |
commit | 50f006b61774311e67e6948cd863bd503e4bcdfb (patch) | |
tree | efd913195ad74ce430415f347b6ea10726288dbc /runtime/lua/vim/lsp/util.lua | |
parent | 7335988ce6a5f41a8405462c6c4c90a54d3e588c (diff) | |
download | rneovim-50f006b61774311e67e6948cd863bd503e4bcdfb.tar.gz rneovim-50f006b61774311e67e6948cd863bd503e4bcdfb.tar.bz2 rneovim-50f006b61774311e67e6948cd863bd503e4bcdfb.zip |
fix(lsp): tagfunc fails in unusual buffer #30700
Problem:
tagfunc failed in a weird buffer (either a directory or some other
non-file buffer, I don't remember):
E987: Invalid return value from tagfunc
E5108: Error executing lua …/runtime/lua/vim/lsp/util.lua:311: EISDIR: illegal operation on a directory
stack traceback:
at this line:
local data = assert(uv.fs_read(fd, stat.size, 0))
Solution:
Check for directory.
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index a08825b735..882ec22ca6 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -296,6 +296,9 @@ local function get_lines(bufnr, rows) end local filename = api.nvim_buf_get_name(bufnr) + if vim.fn.isdirectory(filename) ~= 0 then + return {} + end -- get the data from the file local fd = uv.fs_open(filename, 'r', 438) |