|
4 | 4 | --- @field auto_show_timer uv_timer_t
|
5 | 5 | --- @field shown_item? blink.cmp.CompletionItem
|
6 | 6 | ---
|
7 |
| ---- @field auto_show_item fun(context: blink.cmp.Context, item: blink.cmp.CompletionItem) |
| 7 | +--- @field auto_show_item fun(item: blink.cmp.CompletionItem) |
8 | 8 | --- @field show_item fun(item: blink.cmp.CompletionItem)
|
9 | 9 | --- @field update_position fun()
|
10 | 10 | --- @field scroll_up fun(amount: number)
|
@@ -35,18 +35,19 @@ local docs = {
|
35 | 35 | }
|
36 | 36 |
|
37 | 37 | menu.position_update_emitter:on(docs.update_position)
|
38 |
| -menu.close_emitter:on(function() docs.win:close() end) |
| 38 | +menu.close_emitter:on(function() |
| 39 | + docs.win:close() |
| 40 | + docs.auto_show_timer:stop() |
| 41 | +end) |
39 | 42 |
|
40 |
| -function docs.auto_show_item(context, item) |
| 43 | +function docs.auto_show_item(item) |
41 | 44 | docs.auto_show_timer:stop()
|
42 |
| - if docs.win:is_open() or context.id == docs.last_context_id then |
43 |
| - docs.last_context_id = context.id |
| 45 | + if docs.win:is_open() then |
44 | 46 | docs.auto_show_timer:start(config.update_delay_ms, 0, function()
|
45 | 47 | vim.schedule(function() docs.show_item(item) end)
|
46 | 48 | end)
|
47 | 49 | elseif config.auto_show then
|
48 | 50 | docs.auto_show_timer:start(config.auto_show_delay_ms, 0, function()
|
49 |
| - docs.last_context_id = context.id |
50 | 51 | vim.schedule(function() docs.show_item(item) end)
|
51 | 52 | end)
|
52 | 53 | end
|
|
0 commit comments