-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathinit.lua
More file actions
69 lines (59 loc) · 1.3 KB
/
Copy pathinit.lua
File metadata and controls
69 lines (59 loc) · 1.3 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
local M = {}
function M.setup(options)
local Source = require("codeium.source")
local Server = require("codeium.api")
local update = require("codeium.update")
local health = require("codeium.health")
require("codeium.config").setup(options)
M.s = Server.new()
update.download(function(err)
if not err then
Server.load_api_key()
M.s:start()
end
end)
health.register(M.s)
vim.api.nvim_create_user_command("Codeium", function(opts)
local args = opts.fargs
if args[1] == "Auth" then
Server.authenticate()
end
if args[1] == "Chat" then
M.chat()
end
if args[1] == "Toggle" then
M.toggle()
end
end, {
nargs = 1,
complete = function()
local commands = { "Auth", "Toggle" }
if require("codeium.config").options.enable_chat then
commands = vim.list_extend(commands, { "Chat" })
end
return commands
end,
})
local source = Source:new(M.s)
if require("codeium.config").options.enable_cmp_source then
require("cmp").register_source("codeium", source)
end
require("codeium.virtual_text").setup(M.s)
end
--- Open Codeium Chat
function M.chat()
M.s:refresh_context()
M.s:get_chat_ports()
M.s:add_workspace()
end
--- Toggle the Codeium plugin
function M.toggle()
M.s:toggle()
end
function M.enable()
M.s:enable()
end
function M.disable()
M.s:disable()
end
return M