Skip to content

Commit cd15078

Browse files
committed
fix: documentation manual trigger not updating on scroll
1 parent 9a008c9 commit cd15078

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ For LazyVim/distro users, you can disable nvim-cmp via:
274274
},
275275
auto_show = true,
276276
auto_show_delay_ms = 500,
277-
update_delay_ms = 100,
277+
update_delay_ms = 50,
278278
},
279279
signature_help = {
280280
min_width = 1,

lua/blink/cmp/config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ local config = {
271271
},
272272
auto_show = false,
273273
auto_show_delay_ms = 500,
274-
update_delay_ms = 100,
274+
update_delay_ms = 50,
275275
},
276276
signature_help = {
277277
min_width = 1,

lua/blink/cmp/windows/documentation.lua

+18-18
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ function docs.setup()
1717
autocomplete.listen_on_position_update(function()
1818
if autocomplete.win:is_open() then docs.update_position() end
1919
end)
20-
if config.auto_show then
21-
local timer = vim.uv.new_timer()
22-
local last_context_id = nil
23-
autocomplete.listen_on_select(function(item, context)
24-
timer:stop()
25-
if docs.win:is_open() or context.id == last_context_id then
26-
timer:start(config.update_delay_ms, 0, function()
27-
vim.schedule(function() docs.show_item(item) end)
28-
end)
29-
else
30-
timer:start(config.auto_show_delay_ms, 0, function()
31-
last_context_id = context.id
32-
vim.schedule(function() docs.show_item(item) end)
33-
end)
34-
end
35-
end)
36-
end
20+
21+
local timer = vim.uv.new_timer()
22+
local last_context_id = nil
23+
autocomplete.listen_on_select(function(item, context)
24+
timer:stop()
25+
if docs.win:is_open() or context.id == last_context_id then
26+
last_context_id = context.id
27+
timer:start(config.update_delay_ms, 0, function()
28+
vim.schedule(function() docs.show_item(item) end)
29+
end)
30+
elseif config.auto_show then
31+
timer:start(config.auto_show_delay_ms, 0, function()
32+
last_context_id = context.id
33+
vim.schedule(function() docs.show_item(item) end)
34+
end)
35+
end
36+
end)
3737
autocomplete.listen_on_close(function() docs.win:close() end)
3838

3939
return docs
@@ -56,7 +56,7 @@ function docs.show_item(item)
5656

5757
local doc_lines = {}
5858
if item.detail and item.detail ~= '' then
59-
table.insert(doc_lines, '```'..vim.bo.filetype)
59+
table.insert(doc_lines, '```' .. vim.bo.filetype)
6060
for s in item.detail:gmatch('[^\r\n]+') do
6161
table.insert(doc_lines, s)
6262
end

0 commit comments

Comments
 (0)