1
1
local logger = require (" copilot.logger" )
2
+ local utils = require (" copilot.client.utils" )
2
3
--- @class CopilotApi
3
4
local M = {
4
5
--- @deprecated
@@ -19,11 +20,11 @@ function M.request(client, method, params, callback)
19
20
params .bufnr = nil
20
21
21
22
if callback then
22
- return client . request (method , params , callback , bufnr )
23
+ return utils . wrap ( client ): request (method , params , callback , bufnr )
23
24
end
24
25
25
26
local co = coroutine.running ()
26
- client . request (method , params , function (err , data , ctx )
27
+ utils . wrap ( client ): request (method , params , function (err , data , ctx )
27
28
coroutine.resume (co , err , data , ctx )
28
29
end , bufnr )
29
30
return coroutine.yield ()
32
33
--- @return boolean sent
33
34
function M .notify (client , method , params )
34
35
logger .trace (" api notify:" , method , params )
35
-
36
- if vim .fn .has (" nvim-0.11" ) == 1 then
37
- return client :notify (method , params )
38
- else
39
- return client .notify (method , params )
40
- end
36
+ return utils .wrap (client ):notify (method , params )
41
37
end
42
38
43
39
--- @alias copilot_editor_info { name : string , version : string }
0 commit comments