diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-09-24 13:30:07 +0100 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2026-09-25 10:28:19 +0100 |
| commit | d7af8707026968887ea4ee3a4e6fa51fd4372033 (patch) | |
| tree | 19cae6c571311bbd5af56575dcc710485568f7b8 /runtime/lua/vim/lsp/inline_completion.lua | |
| parent | f6aac851ddd82db5241a56ddfb9cc9a9aec8f7e5 (diff) | |
| download | rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.tar.gz rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.tar.bz2 rneovim-d7af8707026968887ea4ee3a4e6fa51fd4372033.zip | |
fix(lua): enable nil-safety diagnostics in runtime code
Enable EmmyLua's need-check-nil diagnostic and resolve nullable values
through more precise types, explicit invariants, and guards for missing
runtime state. Keep analyzer-specific workarounds local and update the
affected API documentation.
Exclude the bundled re.lua from analysis so its nil-check warnings do
not fail CI.
AI-assisted
Diffstat (limited to 'runtime/lua/vim/lsp/inline_completion.lua')
| -rw-r--r-- | runtime/lua/vim/lsp/inline_completion.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/inline_completion.lua b/runtime/lua/vim/lsp/inline_completion.lua index 685dbbdc36..0e69adce78 100644 --- a/runtime/lua/vim/lsp/inline_completion.lua +++ b/runtime/lua/vim/lsp/inline_completion.lua @@ -235,7 +235,9 @@ function Completor:show(hint) -- The first line of the text to be inserted -- usually contains characters entered by the user, -- which should be skipped before displaying the virtual text. - local virt_text = lines[1] + -- Splitting on a nonempty separator always yields a line, with its first chunk. + local virt_text = assert(lines[1]) + assert(virt_text[1]) local skip = lcp(line_text:sub(col + 1), virt_text[1][1]) local winid = api.nvim_get_current_win() -- At least, characters before the cursor should be skipped. |