irongit

A Neovim plugin enabling you to solve LeetCode problems.

docs(readme): default imports

kawreauthored
parent 05a8e73commit 14c1de48b536abd32bce0f2efca225245b0c3f96Browse files

2 files changed, +19 -0

+10-0README.md
@@ -239,8 +239,18 @@ logging = true
239239
240240 Inject code before or after your solution, injected code won't be submitted or run.
241241
242+#### default imports
243+
244+You can also pass `before = true` to inject default imports for the language.
245+Supported languages are `python`, `python3`, `java`
246+
247+Access default imports via `require("leetcode.config.imports)`
248+
242249 ```lua
243250 injector = { ---@type table<lc.lang, lc.inject>
251+ ["python3"] = {
252+ before = true
253+ },
244254 ["cpp"] = {
245255 before = { "#include <bits/stdc++.h>", "using namespace std;" },
246256 after = "int main() {}",
+9-0README.zh.md
@@ -241,6 +241,13 @@ logging = true
241241
242242 在你的答案前后注入额外代码,注入的代码不会被提交或测试。
243243
244+#### 默认导入
245+
246+您还可以传递 `before = true` 以注入语言的默认导入。
247+支持的语言为 `python`、`python3`、`java`
248+
249+通过 `require("leetcode.config.imports)` 访问默认导入
250+
244251 ```lua
245252 injector = { ---@type table<lc.lang, lc.inject>
246253 ["cpp"] = {
@@ -316,6 +323,8 @@ image_support = false, -- 将此设置为 `true` 将禁用问题描述的换行
316323
317324 - `restore` 尝试恢复默认问题布局
318325
326+- `inject` 重新注入当前问题的代码
327+
319328 - `session`
320329
321330 - `create` 创建一个新的会话