forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanel.lua
More file actions
32 lines (27 loc) · 871 Bytes
/
panel.lua
File metadata and controls
32 lines (27 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local util = require("copilot.util")
local Panel = {}
local results_callback = function (err, result)
if err then return end
if result then print(vim.inspect(result)) end
end
local notify_callback = function (err, result)
if err then
return
end
end
function Panel:send_request()
if not self.client then return end
local params = util.get_completion_params(self.method)
local sent, req_id = self.request(self.method, params, results_callback, notify_callback)
self.requests[req_id] = sent and {}
end
function Panel:new (client_id)
setmetatable({}, self)
self.client_id = client_id or util.find_copilot_client()
self.client = vim.lsp.get_client_by_id(self.client_id)
self.results = {}
self.request = self.client.rpc.request
self.method = "getPanelCompletions"
self.__index = function (i) return self.results[i] end
return self
end