Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't blow up when
nvim_buf_get_lines()
returns Blobs
Some LSP servers may return binary garbage and `nvim_buf_get_lines()` will return a `Blob` instead of a `String` in those cases. I added some `print(vim.inspect())` debugging in `entry.get_documentation()` to prove that by the time the text passes through there, it's already garbage. Here's an excerpt from a sample line returned by `nvim_buf_get_lines()`, as rendered by `vim.inspect()`: default\0\0\0! vim.opt.background = 'dark'\0\0\0000 (etc) Now, this looks like an LSP bug to me, but I think we shouldn't allow buggy LSP output to crash nvim-cmp. "Be conservative in what you send, be liberal in what you accept" and all that. So, degrade by coercing any `Blob` we see into a `String` before passing it to `strdisplaywidth()`. Closes: #820
- Loading branch information