diff options
author | Mathias Fussenegger <f.mathias@zignar.net> | 2024-09-13 19:57:04 +0200 |
---|---|---|
committer | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2024-09-13 22:34:49 +0200 |
commit | 8512f669f0e095df99e0456db11a0e0b5a2b0485 (patch) | |
tree | 85e8bdce410a78196f4736f6e11cb789257a43a6 /runtime/lua/vim/_defaults.lua | |
parent | 755512ed60fe6c9b7fbd3bf57c827d938ff6d743 (diff) | |
download | rneovim-8512f669f0e095df99e0456db11a0e0b5a2b0485.tar.gz rneovim-8512f669f0e095df99e0456db11a0e0b5a2b0485.tar.bz2 rneovim-8512f669f0e095df99e0456db11a0e0b5a2b0485.zip |
fix(lsp): handle nil bytes in strings
Problem:
The LSP omnifunc can insert nil bytes, which when read in other places
(like semantic token) could cause an error:
semantic_tokens.lua:304: Vim:E976: Using a Blob as a String
Solution:
Use `#line` instead of `vim.fn.strlen(line)`. Both return UTF-8 bytes
but the latter can't handle nil bytes.
Completion candidates can currently insert nil bytes, if other parts of
Alternative fix to https://github.com/neovim/neovim/pull/30359
Note that https://github.com/neovim/neovim/pull/30315 will avoid the
insertion of nil bytes from the LSP omnifunc, but the change of this PR
can more easily be backported.
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
0 files changed, 0 insertions, 0 deletions