mirror of
https://github.com/neovim/neovim.git
synced 2026-02-10 13:58:48 +00:00
fix(lsp): ignore empty response on trigger completion #37663
Problem: Empty response affects server start boundary computed before. Solution: Ignore empty responses. This is mostly micro-optimization that avoids extending existing results with empty responses.
This commit is contained in:
@@ -583,7 +583,7 @@ local function trigger(bufnr, clients, ctx)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local result = response.result
|
local result = response.result
|
||||||
if result then
|
if result and #result.items > 0 then
|
||||||
Context.isIncomplete = Context.isIncomplete or result.isIncomplete
|
Context.isIncomplete = Context.isIncomplete or result.isIncomplete
|
||||||
local encoding = client and client.offset_encoding or 'utf-16'
|
local encoding = client and client.offset_encoding or 'utf-16'
|
||||||
local client_matches, tmp_server_start_boundary
|
local client_matches, tmp_server_start_boundary
|
||||||
|
|||||||
@@ -1455,6 +1455,7 @@ describe('vim.lsp.completion: integration', function()
|
|||||||
end)
|
end)
|
||||||
create_server('dummy', completion_list)
|
create_server('dummy', completion_list)
|
||||||
create_server('dummy2', completion_list2)
|
create_server('dummy2', completion_list2)
|
||||||
|
create_server('dummy3', { isIncomplete = false, items = {} })
|
||||||
feed('Adiv.foo<C-x><C-O>')
|
feed('Adiv.foo<C-x><C-O>')
|
||||||
retry(nil, nil, function()
|
retry(nil, nil, function()
|
||||||
eq(
|
eq(
|
||||||
|
|||||||
Reference in New Issue
Block a user