@@ -9,14 +9,7 @@ local function accept(ctx, item, callback)
9
9
local sources = require (' blink.cmp.sources.lib' )
10
10
require (' blink.cmp.completion.trigger' ).hide ()
11
11
12
- -- let the source execute the item itself if it indicates it can
13
- if sources .should_execute (item ) then
14
- sources .execute (ctx , item )
15
- callback ()
16
- return
17
- end
18
-
19
- -- start the resolve immediately since text changes can invalidate the item
12
+ -- Start the resolve immediately since text changes can invalidate the item
20
13
-- with some LSPs (i.e. rust-analyzer) causing them to return the item as-is
21
14
-- without i.e. auto-imports
22
15
sources
@@ -63,24 +56,27 @@ local function accept(ctx, item, callback)
63
56
})
64
57
end
65
58
66
- -- Check semantic tokens for brackets, if needed, and apply additional text edits
67
- if brackets_status == ' check_semantic_token' then
68
- -- TODO: since we apply the additional text edits after, auto imported functions will not
69
- -- get auto brackets. If we apply them before, we have to modify the textEdit to compensate
70
- brackets_lib .add_brackets_via_semantic_token (vim .bo .filetype , item , function ()
59
+ -- Let the source execute the item itself
60
+ sources .execute (ctx , item ):map (function ()
61
+ -- Check semantic tokens for brackets, if needed, and apply additional text edits
62
+ if brackets_status == ' check_semantic_token' then
63
+ -- TODO: since we apply the additional text edits after, auto imported functions will not
64
+ -- get auto brackets. If we apply them before, we have to modify the textEdit to compensate
65
+ brackets_lib .add_brackets_via_semantic_token (vim .bo .filetype , item , function ()
66
+ require (' blink.cmp.completion.trigger' ).show_if_on_trigger_character ({ is_accept = true })
67
+ require (' blink.cmp.signature.trigger' ).show_if_on_trigger_character ()
68
+ callback ()
69
+ end )
70
+ else
71
71
require (' blink.cmp.completion.trigger' ).show_if_on_trigger_character ({ is_accept = true })
72
72
require (' blink.cmp.signature.trigger' ).show_if_on_trigger_character ()
73
73
callback ()
74
- end )
75
- else
76
- require (' blink.cmp.completion.trigger' ).show_if_on_trigger_character ({ is_accept = true })
77
- require (' blink.cmp.signature.trigger' ).show_if_on_trigger_character ()
78
- callback ()
79
- end
74
+ end
80
75
81
- -- Notify the rust module that the item was accessed
82
- -- TODO: why is this so slow? (10ms)
83
- vim .schedule (function () require (' blink.cmp.fuzzy' ).access (item ) end )
76
+ -- Notify the rust module that the item was accessed
77
+ -- TODO: why is this so slow? (10ms)
78
+ vim .schedule (function () require (' blink.cmp.fuzzy' ).access (item ) end )
79
+ end )
84
80
end )
85
81
:catch (function (err ) vim .notify (err , vim .log .levels .ERROR ) end )
86
82
end
0 commit comments