-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathcompletion_functions.lua
More file actions
37 lines (29 loc) · 941 Bytes
/
Copy pathcompletion_functions.lua
File metadata and controls
37 lines (29 loc) · 941 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
32
33
34
35
36
37
local format = require("copilot_cmp.format")
local util = require("copilot.util")
local api = require("copilot.api")
local methods = {
opts = {
fix_pairs = true,
}
}
methods.getCompletions = function (self, params, callback)
local respond_callback = function(err, response)
if err or not response or not response.completions then
return callback({isIncomplete = false, items = {}})
end
local items = vim.tbl_map(function(item)
return format.format_item(item, params.context, methods.opts)
end, vim.tbl_values(response.completions))
return callback({
isIncomplete = false,
items = items
})
end
api.get_completions(self.client, util.get_doc_params(), respond_callback)
return callback({isIncomplete = true, items = {}})
end
methods.init = function (completion_method, opts)
methods.opts.fix_pairs = opts.fix_pairs
return methods[completion_method]
end
return methods