Skip to content

Commit 06d3834

Browse files
committed
Sync function
1 parent 4fafce4 commit 06d3834

File tree

215 files changed

+8258
-3188
lines changed

Some content is hidden

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

215 files changed

+8258
-3188
lines changed

.github/workflows/release.yml

+29-26
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,45 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2
20-
20+
2121
- name: Set LD_VERSION
2222
if: ${{ github.event_name == 'push'}}
2323
run: echo "LD_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
2424
- name: Set LD_VERSION
2525
if: ${{ github.event_name == 'workflow_dispatch'}}
2626
run: echo "LD_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
27-
27+
- name: Set PUBLISH_TOKEN
28+
run: echo "PUBLISH_TOKEN=${{ secrets.PUBLISH_TOKEN }}" >> $GITHUB_ENV
29+
2830
- name: Set up JDK 11
2931
uses: actions/setup-java@v1
3032
with:
3133
java-version: 11
32-
34+
3335
- name: Grant execute permission for gradlew
3436
run: chmod +x gradlew
35-
37+
3638
- name: Build the plugin
37-
run: ./gradlew buildPlugin
39+
run: ./gradlew publishPlugin
3840
env:
39-
LD_VERSION: ${{ env.LD_VERSION }}
40-
41-
- name: Verify plugin
42-
id: verify
43-
uses: ChrisCarini/[email protected]
44-
with:
45-
failure-levels: |
46-
INVALID_PLUGIN
47-
ide-versions: |
48-
ideaIC:2021.1
49-
ideaIC:LATEST-EAP-SNAPSHOT
50-
51-
- name: Print verify contents
52-
run: |
53-
echo "The log file path is: ${{steps.verify.outputs.verification-output-log-filename}}" ;
54-
cat ${{steps.verify.outputs.verification-output-log-filename}}
55-
41+
LD_VERSION: ${{ env.LD_VERSION }}
42+
PUBLISH_TOKEN: ${{ env.PUBLISH_TOKEN }}
43+
44+
# - name: Verify plugin
45+
# id: verify
46+
# uses: ChrisCarini/[email protected]
47+
# with:
48+
# failure-levels: |
49+
# INVALID_PLUGIN
50+
# ide-versions: |
51+
# ideaIC:2020.3
52+
# ideaIC:LATEST-EAP-SNAPSHOT
53+
54+
# - name: Print verify contents
55+
# run: |
56+
# echo "The log file path is: ${{steps.verify.outputs.verification-output-log-filename}}" ;
57+
# cat ${{steps.verify.outputs.verification-output-log-filename}}
58+
5659
- name: Create Release
5760
id: create_release
5861
uses: actions/create-release@v1
@@ -63,14 +66,14 @@ jobs:
6366
release_name: v${{ env.LD_VERSION }}
6467
draft: true
6568
prerelease: false
66-
69+
6770
- name: Upload Release Asset
68-
id: upload-release-asset
71+
id: upload-release-asset
6972
uses: actions/upload-release-asset@v1
7073
env:
7174
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7275
with:
73-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
76+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
7477
asset_path: ./build/distributions/leetcode-editor-${{ env.LD_VERSION }}.zip
7578
asset_name: leetcode-editor-${{ env.LD_VERSION }}.zip
76-
asset_content_type: application/zip
79+
asset_content_type: application/zip

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
3+
# Leetcode Editor Changelog
4+
5+
## 8.2.0
6+
7+
### Added
8+
- 增加了不同的窗口,包括*分页窗口**全部题目窗口**[CodeTop](https://codetop.cc/?utm_source=leetcode_editor)窗口*,可以在导航栏中通过按钮切换.
9+
- Added different windows, including paging window, all problem window, [CodeTop](https://codetop.cc/?utm_source=leetcode_editor) window, which can be switched by buttons in the navigation bar.
10+
11+
- 增加数据统计信息存储,可配合[action](https://github.com/shuzijun/leetcode-editor/blob/master/action/README_ZH.md)生成勋章
12+
- Increase the storage of data statistics, you can use [action](https://github.com/shuzijun/leetcode-editor/tree/master/action) to generate medals
13+
14+
15+
### Changed
16+
- 修改消息通知方式
17+
- Modify the message notification method
18+
19+
- 更改窗口位置
20+
- Change window position
21+
### Deprecated
22+
23+
### Fixed
24+
- fix bugs
25+
26+
### Removed
27+

build.gradle

+26-32
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
plugins {
22
id 'java-library'
3-
id 'org.jetbrains.intellij' version '1.0'
3+
id 'org.jetbrains.intellij' version '1.7.0-SNAPSHOT'
4+
id 'org.jetbrains.changelog' version "1.3.1"
45
id "de.undercouch.download" version "4.0.2"
56
}
67

7-
group 'com.shuzijun.leetcode'
8-
version (System.getenv('LD_VERSION')==null ? project.plugin_version :System.getenv('LD_VERSION')) + (project.build_env.isEmpty() ? "" : "-") + project.build_env
8+
apply plugin: 'org.jetbrains.changelog'
9+
10+
group project.pluginGroup
11+
version (System.getenv('LD_VERSION')==null ? project.pluginVersion :System.getenv('LD_VERSION'))
912

1013
sourceCompatibility = 11
1114
targetCompatibility = 11
1215

16+
1317
repositories {
1418
mavenCentral()
1519
}
@@ -31,47 +35,37 @@ dependencies {
3135

3236
// See https://github.com/JetBrains/gradle-intellij-plugin/
3337
intellij {
34-
pluginName = 'leetcode-editor'
35-
version = project.intellij_version
36-
type = 'IU'
38+
pluginName = project.pluginName
39+
version = project.platformVersion
40+
type = project.platformType
3741
downloadSources = true
3842
updateSinceUntilBuild = false
3943
buildSearchableOptions.enabled = false
4044
ideaDependencyCachePath = "$gradle.gradleUserHomeDir/caches/modules-2/files-2.1/com.jetbrains.intellij.idea"
41-
/* localPath project.idea_local_path
42-
alternativeIdePath project.idea_local_path*/
43-
/*plugins = project.intellij_plugins.split(",").toList()*/
45+
4446
runIde {
45-
jvmArgs = ["-Dfile.encoding=utf-8"]
47+
jvmArgs = project.runIdeJvmArgs.split(',').toList()
4648
}
47-
/* prepareSandbox {
48-
from("src/main/natives" + (project.build_env.isEmpty() ? "" : "-") + project.build_env) { into(getPluginName() + '/natives') }
49-
}*/
50-
51-
}
52-
53-
tasks.withType(JavaCompile) {
54-
options.encoding = "UTF-8"
55-
}
5649

50+
patchPluginXml {
51+
sinceBuild = project.pluginSinceBuild
52+
untilBuild = project.pluginUntilBuild
53+
changeNotes.set(provider { changelog.get(project.version+".0").toHTML() })
54+
}
5755

56+
publishPlugin {
57+
dependsOn("patchChangelog")
58+
token = System.getenv("PUBLISH_TOKEN")
59+
}
5860

61+
}
5962

63+
changelog {
6064

61-
/*
62-
task downloadJCEF(type: Copy) {
63-
if (project.build_env.isEmpty()) {
64-
return
65-
}
66-
def tempFile = new File(buildDir, "/download/natives-" + project.build_env + ".zip")
67-
download {
68-
src("https://github.com/shuzijun/leetcode-editor/releases/download/" + project.jcef_version + "/natives-" + project.build_env + ".zip")
69-
dest tempFile
70-
}
65+
}
7166

72-
from zipTree(tempFile)
73-
into "src/main/"
67+
tasks.withType(JavaCompile) {
68+
options.encoding = "UTF-8"
7469
}
75-
*/
7670

7771

doc/2020.jpg

-64.8 KB
Binary file not shown.

doc/LeetCodeIcon.png

-415 Bytes
Binary file not shown.

doc/clear.png

-206 Bytes
Binary file not shown.

doc/collapseAll.png

-383 Bytes
Binary file not shown.

doc/config-3.0.png

-19.5 KB
Binary file not shown.

doc/config.png

-245 Bytes
Binary file not shown.

doc/customConfig.png

-133 KB
Binary file not shown.

doc/find.png

-464 Bytes
Binary file not shown.

doc/leetcode-editor-3.0.gif

37.5 KB
Loading

doc/leetcode-editor-6.3.zip

-1.59 MB
Binary file not shown.

doc/leetcode-editor.gif

-948 KB
Binary file not shown.

doc/leetcode-editor.zip

-2.75 MB
Binary file not shown.

doc/login.png

-666 Bytes
Binary file not shown.

doc/logout.png

-166 Bytes
Binary file not shown.

doc/menu-3.0.png

-86.5 KB
Binary file not shown.

doc/menu.png

-32.3 KB
Binary file not shown.

doc/refresh.png

-709 Bytes
Binary file not shown.

doc/setting.png

-16.8 KB
Binary file not shown.

doc/settings.png

-103 KB
Binary file not shown.

doc/window-3.0.png

-37.5 KB
Binary file not shown.

doc/window.png

-12.6 KB
Binary file not shown.

doc/window1.png

-17.8 KB
Binary file not shown.

doc/window2.png

-12.6 KB
Binary file not shown.

gradle.properties

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
plugin_version = 8.1
2-
idea_local_path =
3-
# '' | windows | mac | linux
4-
build_env =
5-
jcef_version = v6.0-jcef-beta.1
6-
intellij_version = 2021.1
7-
intellij_plugins = org.intellij.plugins.markdown:211.6693.44
1+
pluginGroup = com.shuzijun.leetcode
2+
pluginName = leetcode-editor
3+
pluginVersion = 8.2
4+
5+
pluginSinceBuild = 202.0
6+
pluginUntilBuild =
7+
8+
platformType = IU
9+
platformVersion = 222-EAP-SNAPSHOT
10+
11+
# ,-Dide.browser.jcef.log.level=verbose,-Duser.language=en-US
12+
runIdeJvmArgs = -Dfile.encoding=utf-8,-Duser.language=en-US

settings.gradle

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
rootProject.name = 'leetcode-editor'
2-
1+
pluginManagement {
2+
repositories {
3+
maven {
4+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
5+
}
6+
gradlePluginPortal()
7+
}
8+
}
39

10+
rootProject.name = 'leetcode-editor'
411

src/main/java/com/shuzijun/leetcode/plugin/actions/AbstractAction.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
import com.shuzijun.leetcode.plugin.model.Config;
1010
import com.shuzijun.leetcode.plugin.model.PluginConstant;
1111
import com.shuzijun.leetcode.plugin.setting.PersistentConfig;
12-
import com.shuzijun.leetcode.plugin.utils.MTAUtils;
13-
import com.shuzijun.leetcode.plugin.utils.MessageUtils;
14-
import com.shuzijun.leetcode.plugin.utils.PropertiesUtils;
15-
import com.shuzijun.leetcode.plugin.utils.UpdateUtils;
12+
import com.shuzijun.leetcode.plugin.utils.*;
1613
import org.apache.commons.lang.StringUtils;
1714
import org.jetbrains.annotations.NotNull;
1815

src/main/java/com/shuzijun/leetcode/plugin/actions/editor/AbstractEditAction.java

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
package com.shuzijun.leetcode.plugin.actions.editor;
22

33
import com.intellij.openapi.actionSystem.AnActionEvent;
4+
import com.intellij.openapi.application.ApplicationManager;
5+
import com.intellij.openapi.fileEditor.FileEditor;
46
import com.intellij.openapi.fileEditor.FileEditorManager;
7+
import com.intellij.openapi.fileEditor.TextEditorWithPreview;
58
import com.intellij.openapi.vfs.VirtualFile;
69
import com.intellij.util.ArrayUtil;
710
import com.shuzijun.leetcode.plugin.actions.AbstractAction;
8-
import com.shuzijun.leetcode.plugin.manager.ViewManager;
11+
import com.shuzijun.leetcode.plugin.editor.ConvergePreview;
12+
import com.shuzijun.leetcode.plugin.editor.QuestionEditorWithPreview;
13+
import com.shuzijun.leetcode.plugin.manager.QuestionManager;
914
import com.shuzijun.leetcode.plugin.model.Config;
1015
import com.shuzijun.leetcode.plugin.model.LeetcodeEditor;
1116
import com.shuzijun.leetcode.plugin.model.Question;
17+
import com.shuzijun.leetcode.plugin.setting.PersistentConfig;
1218
import com.shuzijun.leetcode.plugin.setting.ProjectConfig;
1319
import com.shuzijun.leetcode.plugin.utils.MessageUtils;
1420
import com.shuzijun.leetcode.plugin.utils.PropertiesUtils;
@@ -34,11 +40,11 @@ public void actionPerformed(AnActionEvent anActionEvent, Config config) {
3440
MessageUtils.getInstance(anActionEvent.getProject()).showInfoMsg("info", PropertiesUtils.getInfo("tree.null"));
3541
return;
3642
}
37-
if(!URLUtils.equalsHost(leetcodeEditor.getHost())){
43+
if (!URLUtils.equalsHost(leetcodeEditor.getHost())) {
3844
MessageUtils.getInstance(anActionEvent.getProject()).showInfoMsg("info", PropertiesUtils.getInfo("tree.host"));
3945
return;
4046
}
41-
Question question = ViewManager.getQuestionByTitleSlug(leetcodeEditor.getTitleSlug(), null, anActionEvent.getProject());
47+
Question question = QuestionManager.getQuestionByTitleSlug(leetcodeEditor.getTitleSlug(), anActionEvent.getProject());
4248
if (question == null) {
4349
MessageUtils.getInstance(anActionEvent.getProject()).showInfoMsg("info", PropertiesUtils.getInfo("tree.null"));
4450
return;
@@ -50,4 +56,23 @@ public void actionPerformed(AnActionEvent anActionEvent, Config config) {
5056
}
5157

5258
public abstract void actionPerformed(AnActionEvent anActionEvent, Config config, Question question);
59+
60+
protected boolean openConvergeEditor(AnActionEvent anActionEvent, ConvergePreview.TabSelectFileEditorState state) {
61+
FileEditor fileEditor = FileEditorManager.getInstance(anActionEvent.getProject()).getSelectedEditor();
62+
if (fileEditor != null && fileEditor instanceof QuestionEditorWithPreview) {
63+
QuestionEditorWithPreview questionEditorWithPreview = (QuestionEditorWithPreview) fileEditor;
64+
FileEditor previewEditor = questionEditorWithPreview.getPreviewEditor();
65+
if (previewEditor instanceof ConvergePreview) {
66+
ConvergePreview convergePreview = (ConvergePreview) previewEditor;
67+
ApplicationManager.getApplication().invokeLater(() -> {
68+
convergePreview.setState(state);
69+
if ((questionEditorWithPreview.getLayout() == TextEditorWithPreview.Layout.SHOW_PREVIEW && PersistentConfig.getInstance().getInitConfig().isLeftQuestionEditor()) || (questionEditorWithPreview.getLayout() == TextEditorWithPreview.Layout.SHOW_EDITOR && !PersistentConfig.getInstance().getInitConfig().isLeftQuestionEditor())) {
70+
questionEditorWithPreview.setState(new TextEditorWithPreview.MyFileEditorState(TextEditorWithPreview.Layout.SHOW_EDITOR_AND_PREVIEW, null, null));
71+
}
72+
});
73+
return true;
74+
}
75+
}
76+
return false;
77+
}
5378
}

src/main/java/com/shuzijun/leetcode/plugin/actions/editor/OpenContentAction.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.intellij.openapi.actionSystem.AnActionEvent;
44
import com.intellij.openapi.project.Project;
5+
import com.shuzijun.leetcode.plugin.editor.ConvergePreview;
56
import com.shuzijun.leetcode.plugin.manager.CodeManager;
67
import com.shuzijun.leetcode.plugin.model.Config;
78
import com.shuzijun.leetcode.plugin.model.Question;
@@ -13,8 +14,11 @@ public class OpenContentAction extends AbstractEditAction {
1314

1415
@Override
1516
public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) {
17+
if (config.getConvergeEditor() && openConvergeEditor(anActionEvent, new ConvergePreview.TabSelectFileEditorState("Content"))) {
18+
return;
19+
}
1620
Project project = anActionEvent.getProject();
17-
CodeManager.openContent(question, project, true);
21+
CodeManager.openContent(question.getTitleSlug(), project, true);
1822

1923
}
2024
}

0 commit comments

Comments
 (0)