feat: add submit hook #203
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
arduinohatesme/leetcode.nvim!203
Loading…
Reference in a new issue
No description provided.
Delete branch "jingyi-zhao-01/master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
below is a sample on_submit hook with working demo
https://github.com/user-attachments/assets/40af4ce4-c398-495b-908d-9d58b8fd8c1f
Pull Request Overview
This PR adds a new
on_submithook to the LeetCode plugin that triggers when a solution is submitted. The hook provides access to the question, buffer contents, and submission status message.on_submithook definition to the configuration templateReviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
on_submithook type definition with proper typingon_submithook when submission is detectedTip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@ -55,0 +62,4 @@endutils.exec_hooks(event, question, body.typed_code, item)endThe hook parameters don't match the type definition. The hook expects
(question, buffer, status_msg)butbody.typed_codeis passed as the buffer parameter. Consider renaming the parameter to match the actual data being passed or ensure the parameter names are consistent with the type definition.The hook should include information about whether the submission was successful. You can do it by adding a
successparameter sourced fromitem._.success@ -109,0 +118,4 @@enabled = true, ---@type booleanheight = 10, ---@type lc.sizelimit = 10, ---@type integer},You should rename it to
submitto be on par with other hooksadded ._.success into the hook parameter, it's now up to the hook implementation to how to differentiate successful submission and failure submission in case one wants to thoroughly review his submission quality
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.