Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lua/leetcode/config/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
---| "enter"
---| "question_enter"
---| "leave"
---| "submit"

---@alias lc.size
---| string
Expand Down Expand Up @@ -120,6 +121,9 @@ local M = {

---@type fun()[]
["leave"] = {},

---@type fun(question: lc.ui.Question, buffer: string, item_json: table)[]
["submit"] = {},
},

keys = {
Expand Down
5 changes: 5 additions & 0 deletions lua/leetcode/runner/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local log = require("leetcode.logger")
local interpreter = require("leetcode.api.interpreter")
local config = require("leetcode.config")
local Judge = require("leetcode.logger.spinner.judge")
local utils = require("leetcode.utils")

---@type Path
local leetbody = config.storage.cache:joinpath("body")
Expand Down Expand Up @@ -52,6 +53,10 @@ function Runner:handle(submit)
end

if item then
-- print(vim.inspect(item))
-- utils.exec_hooks("submit", question, body.typed_code, item.status_msg, item._.success)
utils.exec_hooks("submit", question, body.typed_code, item)

if item._.success then
judge:success(item.status_msg)
else
Expand Down