forked from CopilotC-Nvim/CopilotChat.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.lua
More file actions
36 lines (29 loc) · 745 Bytes
/
Copy pathutils.lua
File metadata and controls
36 lines (29 loc) · 745 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
local M = {}
local log = require('CopilotChat.vlog')
--- Create custom command
---@param cmd string The command name
---@param func function The function to execute
---@param opt table The options
M.create_cmd = function(cmd, func, opt)
opt = vim.tbl_extend('force', { desc = 'CopilotChat.nvim ' .. cmd }, opt or {})
vim.api.nvim_create_user_command(cmd, func, opt)
end
--- Log info
---@vararg any
M.log_info = function(...)
-- Only save log when debug is on
if not _COPILOT_CHAT_GLOBAL_CONFIG.debug then
return
end
log.info(...)
end
--- Log error
---@vararg any
M.log_error = function(...)
-- Only save log when debug is on
if not _COPILOT_CHAT_GLOBAL_CONFIG.debug then
return
end
log.error(...)
end
return M