Skip to content

Commit 955bf2f

Browse files
authored
Merge pull request #51 from shuzijun/dev
1.add code custom;2.add show content
2 parents 2a6c2fd + 4ed7b52 commit 955bf2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1567
-175
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
/*.iml
25+
.idea/

CustomCode.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#custom code generation
2+
The custom code generation template can be configured to generate the code format freely, the IDE can debug the code locally.[demo](https://github.com/shuzijun/leetcode-question)
3+
- [English Document]()
4+
- [中文文档](https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode_ZH.md)
5+
<p align="center">
6+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig-100.gif" alt="demo"/>
7+
</p>

CustomCode_ZH.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# 自定义代码生成介绍
2+
通过配置自定义代码生成模板可以自由生成代码格式,配合IDE可在本地调试代码。[示例工程](https://github.com/shuzijun/leetcode-question)
3+
- [English Document](https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode.md)
4+
- [中文文档](#配置)
5+
<p align="center">
6+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig-100.gif" alt="demo"/>
7+
</p>
8+
9+
## 配置
10+
<p align="center">
11+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig.png" alt="customConfig"/>
12+
</p>
13+
14+
- **Custom code template**: 开启使用自定义模板,否则使用默认生成格式
15+
- **CodeFileName**: 生成文件的名称,默认为题目标题
16+
- **CodeTemplate**: 生成题目代码的内容,默认为题目描述和题目代码
17+
- **TemplateConstant**: 模板常用变量
18+
- **${question.title}**:题目标题,例如:两数之和
19+
- **${question.titleSlug}**:题目标记,例如:two-sum
20+
- **${question.frontendQuestionId}**:题目编号,例如:1
21+
- **${question.content}**:题目描述内容
22+
- **${question.code}**:题目代码部分
23+
- **$!velocityTool.camelCaseName(str)**:一个函数,用来将字符串转化为驼峰样式
24+
25+
## 注意
26+
在生成的自定义代码中包含两行关键信息:
27+
- `leetcode submit region begin(Prohibit modification and deletion)`:提交到leetcode进行验证的代码开始标记
28+
- `leetcode submit region end(Prohibit modification and deletion)`:提交到leetcode进行验证的代码结束标记
29+
这两行标记标示了提交到leetcode服务器进行验证的代码范围,在此范围内只允许有出现与题目解答相关的内容,出现其他内容可能导致leetcode验证不通过。
30+
除了此范围内,其他区域是可以任意填写的,内容不会提交到leetcode,可以增加一些可以本地调试的内容,例如:import java.util.Arrays;
31+
所以,这两行内容是不能被删除和修改的,否则将识别不到提交的内容。
32+
33+
## JAVA常用配置
34+
可参考示例:[示例工程](https://github.com/shuzijun/leetcode-question)
35+
CodeFileName:
36+
```java
37+
$!velocityTool.camelCaseName(${question.titleSlug})
38+
```
39+
TemplateConstant:
40+
```java
41+
${question.content}
42+
43+
package com.shuzijun.leetcode.editor.en;
44+
public class $!velocityTool.camelCaseName(${question.titleSlug}){
45+
public static void main(String[] args) {
46+
Solution solution = new $!velocityTool.camelCaseName(${question.titleSlug})().new Solution();
47+
}
48+
${question.code}
49+
}
50+
```

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/leetcode-editor-3.0.gif" alt="demo"/>
1515
</p>
1616

17+
## Local debugging
18+
<p align="center">
19+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig-100.gif" alt="demo"/>
20+
</p>
21+
1722
### Installation
1823
- **Install via plug-in library** https://plugins.jetbrains.com/plugin/12132-leetcode-editor
1924
- **Install by downloading the file** https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/leetcode-editor.zip
@@ -30,6 +35,8 @@
3035
- **`LoginName`**: Login Username
3136
- **`Password`**: Login password
3237
- **`Temp File Path`**: Temporary file storage catalogue
38+
- **`proxy(HTTP Proxy)`**: HTTP Proxy,config path:`File` -> `settings`->`Appearance & Behavior`->`System Settings`->`HTTP Proxy`
39+
- **`Custom code template`**: Custom code template ([details](https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode.md))([demo](https://github.com/shuzijun/leetcode-question))
3340

3441
### Window (Icon in the lower right corner of the main window![icon](https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/LeetCodeIcon.png))
3542

@@ -61,8 +68,10 @@
6168

6269
- **Menu (right-click on the questions)**:
6370
- **`open question`**:Open the question or double click on the question
71+
- **`open content`**:Show content(Rely on Markdown)
6472
- **`Submit`**:Submit the question
6573
- **`Submissions`**:View the submission record, select the record details in the pop-up window(`Show detail`)
6674
- **`Run Code`**:Run the code, the test case for the question is used by default
6775
- **`Testcase`**:Customize test cases
76+
- **`favorite`**:Add or remove favorite
6877
- **`Clear cache`**:Clean up the current question

README_ZH.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/leetcode-editor-3.0.gif" alt="demo"/>
1414
</p>
1515

16+
## 本地调试
17+
<p align="center">
18+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig-100.gif" alt="demo"/>
19+
</p>
20+
1621
### 安装
1722
- **通过插件库安装** https://plugins.jetbrains.com/plugin/12132-leetcode-editor
1823
- **下载文件安装** https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/leetcode-editor.zip
@@ -29,6 +34,8 @@
2934
- **`LoginName`**: 登录用户名
3035
- **`Password`**: 登录密码
3136
- **`Temp File Path`**: 临时文件存放目录
37+
- **`proxy(HTTP Proxy)`**: 使用http代理,配置路径:`File` -> `settings`->`Appearance & Behavior`->`System Settings`->`HTTP Proxy`
38+
- **`Custom code template`**: 自定义代码生成模板 ([详细介绍](https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode_ZH.md))([示例](https://github.com/shuzijun/leetcode-question))
3239

3340
### 窗口(主窗口右下角![icon](https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/LeetCodeIcon.png))
3441

@@ -60,8 +67,10 @@
6067

6168
- **菜单(在题目上右击出现)**:
6269
- **`open question`**:打开题目,在题目上双击也可以打开
70+
- **`open content`**:查看描述,包含图片(依赖 Markdown)
6371
- **`Submit`**:提交题目
6472
- **`Submissions`**:查看提交记录,在弹出的窗口上选择记录查看详情(`Show detail`)
6573
- **`Run Code`**:运行代码,默认使用题目的测试用例
6674
- **`Testcase`**:自定义测试用例
75+
- **`favorite`**:添加或移除收藏
6776
- **`Clear cache`**:清理当前题目

doc/customConfig-100.gif

1.44 MB
Loading

doc/customConfig.png

133 KB
Loading

doc/leetcode-editor-V5.0.zip

2.75 MB
Binary file not shown.

resources/META-INF/plugin.xml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>leetcode-editor</id>
33
<name>leetcode editor</name>
4-
<version>4.3</version>
4+
<version>5.0</version>
55
<vendor email="shuzijun0109@gmail.com" url="https://github.com/shuzijun/idea-leetcode-plugin">shuzijun</vendor>
66

77
<description><![CDATA[
@@ -25,6 +25,13 @@
2525
</p>
2626
</div>
2727
<br>
28+
<div>
29+
<h2>Local debugging </h2>
30+
<br>
31+
<p >
32+
<img src="https://raw.githubusercontent.com/shuzijun/leetcode-editor/master/doc/customConfig-100.gif" alt="demo" />
33+
</p>
34+
</div>
2835
<br>
2936
<div>
3037
<h2>Configuration (configuration for first installation)</h2>
@@ -41,6 +48,9 @@
4148
<li> Login Name: Login Username</li>
4249
<li> Password: Login password</li>
4350
<li>Temp File Path: Temporary file storage catalogue</li>
51+
<li>proxy(HTTP Proxy): HTTP Proxy,config path:`File` -> `settings`->`Appearance & Behavior`->`System Settings`->`HTTP Proxy`</li>
52+
<li>Custom code template: Custom code template ([details](https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode.md))([demo](https://github.com/shuzijun/leetcode-question))</li>
53+
4454
</ul>
4555
</div>
4656
<br>
@@ -95,13 +105,22 @@
95105
<li>Submissions: View the submission record, select the record details in the pop-up window (Show detail)</li>
96106
<li>Run Code: Run the code, the test case for the question is used by default</li>
97107
<li>Test case: Customize test cases</li>
108+
<li>favorite:Add or remove favorite</li>
98109
<li>Clear cache: Clean up the current questionL</li>
99110
</ul>
100111
</div>
101112
]]></description>
102113

103114
<change-notes><![CDATA[
104115
<ul>
116+
<li>v5.0<br>
117+
1.增加代码自定义生成(<a href="https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode_ZH.md">详细介绍</a>)(<a href="https://github.com/shuzijun/leetcode-question">示例</a>)<br>
118+
2.增加查看题目描述(依赖 Markdown)<br>
119+
</li>
120+
<li>v5.0<br>
121+
1.add code custom(<a href="https://github.com/shuzijun/leetcode-editor/blob/master/CustomCode.md">details</a>)(<a href="https://github.com/shuzijun/leetcode-question">demo</a>)<br>
122+
2.add show content(Rely on Markdown)
123+
</li>
105124
<li>v4.3<br>
106125
1.修复付费用户订阅题目展示<br>
107126
2.修复leetcode-cn.com登陆问题<br>
@@ -238,6 +257,8 @@
238257
</application-components>
239258

240259
<extensions defaultExtensionNs="com.intellij">
260+
<!-- <postStartupActivity implementation = "com.shuzijun.leetcode.plugin.listener.RegisterPluginInstallerStateListener"></postStartupActivity>-->
261+
<errorHandler implementation="com.shuzijun.leetcode.plugin.listener.ErrorReportHandler"/>
241262
<toolWindow id="leetcode" secondary="true" icon="/image/LeetCodeIcon.png" anchor="right"
242263
factoryClass="com.shuzijun.leetcode.plugin.window.WindowFactory"/>
243264
<applicationService serviceInterface="com.shuzijun.leetcode.plugin.setting.PersistentConfig"
@@ -277,6 +298,11 @@
277298
text="open question" description="open question" icon="AllIcons.Actions.Annotate">
278299
</action>
279300

301+
<action id="leetcode.OpenContentAction" class="com.shuzijun.leetcode.plugin.actions.OpenContentAction"
302+
text="open content" description="open content" icon="AllIcons.FileTypes.UiForm">
303+
</action>
304+
305+
280306
<action id="leetcode.OpenInWebAction" class="com.shuzijun.leetcode.plugin.actions.OpenInWebAction"
281307
text="open in web" description="open in web" icon="AllIcons.Actions.MoveTo2">
282308
</action>
@@ -318,6 +344,7 @@
318344

319345
<group id="leetcode.NavigatorActionsMenu">
320346
<reference id="leetcode.OpenAction"/>
347+
<reference id="leetcode.OpenContentAction"/>
321348
<reference id="leetcode.OpenInWebAction"/>
322349
<separator/>
323350
<reference id="leetcode.SubmitAction"/>

resources/i18n/info.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config.load=click {0} or {1} load question\nFirst installation, click {2} config
88
login.exist=already login
99
login.success=login success
1010
login.failed=login failed, examine e-mail or password
11+
login.unknown=Unable to determine the login status, please try to login the web and try again
1112
login.out=out success
1213
login.not=no login
1314
response.cache=request question failed,load cache
@@ -21,11 +22,14 @@ request.pending=Pending...
2122
request.failed=request failed
2223
submit.success=Success:\nRuntime:{0},faster than {1}% of {2} online submissions.\nMemory Usage:{3}, less than {4}% of {5} online submissions.\n
2324
submit.failed=Wrong Answer:\ninput:{0}\nOutput:{1}\nExpected:{2}\n
24-
submit.run.failed=Compile Error:\b{0}
25+
submit.run.failed=Compile Error:\n{0}
2526
test.success=Finished:\nYour input:{0}\nOutput:{1}\nExpected:{2}\n
2627
test.case=test case is empty
2728
response.type.failed=load {0} failed
2829
submission.empty=no submission
2930
submission.parse=parse error
31+
report=Report to plugin author
32+
donate.info=donate
3033
updata=leetcode editor new version {0} ,Please update
3134
user.email=YOU HAVE NOT VERIFIED YOUR ACCOUNT\nYou cannot submit your code to the judge system until you verify your email.\nYou may resend the verification email or change your email in your profile page.
35+
template.variable=${0}question.title{1}\tquestion title\tex:Two Sum\n${0}question.titleSlug{1}\tquestion title slug \tex:two-sum\n${0}question.frontendQuestionId{1}\tquestion serial number\n${0}question.content{1}\tquestion content\n${0}question.code{1}\tquestion code\n$!velocityTool.camelCaseName(str)\ttransform str camel case

0 commit comments

Comments
 (0)