@@ -60,6 +60,27 @@ function autocomplete.setup()
60
60
end ,
61
61
})
62
62
63
+ -- prefetch the resolved item
64
+ local last_context_id = nil
65
+ local last_request = nil
66
+ local timer = vim .uv .new_timer ()
67
+ autocomplete .listen_on_select (function (item , context )
68
+ local resolve = vim .schedule_wrap (function ()
69
+ if last_request ~= nil then last_request :cancel () end
70
+ last_request = require (' blink.cmp.sources.lib' ).resolve (item )
71
+ end )
72
+
73
+ -- immediately resolve if the context has changed
74
+ if last_context_id ~= context .id then
75
+ last_context_id = context .id
76
+ resolve ()
77
+ end
78
+
79
+ -- otherwise, wait for the debounce period
80
+ timer :stop ()
81
+ timer :start (50 , 0 , resolve )
82
+ end )
83
+
63
84
return autocomplete
64
85
end
65
86
@@ -312,10 +333,11 @@ function autocomplete.render_item_simple(ctx)
312
333
{ ctx .kind_icon , ctx .icon_gap , hl_group = ' BlinkCmpKind' .. ctx .kind },
313
334
{
314
335
ctx .label ,
315
- ctx .kind == ' Snippet' and ' ~' or nil ,
336
+ ctx .kind == ' Snippet' and ' ~' or ' ' ,
337
+ (ctx .item .labelDetails and ctx .item .labelDetails .detail ) and ctx .item .labelDetails .detail or ' ' ,
316
338
fill = true ,
317
339
hl_group = ctx .deprecated and ' BlinkCmpLabelDeprecated' or ' BlinkCmpLabel' ,
318
- max_width = 50 ,
340
+ max_width = 80 ,
319
341
},
320
342
' ' ,
321
343
}
0 commit comments