Skip to content

Commit

Permalink
Code Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jun 5, 2024
1 parent 131faf2 commit 91430d2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lua/fittencode/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function M.setup()
table.remove(actions, 1)
return cmd(unpack(actions))
end
Log.debug('Invalid command; fargs: {}', line.fargs)
Log.debug('Invalid command fargs: {}', line.fargs)
end, {
complete = function(_, line)
local args = vim.split(vim.trim(line), '%s+')
Expand Down
24 changes: 12 additions & 12 deletions lua/fittencode/engines/actions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -667,18 +667,6 @@ local chat_callbacks = {
end,
}

function ActionsEngine.setup()
chat = Chat:new(chat_callbacks)
content = Content:new(chat)
tasks = TaskScheduler:new()
tasks:setup()
status = Status:new({
tag = 'ActionsEngine',
ready_idle = true,
})
setup_actions_menu()
end

---@return integer
function ActionsEngine.get_status()
return status:get_current()
Expand All @@ -700,4 +688,16 @@ function ActionsEngine.toggle_chat()
end
end

function ActionsEngine.setup()
chat = Chat:new(chat_callbacks)
content = Content:new(chat)
tasks = TaskScheduler:new()
tasks:setup()
status = Status:new({
tag = 'ActionsEngine',
ready_idle = true,
})
setup_actions_menu()
end

return ActionsEngine
3 changes: 1 addition & 2 deletions lua/fittencode/engines/inline/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,9 @@ local function setup_keymaps()
Base.map('i', key, function()
local v = KEYS[value]
if v == nil then
Log.warn('Invalid keymap value: ', value)
return
end
if v then
if v[1] then
if M.has_suggestions() then
M[value]()
else
Expand Down
2 changes: 1 addition & 1 deletion lua/fittencode/views/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function M:create(opts)

for key, value in pairs(opts.keymaps or {}) do
Base.map('n', key, function()
if vim.tbl_contains(vim.tbl_keys(FX), value) then
if FX[value] then
FX[value]()
end
end, { buffer = self.buffer })
Expand Down

0 comments on commit 91430d2

Please sign in to comment.