├── action ├── README.md └── README_ZH.md ├── doc ├── menu-3.0.jpg ├── config-3.0.jpg ├── cookieLogin.png ├── window-3.0.jpg ├── browserCookie.png ├── customConfig-100.gif ├── leetcode-editor-3.0.gif ├── CustomCode.md ├── LoginHelp_ZH.md └── LoginHelp.md ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── src └── main │ ├── resources │ ├── image │ │ ├── AliPay.png │ │ ├── WeChat.png │ │ ├── LeetCode.png │ │ └── LeetCodeIcon.png │ ├── vditor │ │ ├── fonts │ │ │ ├── JetBrainsMono-Bold.woff2 │ │ │ ├── JetBrainsMono-Thin.woff2 │ │ │ ├── JetBrainsMono-Italic.woff2 │ │ │ ├── JetBrainsMono-Light.woff2 │ │ │ ├── JetBrainsMono-Medium.woff2 │ │ │ ├── JetBrainsMono-Regular.woff2 │ │ │ ├── JetBrainsMono-ExtraBold.woff2 │ │ │ ├── JetBrainsMono-SemiBold.woff2 │ │ │ ├── JetBrainsMono-BoldItalic.woff2 │ │ │ ├── JetBrainsMono-ExtraLight.woff2 │ │ │ ├── JetBrainsMono-LightItalic.woff2 │ │ │ ├── JetBrainsMono-MediumItalic.woff2 │ │ │ ├── JetBrainsMono-ThinItalic.woff2 │ │ │ ├── JetBrainsMono-SemiBoldItalic.woff2 │ │ │ ├── JetBrainsMono-ExtraBoldItalic.woff2 │ │ │ └── JetBrainsMono-ExtraLightItalic.woff2 │ │ └── dist │ │ │ └── js │ │ │ └── katex │ │ │ └── fonts │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-BoldItalic.woff │ │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ ├── KaTeX_Typewriter-Regular.woff2 │ │ │ └── KaTeX_Caligraphic-Regular.woff2 │ ├── graphql │ │ ├── getNote.graphql │ │ ├── solutionDetailArticle_cn.graphql │ │ ├── randomQuestion.graphql │ │ ├── solutionDetailArticle.graphql │ │ ├── randomQuestion_cn.graphql │ │ ├── allQuestions.graphql │ │ ├── addQuestionToFavorite.graphql │ │ ├── updateNote.graphql │ │ ├── removeQuestionFromFavorite.graphql │ │ ├── allQuestions_cn.graphql │ │ ├── userStatus.graphql │ │ ├── userStatus_cn.graphql │ │ ├── submissions.graphql │ │ ├── questionOfToday.graphql │ │ ├── userSessionProgress_cn.graphql │ │ ├── questionOfToday_cn.graphql │ │ ├── problemsetQuestionList.graphql │ │ ├── questionSolutionArticles.graphql │ │ ├── questionSolutionArticles_cn.graphql │ │ ├── problemsetQuestionList_cn.graphql │ │ ├── submissionDetail_cn.graphql │ │ ├── questionData.graphql │ │ └── submissionDetail.graphql │ ├── icons │ │ ├── emperor_new_clothes.svg │ │ ├── run.svg │ │ ├── run_dark.svg │ │ ├── pull.svg │ │ ├── pull_dark.svg │ │ ├── filter.svg │ │ ├── sortAsc.svg │ │ ├── sortDesc.svg │ │ ├── filter_dark.svg │ │ ├── sortAsc_dark.svg │ │ ├── sortDesc_dark.svg │ │ ├── push.svg │ │ ├── push_dark.svg │ │ ├── submit.svg │ │ ├── submit_dark.svg │ │ ├── popup.svg │ │ ├── toggle.svg │ │ ├── popup_dark.svg │ │ ├── toggle_dark.svg │ │ ├── favorite.svg │ │ ├── progress.svg │ │ ├── favorite_dark.svg │ │ ├── progress_dark.svg │ │ ├── donate.svg │ │ ├── donate_dark.svg │ │ ├── show.svg │ │ ├── show_dark.svg │ │ ├── question.svg │ │ ├── question_dark.svg │ │ ├── share.svg │ │ ├── share_dark.svg │ │ ├── time.svg │ │ ├── time_dark.svg │ │ ├── collapse.svg │ │ ├── collapse_dark.svg │ │ ├── find.svg │ │ ├── find_dark.svg │ │ ├── edit_doc.svg │ │ ├── edit_doc_dark.svg │ │ ├── position.svg │ │ ├── position_dark.svg │ │ ├── logout.svg │ │ ├── logout_dark.svg │ │ ├── help.svg │ │ ├── help_dark.svg │ │ ├── login.svg │ │ ├── login_dark.svg │ │ ├── refresh.svg │ │ ├── refresh_dark.svg │ │ ├── solution.svg │ │ ├── solution_dark.svg │ │ ├── desc.svg │ │ ├── desc_dark.svg │ │ ├── clean_dark.svg │ │ ├── clean.svg │ │ ├── LeetCode.svg │ │ ├── LeetCode_dark.svg │ │ ├── clear.svg │ │ ├── clear_dark.svg │ │ ├── config.svg │ │ ├── config_dark.svg │ │ ├── config_lc.svg │ │ └── config_lc_dark.svg │ └── template │ │ ├── codeTopTip_cn.txt │ │ ├── allTip_cn.txt │ │ ├── pageTip_cn.txt │ │ ├── codeTopTip.txt │ │ ├── allTip.txt │ │ └── pageTip.txt │ ├── natives │ └── README.md │ └── java │ └── com │ └── shuzijun │ └── leetcode │ └── plugin │ ├── utils │ ├── LogUtils.java │ ├── PropertiesUtils.java │ ├── DataKeys.java │ ├── HttpResponse.java │ ├── CodeTopURLUtils.java │ ├── doc │ │ ├── CleanExtensions.java │ │ ├── InlineLaTexNode.java │ │ └── CleanMarkdown.java │ └── VelocityUtils.java │ ├── window │ └── NavigatorPanelAction.java │ ├── listener │ ├── AllQuestionNotifier.java │ ├── QuestionSubmitNotifier.java │ ├── ConfigNotifier.java │ ├── LoginNotifier.java │ ├── QuestionStatusNotifier.java │ ├── ColorListener.java │ ├── SupportCheck.java │ ├── ErrorReportHandler.java │ └── JTableKeyAdapter.java │ ├── editor │ ├── LCVLanguage.java │ ├── LCVFileType.java │ ├── LCVProvider.java │ └── converge │ │ ├── SolutionProvider.java │ │ ├── SubmissionsProvider.java │ │ └── ContentProvider.java │ ├── actions │ ├── toolbar │ │ ├── page │ │ │ ├── GoAction.java │ │ │ ├── NextAction.java │ │ │ ├── PageBoxAction.java │ │ │ ├── PreviousAction.java │ │ │ ├── PageSizeBoxAction.java │ │ │ └── AbstractPageAction.java │ │ ├── DonateAction.java │ │ ├── HelpAction.java │ │ ├── ShareAction.java │ │ ├── ConfigAction.java │ │ ├── RefreshAction.java │ │ ├── FindClearAction.java │ │ ├── PickAction.java │ │ ├── ToggleListAction.java │ │ └── LogoutAction.java │ ├── tree │ │ ├── PushNoteAction.java │ │ ├── RunCodeAction.java │ │ ├── SubmitAction.java │ │ ├── ShowNoteAction.java │ │ ├── OpenInWebAction.java │ │ ├── OpenAction.java │ │ ├── PullNoteAction.java │ │ ├── OpenContentAction.java │ │ ├── ResetTimeAction.java │ │ ├── StopTimeAction.java │ │ ├── StartTimeAction.java │ │ ├── AbstractTreeAction.java │ │ └── TestcaseAction.java │ └── editor │ │ ├── PushNoteAction.java │ │ ├── RunCodeAction.java │ │ ├── SubmitAction.java │ │ ├── OpenInWebAction.java │ │ ├── ShowNoteAction.java │ │ ├── ResetTimeAction.java │ │ ├── StopTimeAction.java │ │ ├── PullNoteAction.java │ │ ├── StartTimeAction.java │ │ ├── OpenContentAction.java │ │ ├── EditorMenuActionGroup.java │ │ └── TestcaseAction.java │ ├── model │ ├── QuestionIndex.java │ ├── CodeTopQuestionView.java │ ├── CodeSnippet.java │ ├── Sort.java │ ├── Solution.java │ ├── Tag.java │ ├── MenuItem.java │ ├── Submission.java │ ├── Statistics.java │ ├── User.java │ └── LeetcodeEditor.java │ ├── timer │ └── TimerStatusBarWidgetProvider.java │ └── setting │ └── SettingConfigurable.java ├── .github ├── config │ └── comvent-ad.yaml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ ├── discuss.md │ └── bug_report.md ├── workflows │ ├── no-response.yml │ ├── snapshot.yml │ └── monitor-abusive.yml ├── FUNDING.yml └── no-response.yml ├── gradle.properties └── settings.gradle.kts /action/README.md: -------------------------------------------------------------------------------- 1 | Redirect https://github.com/shuzijun/leetcode-editor-action -------------------------------------------------------------------------------- /action/README_ZH.md: -------------------------------------------------------------------------------- 1 | Redirect https://github.com/shuzijun/leetcode-editor-action -------------------------------------------------------------------------------- /doc/menu-3.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/menu-3.0.jpg -------------------------------------------------------------------------------- /doc/config-3.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/config-3.0.jpg -------------------------------------------------------------------------------- /doc/cookieLogin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/cookieLogin.png -------------------------------------------------------------------------------- /doc/window-3.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/window-3.0.jpg -------------------------------------------------------------------------------- /doc/browserCookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/browserCookie.png -------------------------------------------------------------------------------- /doc/customConfig-100.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/customConfig-100.gif -------------------------------------------------------------------------------- /doc/leetcode-editor-3.0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/doc/leetcode-editor-3.0.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/image/AliPay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/image/AliPay.png -------------------------------------------------------------------------------- /src/main/resources/image/WeChat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/image/WeChat.png -------------------------------------------------------------------------------- /src/main/natives/README.md: -------------------------------------------------------------------------------- 1 | Copy resources to this directory based on environment 2 | https://github.com/shuzijun/leetcode-editor/releases/ -------------------------------------------------------------------------------- /src/main/resources/image/LeetCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/image/LeetCode.png -------------------------------------------------------------------------------- /src/main/resources/image/LeetCodeIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/image/LeetCodeIcon.png -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Thin.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Italic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Light.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Medium.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-ExtraBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-ExtraBold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-SemiBold.woff2 -------------------------------------------------------------------------------- /.github/config/comvent-ad.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 0.2.0 3 | 4 | trigger: default 5 | 6 | keywords: 7 | - name: blocked-words 8 | value: [leetcode-assistant|LeetCode Assistant] 9 | -------------------------------------------------------------------------------- /src/main/resources/graphql/getNote.graphql: -------------------------------------------------------------------------------- 1 | query getNote($titleSlug: String!) { 2 | question(titleSlug: $titleSlug) { 3 | questionId 4 | note 5 | __typename 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/emperor_new_clothes.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-BoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-ExtraLight.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-ExtraLight.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-LightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-LightItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-MediumItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-MediumItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-ThinItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-ThinItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-SemiBoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-SemiBoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-ExtraBoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-ExtraBoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/fonts/JetBrainsMono-ExtraLightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/fonts/JetBrainsMono-ExtraLightItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shuzijun/leetcode-editor/HEAD/src/main/resources/vditor/dist/js/katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/graphql/solutionDetailArticle_cn.graphql: -------------------------------------------------------------------------------- 1 | query solutionDetailArticle($slug: String!, $orderBy: SolutionArticleOrderBy!) { 2 | solutionArticle(slug: $slug, orderBy: $orderBy) { 3 | content 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/graphql/randomQuestion.graphql: -------------------------------------------------------------------------------- 1 | query randomQuestion($categorySlug: String, $filters: QuestionListFilterInput) { 2 | randomQuestion(categorySlug: $categorySlug, filters: $filters) { 3 | titleSlug 4 | } 5 | } -------------------------------------------------------------------------------- /src/main/resources/graphql/solutionDetailArticle.graphql: -------------------------------------------------------------------------------- 1 | query solutionDetailArticle($titleSlug: String!) { 2 | solutionArticle: question(titleSlug: $titleSlug) { 3 | solution { 4 | content 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/graphql/randomQuestion_cn.graphql: -------------------------------------------------------------------------------- 1 | query randomQuestion($categorySlug: String!, $filters: QuestionListFilterInput) { 2 | randomQuestion: problemsetRandomFilteredQuestion(categorySlug: $categorySlug, filters: $filters) 3 | } 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | import com.intellij.openapi.diagnostic.Logger; 4 | 5 | 6 | public class LogUtils { 7 | 8 | public static final Logger LOG = Logger.getInstance("#com.shuzijun.leetcode.plugin"); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/graphql/allQuestions.graphql: -------------------------------------------------------------------------------- 1 | query allQuestions { 2 | allQuestions { 3 | title 4 | titleSlug 5 | frontendQuestionId: questionFrontendId 6 | questionId 7 | status 8 | level: difficulty 9 | isPaidOnly 10 | category: categoryTitle 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorPanelAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.window; 2 | 3 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 4 | 5 | /** 6 | * @author shuzijun 7 | */ 8 | public interface NavigatorPanelAction { 9 | NavigatorAction getNavigatorAction(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/graphql/addQuestionToFavorite.graphql: -------------------------------------------------------------------------------- 1 | mutation addQuestionToFavorite($favoriteIdHash: String!, $questionId: String!) { 2 | addQuestionToFavorite(favoriteIdHash: $favoriteIdHash, questionId: $questionId) { 3 | ok 4 | error 5 | favoriteIdHash 6 | questionId 7 | __typename 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/graphql/updateNote.graphql: -------------------------------------------------------------------------------- 1 | mutation updateNote($titleSlug: String!, $content: String!) { 2 | updateNote(titleSlug: $titleSlug, content: $content) { 3 | ok 4 | error 5 | question { 6 | questionId 7 | note 8 | __typename 9 | } 10 | __typename 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/graphql/removeQuestionFromFavorite.graphql: -------------------------------------------------------------------------------- 1 | mutation removeQuestionFromFavorite($favoriteIdHash: String!, $questionId: String!) { 2 | removeQuestionFromFavorite(favoriteIdHash: $favoriteIdHash, questionId: $questionId) { 3 | ok 4 | error 5 | favoriteIdHash 6 | questionId 7 | __typename 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | pluginGroup = com.shuzijun.leetcode 2 | pluginName = leetcode-editor 3 | pluginVersion = 8.16 4 | 5 | pluginSinceBuild = 223.0 6 | pluginUntilBuild = 7 | pluginDescription = doc/description.html 8 | 9 | platformType = IU 10 | platformVersion = 2022.3 11 | 12 | # ,-Dide.browser.jcef.log.level=verbose,-Duser.language=en-US 13 | runIdeJvmArgs = -Dfile.encoding=utf-8 -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | url = uri("https://oss.sonatype.org/content/repositories/snapshots/") 5 | } 6 | gradlePluginPortal() 7 | } 8 | } 9 | 10 | plugins { 11 | id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" 12 | } 13 | 14 | rootProject.name = "leetcode-editor" 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/icons/run.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/icons/run_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/resources/graphql/allQuestions_cn.graphql: -------------------------------------------------------------------------------- 1 | query allQuestions { 2 | allQuestions { 3 | ...questionSummaryFields 4 | } 5 | } 6 | 7 | fragment questionSummaryFields on QuestionNode { 8 | title 9 | titleSlug 10 | translatedTitle 11 | frontendQuestionId: questionFrontendId 12 | questionId 13 | status 14 | level: difficulty 15 | isPaidOnly 16 | category: categoryTitle 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/graphql/userStatus.graphql: -------------------------------------------------------------------------------- 1 | query globalData { 2 | userStatus { 3 | userId 4 | isSignedIn 5 | isMockUser 6 | isPremium 7 | isVerified 8 | username 9 | avatar 10 | isAdmin 11 | isSuperuser 12 | permissions 13 | isTranslator 14 | activeSessionId 15 | notificationStatus { 16 | lastModified 17 | numUnread 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/graphql/userStatus_cn.graphql: -------------------------------------------------------------------------------- 1 | query globalData { 2 | userStatus { 3 | isSignedIn 4 | isPremium 5 | username 6 | realName 7 | avatar 8 | userSlug 9 | isAdmin 10 | useTranslation 11 | premiumExpiredAt 12 | isTranslator 13 | isSuperuser 14 | isPhoneVerified 15 | isVerified 16 | } 17 | jobsMyCompany { 18 | nameSlug 19 | } 20 | commonNojPermissionTypes 21 | } -------------------------------------------------------------------------------- /src/main/resources/template/codeTopTip_cn.txt: -------------------------------------------------------------------------------- 1 | 正在浏览"CodeTop的题目列表"窗口,数据来自CodeTop,更多功能请点击{0}打开CodeTop网页. 2 | 首次安装请先点击{1}进行配置. 3 | 点击{2}加载题目,点击{3}切换到其他窗口. 4 | 5 | 6 | 工具栏介绍: 7 | {4} 登录LeetCode,同步题目状态(两个网站的登录账号不互通,在切换网站时需要重新配置用户.) 8 | {5} 退出登录(退出当前账号,遇到登录问题时可以尝试先退出.) 9 | {6} 加载或刷新题目(即使没有登录,仍然可以刷新或加载题目,但无法提交答案.) 10 | {7} 打开筛选面板(可以进行过滤或者排序.) 11 | {8} 打开CodeTop网页. 12 | {9} 切换到其他列表窗口,包括"所有题目列表"、"分页题目列表"、"CodeTop题目列表". 13 | {10} 打开配置面板. 14 | {11} 清空所有题目缓存. 15 | {12} 打开帮助页面. -------------------------------------------------------------------------------- /src/main/resources/template/allTip_cn.txt: -------------------------------------------------------------------------------- 1 | 正在浏览"所有的题目列表"窗口. 2 | 首次安装请先点击{0}进行配置. 3 | 点击{1}或者{2}加载题目,点击{3}切换到其他窗口. 4 | 5 | 工具栏介绍: 6 | {4} 登录(两个网站的登录账号不互通,在切换网站时需要重新配置用户.) 7 | {5} 退出登录(退出当前账号,遇到登录问题时可以尝试先退出.) 8 | {6} 加载或刷新题目(即使没有登录,仍然可以刷新或加载题目,但无法提交答案.) 9 | {7} 随机一个题目. 10 | {8} 打开筛选面板(可以进行搜索、过滤或者排序.) 11 | {9} 根据当前编辑器内容,定位对应题目在列表中的位置. 12 | {10} 打开进度面板(可以查看或者切换进度.) 13 | {11} 切换到其他列表窗口,包括"所有题目列表"、"分页题目列表"、"CodeTop题目列表". 14 | {12} 打开配置面板. 15 | {13} 清空所有题目缓存文件. 16 | {14} 打开帮助页面. -------------------------------------------------------------------------------- /src/main/resources/template/pageTip_cn.txt: -------------------------------------------------------------------------------- 1 | 正在浏览"分页的题目列表"窗口. 2 | 首次安装请先点击{0}进行配置. 3 | 点击{1}或者{2}加载题目,点击{3}切换到其他窗口. 4 | 5 | 工具栏介绍: 6 | {4} 登录(两个网站的登录账号不互通,在切换网站时需要重新配置用户.) 7 | {5} 退出登录(退出当前账号,遇到登录问题时可以尝试先退出.) 8 | {6} 加载或刷新题目(即使没有登录,仍然可以刷新或加载题目,但无法提交答案.) 9 | {7} 随机一个题目. 10 | {8} 打开筛选面板(可以进行搜索、过滤或者排序.) 11 | {9} 根据当前编辑器内容,定位对应题目在列表中的位置. 12 | {10} 打开进度面板(可以查看或者切换进度) 13 | {11} 切换到其他列表窗口,包括"所有题目列表"、"分页题目列表"、"CodeTop题目列表". 14 | {12} 打开配置面板. 15 | {13} 清空所有题目缓存文件. 16 | {14} 打开帮助页面. -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/AllQuestionNotifier.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.util.messages.Topic; 4 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public interface AllQuestionNotifier { 10 | 11 | @Topic.AppLevel 12 | Topic TOPIC = Topic.create(PluginConstant.LEETCODE_ALL_QUESTION_TOPIC, AllQuestionNotifier.class); 13 | 14 | void reset(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/LCVLanguage.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor; 2 | 3 | import com.intellij.lang.Language; 4 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 5 | 6 | public class LCVLanguage extends Language { 7 | 8 | public static final String LANGUAGE_NAME = PluginConstant.LEETCODE_EDITOR_VIEW+"Doc"; 9 | 10 | public static final LCVLanguage INSTANCE = new LCVLanguage(); 11 | 12 | protected LCVLanguage() { 13 | super(LANGUAGE_NAME); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/CustomCode.md: -------------------------------------------------------------------------------- 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/doc/CustomCode_ZH.md) 5 |

loacl

6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/GoAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class GoAction extends AbstractPageAction { 10 | @Override 11 | public void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction) { 12 | navigatorAction.getPagePanel().clickGo(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/NextAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class NextAction extends AbstractPageAction { 10 | @Override 11 | public void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction) { 12 | navigatorAction.getPagePanel().clickNext(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/QuestionSubmitNotifier.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.util.messages.Topic; 4 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public interface QuestionSubmitNotifier { 10 | 11 | @Topic.AppLevel 12 | Topic TOPIC = Topic.create(PluginConstant.LEETCODE_EDITOR_QUESTION_SUBMIT_TOPIC, QuestionSubmitNotifier.class); 13 | 14 | void submit(String host, String slug); 15 | } 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/DonateAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.ide.BrowserUtil; 4 | import com.intellij.openapi.actionSystem.AnAction; 5 | import com.intellij.openapi.actionSystem.AnActionEvent; 6 | 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class DonateAction extends AnAction { 12 | @Override 13 | public void actionPerformed(AnActionEvent anActionEvent) { 14 | BrowserUtil.browse("https://shuzijun.cn/donate.html"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/PageBoxAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class PageBoxAction extends AbstractPageAction { 10 | @Override 11 | public void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction) { 12 | navigatorAction.getPagePanel().focusedPage(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/PreviousAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class PreviousAction extends AbstractPageAction { 10 | @Override 11 | public void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction) { 12 | navigatorAction.getPagePanel().clickPrevious(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/graphql/submissions.graphql: -------------------------------------------------------------------------------- 1 | query submissions($offset: Int!, $limit: Int!, $lastKey: String, $questionSlug: String!) { 2 | submissionList(offset: $offset, limit: $limit, lastKey: $lastKey, questionSlug: $questionSlug) { 3 | lastKey 4 | hasNext 5 | submissions { 6 | id 7 | statusDisplay 8 | lang 9 | runtime 10 | timestamp 11 | url 12 | isPending 13 | memory 14 | __typename 15 | } 16 | __typename 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/PageSizeBoxAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class PageSizeBoxAction extends AbstractPageAction { 10 | @Override 11 | public void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction) { 12 | navigatorAction.getPagePanel().focusedPageSize(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/discuss.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Discuss 3 | about: Start a discussion or ask for help 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Desc** 11 | Start a discussion or ask for help 12 | 13 | **Software versions(*Help* -> *About*)(Optional)** 14 | - Product: [e.g IDEA 2020.2] 15 | - Runtime version:[e.g 11.0.7+10-b944.20 amd64] 16 | - VM:[e.g OpenJDK 64-Bit Server VM by JetBrains s.r.o.] 17 | - OS:[e.g Windows 10] 18 | 19 | **Question(Optional)** 20 | - URL:[e.g leetcode.com] 21 | - Code Type:[e.g JAVA] 22 | - code: 23 | ``` 24 | 25 | ``` 26 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/ConfigNotifier.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.util.messages.Topic; 4 | import com.shuzijun.leetcode.plugin.model.Config; 5 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 6 | 7 | /** 8 | * @author shuzijun 9 | */ 10 | public interface ConfigNotifier { 11 | 12 | @Topic.AppLevel 13 | Topic TOPIC = Topic.create(PluginConstant.LEETCODE_EDITOR_CONFIG_TOPIC, ConfigNotifier.class); 14 | 15 | void change(Config oldConfig, Config newConfig); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/PropertiesUtils.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | import java.text.MessageFormat; 4 | import java.util.ResourceBundle; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class PropertiesUtils { 10 | 11 | private final static String baseName = "i18n/info"; 12 | private final static ResourceBundle rb1 = ResourceBundle.getBundle(baseName); 13 | 14 | public static String getInfo(String key, String... params) { 15 | return new MessageFormat(rb1.getString(key)).format(params); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/graphql/questionOfToday.graphql: -------------------------------------------------------------------------------- 1 | query questionOfToday { 2 | activeDailyCodingChallengeQuestion { 3 | date 4 | userStatus 5 | question { 6 | acRate 7 | difficulty 8 | freqBar 9 | frontendQuestionId: questionFrontendId 10 | paidOnly: isPaidOnly 11 | status 12 | title 13 | titleSlug 14 | hasSolution 15 | topicTags { 16 | name 17 | id 18 | slug 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/LoginNotifier.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.openapi.project.Project; 4 | import com.intellij.util.messages.Topic; 5 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 6 | 7 | /** 8 | * @author shuzijun 9 | */ 10 | public interface LoginNotifier { 11 | 12 | @Topic.AppLevel 13 | Topic TOPIC = Topic.create(PluginConstant.LEETCODE_EDITOR_LOGIN_TOPIC, LoginNotifier.class); 14 | 15 | void login(Project project, String host); 16 | 17 | void logout(Project project, String host); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/icons/pull.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/pull_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/HelpAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.ide.BrowserUtil; 4 | import com.intellij.openapi.actionSystem.AnAction; 5 | import com.intellij.openapi.actionSystem.AnActionEvent; 6 | import com.intellij.openapi.project.DumbAware; 7 | 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class HelpAction extends AnAction implements DumbAware { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent) { 15 | BrowserUtil.browse("https://github.com/shuzijun/leetcode-editor"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/QuestionStatusNotifier.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.util.messages.Topic; 4 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 5 | import com.shuzijun.leetcode.plugin.model.Question; 6 | 7 | /** 8 | * @author shuzijun 9 | */ 10 | public interface QuestionStatusNotifier { 11 | 12 | @Topic.AppLevel 13 | Topic QUESTION_STATUS_TOPIC = Topic.create(PluginConstant.LEETCODE_EDITOR_QUESTION_STATUS_TOPIC, QuestionStatusNotifier.class); 14 | 15 | public void updateTable(Question question); 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/icons/filter.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/sortAsc.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/icons/sortDesc.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/icons/filter_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/sortAsc_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/icons/sortDesc_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/QuestionIndex.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class QuestionIndex { 7 | private int index; 8 | 9 | private QuestionView questionView; 10 | 11 | public int getIndex() { 12 | return index; 13 | } 14 | 15 | public void setIndex(int index) { 16 | this.index = index; 17 | } 18 | 19 | public QuestionView getQuestionView() { 20 | return questionView; 21 | } 22 | 23 | public void setQuestionView(QuestionView questionView) { 24 | this.questionView = questionView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/icons/push.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/push_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/PushNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class PushNoteAction extends AbstractTreeAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | NoteManager.push(question.getTitleSlug(), anActionEvent.getProject()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/RunCodeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class RunCodeAction extends AbstractTreeAction { 12 | @Override 13 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 14 | CodeManager.RunCodeCode(question.getTitleSlug(), anActionEvent.getProject()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/SubmitAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class SubmitAction extends AbstractTreeAction { 12 | @Override 13 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 14 | CodeManager.SubmitCode(question.getTitleSlug(), anActionEvent.getProject()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/no-response.yml: -------------------------------------------------------------------------------- 1 | name: No Response 2 | 3 | # Both `issue_comment` and `scheduled` event types are required for this Action 4 | # to work properly. 5 | on: 6 | issue_comment: 7 | types: [created] 8 | schedule: 9 | # Schedule for five minutes after the hour, every hour 10 | - cron: '5 * * * *' 11 | workflow_dispatch: 12 | inputs: 13 | version: 14 | description: 'Release version' 15 | required: false 16 | 17 | permissions: 18 | issues: write 19 | 20 | jobs: 21 | noResponse: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: lee-dohm/no-response@v0.5.0 25 | with: 26 | token: ${{ github.token }} 27 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/PushNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class PushNoteAction extends AbstractEditAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | NoteManager.push(question.getTitleSlug(), anActionEvent.getProject()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/RunCodeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class RunCodeAction extends AbstractEditAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | CodeManager.RunCodeCode(question.getTitleSlug(), anActionEvent.getProject()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/SubmitAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class SubmitAction extends AbstractEditAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | CodeManager.SubmitCode(question.getTitleSlug(), anActionEvent.getProject()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/ShowNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class ShowNoteAction extends AbstractTreeAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | NoteManager.show(question.getTitleSlug(), anActionEvent.getProject(), true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/ShareAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.ide.BrowserUtil; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 7 | import com.shuzijun.leetcode.plugin.model.Config; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class ShareAction extends AbstractAction implements DumbAware { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 15 | BrowserUtil.browse("https://codetop.cc/?utm_source=leetcode_editor"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://shuzijun.cn/donate.html'] 13 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/OpenInWebAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.ide.BrowserUtil; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.utils.URLUtils; 8 | 9 | /** 10 | * @author zzdcon 11 | */ 12 | public class OpenInWebAction extends AbstractTreeAction { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | 16 | BrowserUtil.browse(URLUtils.getLeetcodeProblems() + question.getTitleSlug()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/OpenInWebAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.ide.BrowserUtil; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.utils.URLUtils; 8 | 9 | /** 10 | * @author zzdcon 11 | */ 12 | public class OpenInWebAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | BrowserUtil.browse(URLUtils.getLeetcodeProblems() + question.getTitleSlug()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/icons/submit.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/graphql/userSessionProgress_cn.graphql: -------------------------------------------------------------------------------- 1 | query userSessionProgress($userSlug: String!) { 2 | userProfileUserQuestionSubmitStats(userSlug: $userSlug) { 3 | acSubmissionNum { 4 | difficulty 5 | count 6 | } 7 | totalSubmissionNum { 8 | difficulty 9 | count 10 | } 11 | } 12 | userProfileUserQuestionProgress(userSlug: $userSlug) { 13 | numAcceptedQuestions { 14 | difficulty 15 | count 16 | } 17 | numFailedQuestions { 18 | difficulty 19 | count 20 | } 21 | numUntouchedQuestions { 22 | difficulty 23 | count 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/resources/icons/submit_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/popup.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/toggle.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/resources/icons/popup_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/toggle_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/CodeTopQuestionView.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class CodeTopQuestionView extends QuestionView { 7 | 8 | private String inspectTime; 9 | 10 | private Integer inspectFrequency; 11 | 12 | public String getInspectTime() { 13 | return inspectTime; 14 | } 15 | 16 | public void setInspectTime(String inspectTime) { 17 | this.inspectTime = inspectTime; 18 | } 19 | 20 | public Integer getInspectFrequency() { 21 | return inspectFrequency; 22 | } 23 | 24 | public void setInspectFrequency(Integer inspectFrequency) { 25 | this.inspectFrequency = inspectFrequency; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Software versions(*Help* -> *About*)** 21 | - Product: [e.g IDEA 2020.2] 22 | - Runtime version:[e.g 11.0.7+10-b944.20 amd64] 23 | - VM:[e.g OpenJDK 64-Bit Server VM by JetBrains s.r.o.] 24 | - OS:[e.g Windows 10] 25 | 26 | **Question(Optional)** 27 | - URL:[e.g leetcode.com] 28 | - Code Type:[e.g JAVA] 29 | - code: 30 | ``` 31 | 32 | ``` 33 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/OpenAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.Project; 5 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class OpenAction extends AbstractTreeAction { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | Project project = anActionEvent.getProject(); 16 | CodeManager.openCode(question.getTitleSlug(), project); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | # Number of days of inactivity before an Issue is closed for lack of response 4 | daysUntilClose: 14 5 | # Label requiring a response 6 | responseRequiredLabel: more-information-needed 7 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 8 | closeComment: > 9 | This issue has been automatically closed because there has been no response 10 | to our request for more information from the original author. With only the 11 | information that is currently in the issue, we don't have enough information 12 | to take action. Please reach out if you have or find the answers we need so 13 | that we can investigate further. 14 | -------------------------------------------------------------------------------- /src/main/resources/graphql/questionOfToday_cn.graphql: -------------------------------------------------------------------------------- 1 | query questionOfToday { 2 | activeDailyCodingChallengeQuestion: todayRecord { 3 | date 4 | userStatus 5 | question { 6 | questionId 7 | frontendQuestionId: questionFrontendId 8 | difficulty 9 | title 10 | titleCn: translatedTitle 11 | titleSlug 12 | paidOnly: isPaidOnly 13 | freqBar 14 | isFavor 15 | acRate 16 | status 17 | solutionNum 18 | hasVideoSolution 19 | topicTags { 20 | name 21 | nameTranslated: translatedName 22 | id 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/icons/favorite.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/progress.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/PullNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class PullNoteAction extends AbstractTreeAction { 12 | 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | NoteManager.pull(question.getTitleSlug(), anActionEvent.getProject()); 16 | NoteManager.show(question.getTitleSlug(), anActionEvent.getProject(), true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/icons/favorite_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/progress_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/ConfigAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.openapi.actionSystem.AnAction; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.options.ShowSettingsUtil; 6 | import com.intellij.openapi.project.DumbAware; 7 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class ConfigAction extends AnAction implements DumbAware { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent) { 15 | ShowSettingsUtil.getInstance().showSettingsDialog(anActionEvent.getProject(), PluginConstant.APPLICATION_CONFIGURABLE_DISPLAY_NAME); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/OpenContentAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.Project; 5 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class OpenContentAction extends AbstractTreeAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | Project project = anActionEvent.getProject(); 17 | CodeManager.openContent(question.getTitleSlug(), project, true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/icons/donate.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/DataKeys.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | import com.intellij.execution.ui.ConsoleView; 4 | import com.intellij.openapi.actionSystem.DataKey; 5 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 6 | import com.shuzijun.leetcode.plugin.window.NavigatorTabsPanel; 7 | 8 | /** 9 | * @author shuzijun 10 | */ 11 | public class DataKeys { 12 | 13 | public static final DataKey LEETCODE_CONSOLE_VIEW = DataKey.create("LEETCODE_CONSOLE_VIEW"); 14 | 15 | public static final DataKey LEETCODE_PROJECTS_TABS = DataKey.create("LEETCODE_PROJECTS_TABS"); 16 | 17 | public static final DataKey LEETCODE_PROJECTS_NAVIGATORACTION = DataKey.create("LEETCODE_PROJECTS_NAVIGATORACTION"); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/HttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class HttpResponse { 7 | private int statusCode; 8 | 9 | private String body; 10 | 11 | private String url; 12 | 13 | public int getStatusCode() { 14 | return statusCode; 15 | } 16 | 17 | public void setStatusCode(int statusCode) { 18 | this.statusCode = statusCode; 19 | } 20 | 21 | public String getBody() { 22 | return body; 23 | } 24 | 25 | public void setBody(String body) { 26 | this.body = body; 27 | } 28 | 29 | public String getUrl() { 30 | return url; 31 | } 32 | 33 | public void setUrl(String url) { 34 | this.url = url; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/icons/donate_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/CodeSnippet.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class CodeSnippet { 7 | 8 | private String code; 9 | 10 | private String lang; 11 | 12 | private String langSlug; 13 | 14 | public String getCode() { 15 | return code; 16 | } 17 | 18 | public void setCode(String code) { 19 | this.code = code; 20 | } 21 | 22 | public String getLang() { 23 | return lang; 24 | } 25 | 26 | public void setLang(String lang) { 27 | this.lang = lang; 28 | } 29 | 30 | public String getLangSlug() { 31 | return langSlug; 32 | } 33 | 34 | public void setLangSlug(String langSlug) { 35 | this.langSlug = langSlug; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/graphql/problemsetQuestionList.graphql: -------------------------------------------------------------------------------- 1 | query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) { 2 | problemsetQuestionList: questionList( 3 | categorySlug: $categorySlug 4 | limit: $limit 5 | skip: $skip 6 | filters: $filters 7 | ) { 8 | total: totalNum 9 | questions: data { 10 | acRate 11 | difficulty 12 | freqBar 13 | frontendQuestionId: questionFrontendId 14 | paidOnly: isPaidOnly 15 | status 16 | title 17 | titleSlug 18 | topicTags { 19 | name 20 | id 21 | slug 22 | } 23 | hasSolution 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | # libraries 3 | junit = "4.13.2" 4 | opentest4j = "1.3.0" 5 | 6 | # plugins 7 | changelog = "2.4.0" 8 | intelliJPlatform = "2.7.1" 9 | kotlin = "2.2.0" 10 | kover = "0.9.1" 11 | qodana = "2025.1.1" 12 | 13 | [libraries] 14 | junit = { group = "junit", name = "junit", version.ref = "junit" } 15 | opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "opentest4j" } 16 | 17 | [plugins] 18 | changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } 19 | intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" } 20 | kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 21 | kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } 22 | qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } -------------------------------------------------------------------------------- /src/main/resources/graphql/questionSolutionArticles.graphql: -------------------------------------------------------------------------------- 1 | query questionSolutionArticles($questionSlug: String!, $skip: Int, $first: Int, $orderBy: SolutionArticleOrderBy, $userInput: String, $tagSlugs: [String!]) { 2 | questionSolutionArticles(questionSlug: $questionSlug, skip: $skip, first: $first, orderBy: $orderBy, userInput: $userInput, tagSlugs: $tagSlugs) { 3 | totalNum 4 | edges { 5 | node { 6 | ...solutionArticle 7 | __typename 8 | } 9 | __typename 10 | } 11 | __typename 12 | } 13 | } 14 | 15 | fragment solutionArticle on SolutionArticleNode { 16 | uuid 17 | title 18 | slug 19 | status 20 | identifier 21 | tags { 22 | name 23 | } 24 | summary 25 | hitCount 26 | __typename 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/graphql/questionSolutionArticles_cn.graphql: -------------------------------------------------------------------------------- 1 | query questionSolutionArticles($questionSlug: String!, $skip: Int, $first: Int, $orderBy: SolutionArticleOrderBy, $userInput: String, $tagSlugs: [String!]) { 2 | questionSolutionArticles(questionSlug: $questionSlug, skip: $skip, first: $first, orderBy: $orderBy, userInput: $userInput, tagSlugs: $tagSlugs) { 3 | totalNum 4 | edges { 5 | node { 6 | ...solutionArticle 7 | __typename 8 | } 9 | __typename 10 | } 11 | __typename 12 | } 13 | } 14 | 15 | fragment solutionArticle on SolutionArticleNode { 16 | uuid 17 | title 18 | slug 19 | status 20 | identifier 21 | tags { 22 | name 23 | } 24 | summary 25 | hitCount 26 | __typename 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/CodeTopURLUtils.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class CodeTopURLUtils { 7 | 8 | public static final String codetop = "codetop.cc" ; 9 | 10 | private static String codetopUrl = "https://" ; 11 | 12 | private static String tags = "/api/tags/" ; 13 | private static String companies = "/api/companies/" ; 14 | 15 | private static String questions = "/api/questions/"; 16 | 17 | public static String getTags() { 18 | return codetopUrl + codetop + tags; 19 | } 20 | 21 | public static String getCompanies(){ 22 | return codetopUrl + codetop + companies; 23 | } 24 | 25 | public static String getQuestions() { 26 | return codetopUrl + codetop + questions; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/graphql/problemsetQuestionList_cn.graphql: -------------------------------------------------------------------------------- 1 | query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) { 2 | problemsetQuestionList( 3 | categorySlug: $categorySlug 4 | limit: $limit 5 | skip: $skip 6 | filters: $filters 7 | ) { 8 | hasMore 9 | total 10 | questions { 11 | acRate 12 | difficulty 13 | freqBar 14 | frontendQuestionId 15 | paidOnly 16 | solutionNum 17 | status 18 | title 19 | titleCn 20 | titleSlug 21 | topicTags { 22 | name 23 | nameTranslated 24 | id 25 | slug 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/graphql/submissionDetail_cn.graphql: -------------------------------------------------------------------------------- 1 | query submissionDetail($id: ID!) { 2 | submissionDetail(submissionId: $id) { 3 | id 4 | code 5 | runtime 6 | memory 7 | statusDisplay 8 | timestamp 9 | lang 10 | passedTestCaseCnt 11 | totalTestCaseCnt 12 | sourceUrl 13 | question { 14 | titleSlug 15 | title 16 | translatedTitle 17 | questionId 18 | __typename 19 | } 20 | ... on GeneralSubmissionNode { 21 | outputDetail { 22 | codeOutput 23 | expectedOutput 24 | input 25 | compileError 26 | runtimeError 27 | lastTestcase 28 | __typename 29 | } 30 | __typename 31 | } 32 | __typename 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/resources/graphql/questionData.graphql: -------------------------------------------------------------------------------- 1 | query questionData($titleSlug: String!) { 2 | question(titleSlug: $titleSlug) { 3 | questionId 4 | questionFrontendId 5 | title 6 | titleSlug 7 | content 8 | translatedTitle 9 | translatedContent 10 | isPaidOnly 11 | difficulty 12 | likes 13 | dislikes 14 | isLiked 15 | exampleTestcases 16 | topicTags { 17 | name 18 | slug 19 | translatedName 20 | } 21 | codeSnippets { 22 | lang 23 | langSlug 24 | code 25 | } 26 | hints 27 | solution { 28 | id 29 | canSeeDetail 30 | } 31 | status 32 | sampleTestCase 33 | judgerAvailable 34 | judgeType 35 | mysqlSchemas 36 | libraryUrl 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/ShowNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.editor.ConvergePreview; 5 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class ShowNoteAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | if (config.getConvergeEditor() && openConvergeEditor(anActionEvent, new ConvergePreview.TabSelectFileEditorState("Note"))) { 17 | return; 18 | } 19 | NoteManager.show(question.getTitleSlug(), anActionEvent.getProject(), true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/ColorListener.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.ui.ColorPicker; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.MouseAdapter; 8 | import java.awt.event.MouseEvent; 9 | 10 | /** 11 | * @author shuzijun 12 | */ 13 | public class ColorListener extends MouseAdapter { 14 | private JLabel label; 15 | private JPanel mainPanel; 16 | 17 | public ColorListener(JPanel mainPanel,JLabel label) { 18 | this.mainPanel = mainPanel; 19 | this.label = label; 20 | } 21 | 22 | @Override 23 | public void mouseClicked(MouseEvent e) { 24 | Color newColor = ColorPicker.showDialog(mainPanel, label.getText()+" Color", label.getForeground(), true, null, true); 25 | if(newColor!=null){ 26 | label.setForeground(newColor); 27 | } 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/graphql/submissionDetail.graphql: -------------------------------------------------------------------------------- 1 | query submissionDetails($id: Int!) { 2 | submissionDetails(submissionId: $id) { 3 | runtime 4 | runtimeDisplay 5 | runtimePercentile 6 | runtimeDistribution 7 | memory 8 | memoryDisplay 9 | memoryPercentile 10 | memoryDistribution 11 | code 12 | timestamp 13 | statusCode 14 | user { 15 | username 16 | profile { 17 | realName 18 | userAvatar 19 | } 20 | } 21 | lang { 22 | name 23 | verboseName 24 | } 25 | question { 26 | questionId 27 | } 28 | notes 29 | topicTags { 30 | tagId 31 | slug 32 | name 33 | } 34 | runtimeError 35 | compileError 36 | lastTestcase 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/resources/icons/show.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/show_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/question.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/question_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/share.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/ResetTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class ResetTimeAction extends AbstractTreeAction { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 16 | if (timerBarWidget != null) { 17 | timerBarWidget.reset(); 18 | } else { 19 | //For possible reasons, the IDE version is not supported 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/icons/share_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/StopTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class StopTimeAction extends AbstractTreeAction { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 16 | if (timerBarWidget != null) { 17 | timerBarWidget.stopTimer(); 18 | } else { 19 | //For possible reasons, the IDE version is not supported 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/ResetTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class ResetTimeAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 17 | if (timerBarWidget != null) { 18 | timerBarWidget.reset(); 19 | } else { 20 | //For possible reasons, the IDE version is not supported 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/StopTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class StopTimeAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 17 | if (timerBarWidget != null) { 18 | timerBarWidget.stopTimer(); 19 | } else { 20 | //For possible reasons, the IDE version is not supported 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/PullNoteAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.shuzijun.leetcode.plugin.editor.ConvergePreview; 5 | import com.shuzijun.leetcode.plugin.manager.NoteManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class PullNoteAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | NoteManager.pull(question.getTitleSlug(), anActionEvent.getProject()); 17 | if (config.getConvergeEditor() && openConvergeEditor(anActionEvent, new ConvergePreview.TabSelectFileEditorState("Note"))) { 18 | return; 19 | } 20 | NoteManager.show(question.getTitleSlug(), anActionEvent.getProject(), true); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/StartTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class StartTimeAction extends AbstractTreeAction { 13 | @Override 14 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 15 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 16 | if (timerBarWidget != null) { 17 | timerBarWidget.startTimer(question.getTitle()); 18 | } else { 19 | //For possible reasons, the IDE version is not supported 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/StartTimeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.wm.WindowManager; 5 | import com.shuzijun.leetcode.plugin.model.Config; 6 | import com.shuzijun.leetcode.plugin.model.Question; 7 | import com.shuzijun.leetcode.plugin.timer.TimerBarWidget; 8 | 9 | /** 10 | * @author shuzijun 11 | */ 12 | public class StartTimeAction extends AbstractEditAction { 13 | 14 | @Override 15 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 16 | TimerBarWidget timerBarWidget = (TimerBarWidget) WindowManager.getInstance().getStatusBar(anActionEvent.getProject()).getWidget(TimerBarWidget.ID); 17 | if (timerBarWidget != null) { 18 | timerBarWidget.startTimer(question.getTitle()); 19 | } else { 20 | //For possible reasons, the IDE version is not supported 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/OpenContentAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.Project; 5 | import com.shuzijun.leetcode.plugin.editor.ConvergePreview; 6 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 7 | import com.shuzijun.leetcode.plugin.model.Config; 8 | import com.shuzijun.leetcode.plugin.model.Question; 9 | 10 | /** 11 | * @author shuzijun 12 | */ 13 | public class OpenContentAction extends AbstractEditAction { 14 | 15 | @Override 16 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 17 | if (config.getConvergeEditor() && openConvergeEditor(anActionEvent, new ConvergePreview.TabSelectFileEditorState("Content"))) { 18 | return; 19 | } 20 | Project project = anActionEvent.getProject(); 21 | CodeManager.openContent(question.getTitleSlug(), project, true); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/icons/time.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/RefreshAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.DumbAware; 5 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 6 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 7 | import com.shuzijun.leetcode.plugin.model.Config; 8 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 9 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 10 | 11 | /** 12 | * @author shuzijun 13 | */ 14 | public class RefreshAction extends AbstractAction implements DumbAware { 15 | @Override 16 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 17 | 18 | NavigatorAction navigatorAction = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_NAVIGATORACTION); 19 | navigatorAction.getFind().operationType(""); 20 | navigatorAction.findClear(); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/icons/time_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/collapse.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/collapse_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/FindClearAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 7 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 8 | import com.shuzijun.leetcode.plugin.model.Config; 9 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 10 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class FindClearAction extends AbstractAction implements DumbAware { 16 | 17 | @Override 18 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 19 | 20 | NavigatorAction navigatorAction = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_NAVIGATORACTION); 21 | if (navigatorAction == null) { 22 | return; 23 | } 24 | navigatorAction.findClear(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /doc/LoginHelp_ZH.md: -------------------------------------------------------------------------------- 1 | # 登录配置 2 | - [English Document](https://github.com/shuzijun/leetcode-editor/blob/master/doc/LoginHelp.md) 3 | - [中文文档](#登录配置) 4 | 登录方式:配置用户名密码登录,cookie登录,浏览器登录 5 | ## 用户名密码登录 6 | 在leetcode插件配置页配置用户名密码,如登录失败将加载下面两种登录方式,此方式仅支持leetcode.cn 7 | ## cookie登录 8 | 首先在浏览器中登录leetcode,打开浏览器控制台,复制cookie到登录弹出框,点击login.[参考](https://developers.google.com/web/tools/chrome-devtools/network?hl=zh_cn) 9 |

10 | browserCookie 11 |

12 |

13 | cookieLogin 14 |

15 | 16 | ## 浏览器登录 17 | ~~此登录需要额外下载依赖文件,在地址[releases](https://github.com/shuzijun/leetcode-editor/releases)下载版号带有**jcef**的压缩包,~~ 18 | ~~下载后,解压到配置页展示的JCEFFilePath的路径中。~~ 19 | ~~如路径中存在资源文件,将首先使用此登录方式,但此方式兼容性差,如不能正常加载,需删除文件夹下内容,使用其他方式登录。~~ 20 | 从版本6.8开始,不再支持外部挂载JCEF,改用JetBrains提供的JCEF,支持版本为2020.2+,如果满足使用条件,可以在配置项中勾选JCEF 21 | -------------------------------------------------------------------------------- /src/main/resources/template/codeTopTip.txt: -------------------------------------------------------------------------------- 1 | You are browsing "CodeTop Problem List" window.The data is from CodeTop. 2 | Click {0} to open the CodeTop webpage for more functions. 3 | For first-time installation, Click {1} to configure the plugin. 4 | Click {2} to load questions,Click {3} to switch to other windows. 5 | 6 | Toolbar introduction: 7 | {4} Log in LeetCode,Sync Problems status.(The login accounts of the two websites are not interoperable, users need to reconfigure while switching the corresponding websites.) 8 | {5} Log out. (Exit the current account, if you encounter a login error, try to exit first.) 9 | {6} Load or refresh problems. (You still could refresh or load questions even if you are not logged in, but you could not submit the answer.) 10 | {7} Open filter panel. (You can filter and sort.) 11 | {8} Open the CodeTop webpage 12 | {9} Switch to other list windows, including "All Problem List" , "Paginated Problem List" , "CodeTop Problem List". 13 | {10} Open configuration panel. 14 | {11} Clear all problem cache files. 15 | {12} Open help page. -------------------------------------------------------------------------------- /src/main/resources/icons/find.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/doc/CleanExtensions.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils.doc; 2 | 3 | import com.vladsch.flexmark.formatter.Formatter; 4 | import com.vladsch.flexmark.parser.Parser; 5 | import com.vladsch.flexmark.util.data.MutableDataHolder; 6 | 7 | /** 8 | * @author shuzijun 9 | */ 10 | public class CleanExtensions implements Formatter.FormatterExtension, Parser.ParserExtension { 11 | 12 | public static CleanExtensions create() { 13 | return new CleanExtensions(); 14 | } 15 | 16 | @Override 17 | public void rendererOptions(MutableDataHolder mutableDataHolder) { 18 | 19 | } 20 | 21 | @Override 22 | public void extend(Formatter.Builder builder) { 23 | builder.nodeFormatterFactory(new CleanNodeFormatter.Factory()); 24 | } 25 | 26 | @Override 27 | public void parserOptions(MutableDataHolder options) { 28 | 29 | } 30 | 31 | @Override 32 | public void extend(Parser.Builder parserBuilder) { 33 | parserBuilder.customDelimiterProcessor(new InlineLaTexProcessor()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/icons/find_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/Sort.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class Sort { 7 | 8 | private String slug; 9 | private String name; 10 | private int type = 0; 11 | 12 | public Sort(String name,String slug) { 13 | this.slug = slug; 14 | } 15 | 16 | public Sort(String slug, int type) { 17 | this.slug = slug; 18 | this.type = type; 19 | } 20 | 21 | public String getSlug() { 22 | return slug; 23 | } 24 | 25 | public void setSlug(String slug) { 26 | this.slug = slug; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | public int operationType() { 38 | this.type = this.type + 1; 39 | return this.type % 3; 40 | } 41 | 42 | public void resetType() { 43 | this.type = 0; 44 | } 45 | 46 | public int getType() { 47 | return this.type % 3; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/PickAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.DumbAware; 5 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 6 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 7 | import com.shuzijun.leetcode.plugin.manager.ViewManager; 8 | import com.shuzijun.leetcode.plugin.model.Config; 9 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 10 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class PickAction extends AbstractAction implements DumbAware { 16 | private int i = 0; 17 | 18 | @Override 19 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 20 | NavigatorAction navigatorAction = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_NAVIGATORACTION); 21 | ViewManager.pick(anActionEvent.getProject(), navigatorAction.getPageInfo()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/page/AbstractPageAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar.page; 2 | 3 | import com.intellij.openapi.actionSystem.AnAction; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 7 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 8 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 9 | 10 | /** 11 | * @author shuzijun 12 | */ 13 | public abstract class AbstractPageAction extends AnAction implements DumbAware { 14 | 15 | @Override 16 | public void actionPerformed(AnActionEvent anActionEvent) { 17 | 18 | NavigatorAction navigatorAction = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_NAVIGATORACTION); 19 | if (navigatorAction == null) { 20 | return; 21 | } 22 | 23 | actionPerformed(anActionEvent, navigatorAction); 24 | } 25 | 26 | public abstract void actionPerformed(AnActionEvent anActionEvent, NavigatorAction navigatorAction); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/Solution.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class Solution { 7 | 8 | /** 9 | * 标题 10 | */ 11 | private String title; 12 | /** 13 | * 标识 14 | */ 15 | private String slug; 16 | /** 17 | * 标签 18 | */ 19 | private String tags; 20 | /** 21 | * 概况 22 | */ 23 | private String summary; 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public void setTitle(String title) { 30 | this.title = title; 31 | } 32 | 33 | public String getSlug() { 34 | return slug; 35 | } 36 | 37 | public void setSlug(String slug) { 38 | this.slug = slug; 39 | } 40 | 41 | public String getTags() { 42 | return tags; 43 | } 44 | 45 | public void setTags(String tags) { 46 | this.tags = tags; 47 | } 48 | 49 | public String getSummary() { 50 | return summary; 51 | } 52 | 53 | public void setSummary(String summary) { 54 | this.summary = summary; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/template/allTip.txt: -------------------------------------------------------------------------------- 1 | You are browsing "All Problem List" window. 2 | For first-time installation, Click {0} to configure the plugin. 3 | Click {1} or {2} to load questions,Click {3} to switch to other windows. 4 | 5 | Toolbar introduction: 6 | {4} Log in. (The login accounts of the two websites are not interoperable, users need to reconfigure while switching the corresponding websites.) 7 | {5} Log out. (Exit the current account, if you encounter a login error, try to exit first.) 8 | {6} Load or refresh problems. (You still could refresh or load questions even if you are not logged in, but you could not submit the answer.) 9 | {7} Open a problem randomly. 10 | {8} Open filter panel. (You can search, filter and sort.) 11 | {9} Based on the current editor content, locate the position of the corresponding problem in the list. 12 | {10} Open the Session panel. (You can view or switch sessions.) 13 | {11} Switch to other list windows, including "All Problem List" , "Paginated Problem List" , "CodeTop Problem List". 14 | {12} Open configuration panel. 15 | {13} Clear all problem cache files. 16 | {14} Open help page. -------------------------------------------------------------------------------- /src/main/resources/template/pageTip.txt: -------------------------------------------------------------------------------- 1 | You are browsing "Paginated Problem List" window. 2 | For first-time installation, Click {0} to configure the plugin. 3 | Click {1} or {2} to load questions,Click {3} to switch to other windows. 4 | 5 | Toolbar introduction: 6 | {4} Log in. (The login accounts of the two websites are not interoperable, users need to reconfigure while switching the corresponding websites.) 7 | {5} Log out. (Exit the current account, if you encounter a login error, try to exit first.) 8 | {6} Load or refresh problems. (You still could refresh or load questions even if you are not logged in, but you could not submit the answer.) 9 | {7} Open a problem randomly. 10 | {8} Open filter panel. (You can search, filter and sort.) 11 | {9} Based on the current editor content, locate the position of the corresponding problem in the list. 12 | {10} Open the Session panel. (You can view or switch sessions.) 13 | {11} Switch to other list windows, including "All Problem List" , "Paginated Problem List" , "CodeTop Problem List". 14 | {12} Open configuration panel. 15 | {13} Clear all problem cache files. 16 | {14} Open help page. -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/ToggleListAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.application.ApplicationManager; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 7 | import com.shuzijun.leetcode.plugin.model.Config; 8 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 9 | import com.shuzijun.leetcode.plugin.window.NavigatorTabsPanel; 10 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class ToggleListAction extends AbstractAction implements DumbAware { 16 | @Override 17 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 18 | NavigatorTabsPanel navigatorTabs = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_TABS); 19 | if (navigatorTabs == null) { 20 | return; 21 | } 22 | ApplicationManager.getApplication().invokeLater(() -> navigatorTabs.toggle()); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/icons/edit_doc.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/edit_doc_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/position.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/position_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/LCVFileType.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor; 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType; 4 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 5 | import icons.LeetCodeEditorIcons; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import javax.swing.*; 10 | 11 | public class LCVFileType extends LanguageFileType { 12 | public static final LCVFileType INSTANCE = new LCVFileType(); 13 | 14 | private LCVFileType() { 15 | super(LCVLanguage.INSTANCE); 16 | } 17 | 18 | @NotNull 19 | @Override 20 | public String getName() { 21 | return PluginConstant.LEETCODE_EDITOR_VIEW+"Doc"; 22 | } 23 | 24 | @NotNull 25 | @Override 26 | public String getDescription() { 27 | return PluginConstant.LEETCODE_EDITOR_VIEW; 28 | } 29 | 30 | @NotNull 31 | @Override 32 | public String getDefaultExtension() { 33 | return PluginConstant.LEETCODE_EDITOR_VIEW; 34 | } 35 | 36 | @Nullable 37 | @Override 38 | public Icon getIcon() { 39 | return LeetCodeEditorIcons.LCV; 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/doc/InlineLaTexNode.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils.doc; 2 | 3 | import com.vladsch.flexmark.ast.DelimitedNodeImpl; 4 | import com.vladsch.flexmark.parser.core.delimiter.Delimiter; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class InlineLaTexNode extends DelimitedNodeImpl { 10 | 11 | public static final String HTML_TEX = "LaTex"; 12 | 13 | public static final String TOKEN_OPEN = "$"; 14 | public static final String TOKEN_CLOSE = "$"; 15 | 16 | private final String mOpener; 17 | private final String mCloser; 18 | 19 | public InlineLaTexNode(final Delimiter opener, final Delimiter closer) { 20 | mOpener = getDelimiter(opener); 21 | mCloser = getDelimiter(closer); 22 | } 23 | 24 | public String getOpeningDelimiter() { 25 | return mOpener; 26 | } 27 | 28 | public String getClosingDelimiter() { 29 | return mCloser; 30 | } 31 | 32 | private String getDelimiter(final Delimiter delimiter) { 33 | return delimiter.getInput().subSequence( 34 | delimiter.getStartIndex(), delimiter.getEndIndex() 35 | ).toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/icons/logout.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/logout_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/Tag.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | /** 7 | * @author shuzijun 8 | */ 9 | public class Tag { 10 | 11 | private String slug; 12 | private String name; 13 | private String type; 14 | private boolean isSelect = false; 15 | private Set questions = new HashSet<>(); 16 | 17 | public String getSlug() { 18 | return slug; 19 | } 20 | 21 | public void setSlug(String slug) { 22 | this.slug = slug; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getType() { 34 | return type; 35 | } 36 | 37 | public void setType(String type) { 38 | this.type = type; 39 | } 40 | 41 | public boolean isSelect() { 42 | return isSelect; 43 | } 44 | 45 | public void setSelect(boolean select) { 46 | isSelect = select; 47 | } 48 | 49 | public Set getQuestions() { 50 | return questions; 51 | } 52 | 53 | public void addQuestion(String questionId) { 54 | questions.add(questionId); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/icons/help.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/help_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/login.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/MenuItem.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | import java.awt.event.MouseEvent; 4 | 5 | /** 6 | * @author shuzijun 7 | */ 8 | public class MenuItem { 9 | 10 | private String title; 11 | 12 | private Object object; 13 | 14 | private Runnable runnable; 15 | 16 | private MouseEvent e; 17 | 18 | public MenuItem(String title, Runnable runnable) { 19 | this.title = title; 20 | this.object = object; 21 | this.runnable = runnable; 22 | } 23 | 24 | public String getTitle() { 25 | return title; 26 | } 27 | 28 | public void setTitle(String title) { 29 | this.title = title; 30 | } 31 | 32 | public Object getObject() { 33 | return object; 34 | } 35 | 36 | public void setObject(Object object) { 37 | this.object = object; 38 | } 39 | 40 | public Runnable getRunnable() { 41 | return runnable; 42 | } 43 | 44 | public void setRunnable(Runnable runnable) { 45 | this.runnable = runnable; 46 | } 47 | 48 | public MouseEvent getE() { 49 | return e; 50 | } 51 | 52 | public void setE(MouseEvent e) { 53 | this.e = e; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return title; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/icons/login_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/SupportCheck.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.notification.Notification; 4 | import com.intellij.notification.NotificationType; 5 | import com.intellij.notification.Notifications; 6 | import com.intellij.openapi.application.ApplicationManager; 7 | import com.intellij.openapi.project.DumbAware; 8 | import com.intellij.openapi.project.Project; 9 | import com.intellij.openapi.startup.StartupActivity; 10 | import com.intellij.ui.jcef.JBCefApp; 11 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | /** 15 | * @author shuzijun 16 | */ 17 | public class SupportCheck implements StartupActivity, DumbAware { 18 | 19 | public static boolean isFirstProject = true; 20 | 21 | @Override 22 | public void runActivity(@NotNull Project project) { 23 | if (ApplicationManager.getApplication().isUnitTestMode() || !isFirstProject ) { 24 | return; 25 | } 26 | if(!JBCefApp.isSupported()){ 27 | Notifications.Bus.notify(new Notification(PluginConstant.NOTIFICATION_GROUP, "Not Support JCEF", "Your environment does not support JCEF, cannot use LeetCode Editor.Check the Registry 'ide.browser.jcef.enabled'.", NotificationType.ERROR)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/toolbar/LogoutAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.toolbar; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.application.ApplicationManager; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 7 | import com.shuzijun.leetcode.plugin.listener.LoginNotifier; 8 | import com.shuzijun.leetcode.plugin.model.Config; 9 | import com.shuzijun.leetcode.plugin.model.HttpRequest; 10 | import com.shuzijun.leetcode.plugin.utils.*; 11 | import com.shuzijun.leetcode.plugin.window.NavigatorTabsPanel; 12 | 13 | /** 14 | * @author shuzijun 15 | */ 16 | public class LogoutAction extends AbstractAction implements DumbAware { 17 | @Override 18 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 19 | 20 | HttpResponse httpResponse = HttpRequest.builderGet(URLUtils.getLeetcodeLogout()).request(); 21 | HttpRequestUtils.resetHttpclient(); 22 | MessageUtils.getInstance(anActionEvent.getProject()).showInfoMsg("info", PropertiesUtils.getInfo("login.out")); 23 | NavigatorTabsPanel.loadUser(false); 24 | ApplicationManager.getApplication().getMessageBus().syncPublisher(LoginNotifier.TOPIC).logout(anActionEvent.getProject(), config.getUrl()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/EditorMenuActionGroup.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.ActionUpdateThread; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.actionSystem.DefaultActionGroup; 6 | import com.intellij.openapi.actionSystem.PlatformDataKeys; 7 | import com.intellij.openapi.vfs.VirtualFile; 8 | import com.shuzijun.leetcode.plugin.model.LeetcodeEditor; 9 | import com.shuzijun.leetcode.plugin.setting.ProjectConfig; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class EditorMenuActionGroup extends DefaultActionGroup { 16 | 17 | @Override 18 | public void update(AnActionEvent e) { 19 | VirtualFile vf = e.getData(PlatformDataKeys.VIRTUAL_FILE); 20 | boolean menuAllowed = false; 21 | if (vf != null) { 22 | LeetcodeEditor leetcodeEditor = ProjectConfig.getInstance(e.getProject()).getEditor(vf.getPath()); 23 | if (leetcodeEditor != null) { 24 | menuAllowed = true; 25 | } 26 | } 27 | e.getPresentation().setEnabledAndVisible(menuAllowed); 28 | } 29 | 30 | @Override 31 | public @NotNull ActionUpdateThread getActionUpdateThread() { 32 | return ActionUpdateThread.BGT; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/Submission.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class Submission { 7 | 8 | private String id; 9 | private String time; 10 | private String status; 11 | private String runtime; 12 | private String memory; 13 | private String lang; 14 | 15 | public String getId() { 16 | return id; 17 | } 18 | 19 | public void setId(String id) { 20 | this.id = id; 21 | } 22 | 23 | public String getTime() { 24 | return time; 25 | } 26 | 27 | public void setTime(String time) { 28 | this.time = time; 29 | } 30 | 31 | public String getStatus() { 32 | return status; 33 | } 34 | 35 | public void setStatus(String status) { 36 | this.status = status; 37 | } 38 | 39 | public String getRuntime() { 40 | return runtime; 41 | } 42 | 43 | public void setRuntime(String runtime) { 44 | this.runtime = runtime; 45 | } 46 | 47 | public String getMemory() { 48 | return memory; 49 | } 50 | 51 | public void setMemory(String memory) { 52 | this.memory = memory; 53 | } 54 | 55 | public String getLang() { 56 | return lang; 57 | } 58 | 59 | public void setLang(String lang) { 60 | this.lang = lang; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/doc/CleanMarkdown.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils.doc; 2 | 3 | import com.vladsch.flexmark.ext.attributes.AttributesExtension; 4 | import com.vladsch.flexmark.formatter.Formatter; 5 | import com.vladsch.flexmark.parser.Parser; 6 | import com.vladsch.flexmark.util.ast.Node; 7 | import com.vladsch.flexmark.util.data.DataHolder; 8 | import com.vladsch.flexmark.util.data.MutableDataSet; 9 | 10 | import java.util.Arrays; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class CleanMarkdown { 16 | final private static DataHolder OPTIONS = new MutableDataSet() 17 | .set(Parser.EXTENSIONS, Arrays.asList(CleanExtensions.create(), AttributesExtension.create())) 18 | .set(Parser.LISTS_AUTO_LOOSE, false) 19 | .toImmutable(); 20 | 21 | static final Parser PARSER = Parser.builder(OPTIONS).build(); 22 | static final Formatter RENDERER = Formatter.builder(OPTIONS).build(); 23 | 24 | public static String cleanMarkdown(String markdown, String host) { 25 | try { 26 | CleanNodeFormatter.getThreadDataHolder().set(CleanNodeFormatter.FORMAT_HOST, host); 27 | Node document = PARSER.parse(markdown); 28 | return RENDERER.render(document); 29 | } finally { 30 | CleanNodeFormatter.removeThreadDataHolder(); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/ErrorReportHandler.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.diagnostic.AbstractMessage; 4 | import com.intellij.openapi.diagnostic.ErrorReportSubmitter; 5 | import com.intellij.openapi.diagnostic.IdeaLoggingEvent; 6 | import com.intellij.util.Consumer; 7 | import com.shuzijun.leetcode.plugin.utils.PropertiesUtils; 8 | import com.shuzijun.leetcode.plugin.utils.SentryUtils; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.awt.*; 13 | 14 | /** 15 | * @author shuzijun 16 | */ 17 | public class ErrorReportHandler extends ErrorReportSubmitter { 18 | @NotNull 19 | @Override 20 | public String getReportActionText() { 21 | return PropertiesUtils.getInfo("report"); 22 | } 23 | 24 | @Override 25 | public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer consumer) { 26 | for (IdeaLoggingEvent event : events) { 27 | Throwable throwable = event.getThrowable(); 28 | if (event.getData() instanceof AbstractMessage) { 29 | throwable = ((AbstractMessage) event.getData()).getThrowable(); 30 | } 31 | 32 | SentryUtils.submitErrorReport(throwable, additionalInfo); 33 | } 34 | 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/LCVProvider.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor; 2 | 3 | import com.intellij.openapi.fileEditor.FileEditor; 4 | import com.intellij.openapi.fileEditor.FileEditorPolicy; 5 | import com.intellij.openapi.fileEditor.WeighedFileEditorProvider; 6 | import com.intellij.openapi.fileTypes.FileType; 7 | import com.intellij.openapi.project.Project; 8 | import com.intellij.openapi.vfs.VirtualFile; 9 | import com.intellij.ui.jcef.JBCefApp; 10 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | /** 14 | * @author shuzijun 15 | */ 16 | public class LCVProvider extends WeighedFileEditorProvider { 17 | 18 | 19 | @Override 20 | public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { 21 | FileType fileType = file.getFileType(); 22 | return fileType == LCVFileType.INSTANCE && JBCefApp.isSupported(); 23 | } 24 | 25 | @Override 26 | public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { 27 | return new LCVPreview(project, file); 28 | } 29 | 30 | @Override 31 | public @NotNull String getEditorTypeId() { 32 | return PluginConstant.LEETCODE_EDITOR_VIEW + " view"; 33 | } 34 | 35 | @Override 36 | public @NotNull FileEditorPolicy getPolicy() { 37 | return FileEditorPolicy.HIDE_DEFAULT_EDITOR; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/icons/refresh.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/refresh_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/solution.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/solution_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/icons/desc.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/timer/TimerStatusBarWidgetProvider.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.timer; 2 | 3 | import com.intellij.openapi.project.Project; 4 | import com.intellij.openapi.wm.StatusBar; 5 | import com.intellij.openapi.wm.StatusBarWidget; 6 | import com.intellij.openapi.wm.StatusBarWidgetFactory; 7 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 8 | import org.jetbrains.annotations.Nls; 9 | import org.jetbrains.annotations.NonNls; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | 13 | /** 14 | * @author shuzijun 15 | */ 16 | public class TimerStatusBarWidgetProvider implements StatusBarWidgetFactory { 17 | 18 | 19 | @Override 20 | public @NonNls @NotNull String getId() { 21 | return PluginConstant.LEETCODE_EDITOR_TIMER_STATUS_BAR_ID; 22 | } 23 | 24 | @Override 25 | public @Nls @NotNull String getDisplayName() { 26 | return PluginConstant.LEETCODE_EDITOR_TIMER_STATUS_BAR_ID; 27 | } 28 | 29 | @Override 30 | public boolean isAvailable(@NotNull Project project) { 31 | return true; 32 | } 33 | 34 | @Override 35 | public @NotNull StatusBarWidget createWidget(@NotNull Project project) { 36 | return new TimerBarWidget(project); 37 | } 38 | 39 | @Override 40 | public void disposeWidget(@NotNull StatusBarWidget widget) { 41 | } 42 | 43 | @Override 44 | public boolean canBeEnabledOn(@NotNull StatusBar statusBar) { 45 | return true; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/icons/desc_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/Statistics.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class Statistics { 7 | 8 | /** 9 | * 解决 10 | */ 11 | private Integer solvedTotal; 12 | 13 | /** 14 | * 总数 15 | */ 16 | private Integer questionTotal; 17 | 18 | /** 19 | * 难度 20 | */ 21 | private Integer easy; 22 | 23 | /** 24 | * 难度 25 | */ 26 | private Integer medium; 27 | 28 | /** 29 | * 难度 30 | */ 31 | private Integer hard; 32 | 33 | public Integer getSolvedTotal() { 34 | return solvedTotal; 35 | } 36 | 37 | public void setSolvedTotal(Integer solvedTotal) { 38 | this.solvedTotal = solvedTotal; 39 | } 40 | 41 | public Integer getQuestionTotal() { 42 | return questionTotal; 43 | } 44 | 45 | public void setQuestionTotal(Integer questionTotal) { 46 | this.questionTotal = questionTotal; 47 | } 48 | 49 | public Integer getEasy() { 50 | return easy; 51 | } 52 | 53 | public void setEasy(Integer easy) { 54 | this.easy = easy; 55 | } 56 | 57 | public Integer getMedium() { 58 | return medium; 59 | } 60 | 61 | public void setMedium(Integer medium) { 62 | this.medium = medium; 63 | } 64 | 65 | public Integer getHard() { 66 | return hard; 67 | } 68 | 69 | public void setHard(Integer hard) { 70 | this.hard = hard; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/resources/icons/clean_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/converge/SolutionProvider.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor.converge; 2 | 3 | import com.intellij.openapi.fileEditor.FileEditor; 4 | import com.intellij.openapi.fileEditor.FileEditorPolicy; 5 | import com.intellij.openapi.fileEditor.WeighedFileEditorProvider; 6 | import com.intellij.openapi.project.Project; 7 | import com.intellij.openapi.vfs.VirtualFile; 8 | import com.shuzijun.leetcode.plugin.model.LeetcodeEditor; 9 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 10 | import com.shuzijun.leetcode.plugin.setting.ProjectConfig; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | /** 14 | * @author shuzijun 15 | */ 16 | public class SolutionProvider extends WeighedFileEditorProvider { 17 | 18 | 19 | @Override 20 | public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { 21 | return true; 22 | } 23 | 24 | @Override 25 | public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { 26 | LeetcodeEditor leetcodeEditor = ProjectConfig.getInstance(project).getEditor(file.getPath()); 27 | return new SolutionPreview(project, leetcodeEditor); 28 | } 29 | 30 | @Override 31 | public @NotNull String getEditorTypeId() { 32 | return PluginConstant.LEETCODE_EDITOR_TAB_VIEW + " Solution view"; 33 | } 34 | 35 | @Override 36 | public @NotNull FileEditorPolicy getPolicy() { 37 | return FileEditorPolicy.HIDE_DEFAULT_EDITOR; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/icons/clean.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/converge/SubmissionsProvider.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor.converge; 2 | 3 | import com.intellij.openapi.fileEditor.FileEditor; 4 | import com.intellij.openapi.fileEditor.FileEditorPolicy; 5 | import com.intellij.openapi.fileEditor.WeighedFileEditorProvider; 6 | import com.intellij.openapi.project.Project; 7 | import com.intellij.openapi.vfs.VirtualFile; 8 | import com.shuzijun.leetcode.plugin.model.LeetcodeEditor; 9 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 10 | import com.shuzijun.leetcode.plugin.setting.ProjectConfig; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | /** 14 | * @author shuzijun 15 | */ 16 | public class SubmissionsProvider extends WeighedFileEditorProvider { 17 | 18 | 19 | @Override 20 | public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { 21 | return true; 22 | } 23 | 24 | @Override 25 | public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { 26 | LeetcodeEditor leetcodeEditor = ProjectConfig.getInstance(project).getEditor(file.getPath()); 27 | return new SubmissionsPreview(project, leetcodeEditor); 28 | } 29 | 30 | @Override 31 | public @NotNull String getEditorTypeId() { 32 | return PluginConstant.LEETCODE_EDITOR_TAB_VIEW + " Submissions view"; 33 | } 34 | 35 | @Override 36 | public @NotNull FileEditorPolicy getPolicy() { 37 | return FileEditorPolicy.HIDE_DEFAULT_EDITOR; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/editor/converge/ContentProvider.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.editor.converge; 2 | 3 | import com.intellij.openapi.application.ApplicationManager; 4 | import com.intellij.openapi.fileEditor.FileEditor; 5 | import com.intellij.openapi.project.Project; 6 | import com.intellij.openapi.vfs.LocalFileSystem; 7 | import com.intellij.openapi.vfs.VirtualFile; 8 | import com.shuzijun.leetcode.plugin.editor.LCVProvider; 9 | import com.shuzijun.leetcode.plugin.model.LeetcodeEditor; 10 | import com.shuzijun.leetcode.plugin.setting.ProjectConfig; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.io.File; 14 | 15 | /** 16 | * @author shuzijun 17 | */ 18 | public class ContentProvider extends LCVProvider { 19 | 20 | @Override 21 | public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { 22 | return true; 23 | } 24 | 25 | @Override 26 | public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { 27 | LeetcodeEditor leetcodeEditor = ProjectConfig.getInstance(project).getEditor(file.getPath()); 28 | 29 | VirtualFile contentVf; 30 | try { 31 | contentVf = ApplicationManager.getApplication().executeOnPooledThread(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(leetcodeEditor.getContentPath()))).get(); 32 | } catch (Exception e) { 33 | throw new RuntimeException(e); 34 | } 35 | return super.createEditor(project, contentVf); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/icons/LeetCode.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 8 | 9 | 11 | 14 | 17 | 18 | 20 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/icons/LeetCode_dark.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 9 | 10 | 12 | 15 | 18 | 19 | 21 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/workflows/snapshot.yml: -------------------------------------------------------------------------------- 1 | name: Snapshot 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | greet: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | 16 | - name: Set LD_VERSION 17 | run: echo "LD_VERSION=0.0" >> $GITHUB_ENV 18 | 19 | - name: Set up JDK 17 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 17 23 | 24 | - name: Grant execute permission for gradlew 25 | run: chmod +x gradlew 26 | 27 | - name: Build the plugin 28 | run: ./gradlew buildPlugin 29 | env: 30 | LD_VERSION: ${{ env.LD_VERSION }} 31 | 32 | #- name: Verify plugin 33 | # id: verify 34 | # uses: ChrisCarini/intellij-platform-plugin-verifier-action@latest 35 | # with: 36 | # ide-versions: | 37 | # ideaIC:2019.3 38 | # ideaIC:2020.1 39 | # ideaIC:2020.2 40 | # ideaIC:LATEST-EAP-SNAPSHOT 41 | 42 | #- name: Print verify contents 43 | # run: | 44 | # echo "The log file path is: ${{steps.verify.outputs.verification-output-log-filename}}" ; 45 | # cat ${{steps.verify.outputs.verification-output-log-filename}} 46 | 47 | - name: Upload Artifact 48 | uses: actions/upload-artifact@v4 49 | with: 50 | # TODO: This uploads a zip called `distributions`; see what we can do to just upload the produced plugin itself. 51 | name: leetcode-editor-snapshot 52 | path: build/distributions/leetcode-editor-${{ env.LD_VERSION }}.zip 53 | -------------------------------------------------------------------------------- /.github/workflows/monitor-abusive.yml: -------------------------------------------------------------------------------- 1 | name: Monitor Abusive Comments 2 | on: 3 | issue_comment: 4 | # This shouldn't be called for comment deletion 5 | types: 6 | - created 7 | - edited 8 | 9 | jobs: 10 | abuse-monitor: 11 | name: With latest code base 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Handle with Comvent 16 | uses: rytswd/comvent@v0.3 17 | id: comvent 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | config-path: .github/config/comvent-ad.yaml 21 | 22 | # The below only runs when comvent finds matching comment. 23 | # This assumes that comvent config holding 'some-abusive-content' as a keyword. 24 | - if: steps.comvent.outputs.blocked-words != '' 25 | name: Handle some abusive content 26 | uses: actions/github-script@v3 27 | with: 28 | github-token: ${{ secrets.GITHUB_TOKEN }} 29 | # An example of removing the abusive comment, and leaving a comment about the deletion. 30 | script: | 31 | github.issues.deleteComment({ 32 | owner: context.repo.owner, 33 | repo: context.repo.repo, 34 | comment_id: ${{ github.event.comment.id }} 35 | }) 36 | const comment = `Found blocked words! 😰 37 | The comment was thus removed.`; 38 | github.issues.createComment({ 39 | issue_number: context.issue.number, 40 | owner: context.repo.owner, 41 | repo: context.repo.repo, 42 | body: comment 43 | }) 44 | -------------------------------------------------------------------------------- /src/main/resources/icons/clear.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/clear_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/AbstractTreeAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.project.DumbAware; 5 | import com.shuzijun.leetcode.plugin.actions.AbstractAction; 6 | import com.shuzijun.leetcode.plugin.manager.NavigatorAction; 7 | import com.shuzijun.leetcode.plugin.manager.QuestionManager; 8 | import com.shuzijun.leetcode.plugin.model.Config; 9 | import com.shuzijun.leetcode.plugin.model.Question; 10 | import com.shuzijun.leetcode.plugin.model.QuestionView; 11 | import com.shuzijun.leetcode.plugin.utils.DataKeys; 12 | import com.shuzijun.leetcode.plugin.window.WindowFactory; 13 | 14 | /** 15 | * @author shuzijun 16 | */ 17 | public abstract class AbstractTreeAction extends AbstractAction implements DumbAware { 18 | 19 | @Override 20 | public void actionPerformed(AnActionEvent anActionEvent, Config config) { 21 | NavigatorAction navigatorAction = WindowFactory.getDataContext(anActionEvent.getProject()).getData(DataKeys.LEETCODE_PROJECTS_NAVIGATORACTION); 22 | if (navigatorAction == null) { 23 | return; 24 | } 25 | QuestionView questionView = navigatorAction.getSelectedRowData(); 26 | if (questionView == null) { 27 | return; 28 | } 29 | Question question = QuestionManager.getQuestionByTitleSlug(questionView.getTitleSlug(), anActionEvent.getProject()); 30 | if (question == null) { 31 | return; 32 | } 33 | actionPerformed(anActionEvent, config, question); 34 | } 35 | 36 | public abstract void actionPerformed(AnActionEvent anActionEvent, Config config, Question question); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/User.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * @author shuzijun 7 | */ 8 | public class User { 9 | 10 | private String username; 11 | 12 | 13 | private String userSlug; 14 | 15 | private boolean isPremium; 16 | 17 | private boolean isSignedIn = Boolean.FALSE; 18 | 19 | private boolean isVerified; 20 | 21 | private boolean isPhoneVerified; 22 | 23 | public String getUsername() { 24 | return username; 25 | } 26 | 27 | public void setUsername(String username) { 28 | this.username = username; 29 | } 30 | 31 | public String getUserSlug() { 32 | return userSlug; 33 | } 34 | 35 | public void setUserSlug(String userSlug) { 36 | this.userSlug = userSlug; 37 | } 38 | 39 | public boolean isPremium() { 40 | return isPremium; 41 | } 42 | 43 | public void setPremium(Boolean premium) { 44 | isPremium = Objects.requireNonNullElse(premium, false);; 45 | } 46 | 47 | public boolean isVerified() { 48 | return isVerified; 49 | } 50 | 51 | public void setVerified(Boolean verified) { 52 | isVerified = Objects.requireNonNullElse(verified, false); 53 | } 54 | 55 | public boolean isPhoneVerified() { 56 | return isPhoneVerified; 57 | } 58 | 59 | public void setPhoneVerified(Boolean phoneVerified) { 60 | isPhoneVerified = Objects.requireNonNullElse(phoneVerified, false); 61 | } 62 | 63 | public boolean isSignedIn() { 64 | return isSignedIn; 65 | } 66 | 67 | public void setSignedIn(Boolean signedIn) { 68 | isSignedIn = Objects.requireNonNullElse(signedIn, false); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /doc/LoginHelp.md: -------------------------------------------------------------------------------- 1 | # login config 2 | - [中文文档](https://github.com/shuzijun/leetcode-editor/blob/master/doc/LoginHelp_ZH.md) 3 | Login method: Configure username and password login, cookie login, browser login 4 | ## Username password login 5 | Configure the username and password on the configuration page of the leetcode plugin. If the login fails, the following two login methods will be loaded. This method only supports leetcode-cn. 6 | ## cookie login 7 | First log in to leetcode in your browser, open the browser console, copy the cookie to the login popup, and click login.[reference](https://developers.google.com/web/tools/chrome-devtools/network) 8 | 9 |

10 | browserCookie 11 |

12 |

13 | cookieLogin 14 |

15 | 16 | ## browser login 17 | ~~This login requires additional download of dependent files. Download the compressed package with the version number ** jcef ** at the [releases](https://github.com/shuzijun/leetcode-editor/releases) address. After downloading, decompress it to the path of JCEFFilePath shown on the configuration page.~~ 18 | ~~If there is a resource file in the path, this login method will be used first, but this method is not compatible. If it cannot be loaded normally, you need to delete the contents of the folder and log in using other methods.~~ 19 | Starting from version 6.8, external mounting of JCEF is no longer supported. Instead, JCEF provided by JetBrains is used. The supported version is 2020.2+. If you meet the conditions of use, you can check JCEF in the configuration item. -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/listener/JTableKeyAdapter.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.listener; 2 | 3 | import com.intellij.openapi.progress.ProgressIndicator; 4 | import com.intellij.openapi.progress.ProgressManager; 5 | import com.intellij.openapi.progress.Task; 6 | import com.intellij.openapi.project.Project; 7 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 8 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 9 | import com.shuzijun.leetcode.plugin.model.QuestionView; 10 | import com.shuzijun.leetcode.plugin.window.NavigatorTableData; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.awt.event.KeyAdapter; 14 | import java.awt.event.KeyEvent; 15 | 16 | /** 17 | * @author shuzijun 18 | */ 19 | public class JTableKeyAdapter extends KeyAdapter { 20 | 21 | private NavigatorTableData navigatorTable; 22 | private Project project; 23 | 24 | public JTableKeyAdapter(NavigatorTableData navigatorTable, Project project) { 25 | this.navigatorTable = navigatorTable; 26 | this.project = project; 27 | } 28 | 29 | @Override 30 | public void keyTyped(KeyEvent e) { 31 | QuestionView question = navigatorTable.getSelectedRowData(); 32 | if (question != null) { 33 | if (e.getKeyChar() == KeyEvent.VK_ENTER) { 34 | ProgressManager.getInstance().run(new Task.Backgroundable(project, PluginConstant.LEETCODE_EDITOR_OPEN_CODE, false) { 35 | @Override 36 | public void run(@NotNull ProgressIndicator progressIndicator) { 37 | CodeManager.openCode(question.getTitleSlug(), project); 38 | } 39 | }); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/model/LeetcodeEditor.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.model; 2 | 3 | /** 4 | * @author shuzijun 5 | */ 6 | public class LeetcodeEditor { 7 | 8 | private Integer version = 1; 9 | 10 | /** 11 | * file path 12 | */ 13 | private String path; 14 | 15 | /** 16 | * frontendQuestionId 17 | */ 18 | private String frontendQuestionId; 19 | 20 | 21 | /** 22 | * content file path 23 | */ 24 | private String contentPath; 25 | 26 | /** 27 | * titleSlug 28 | */ 29 | private String titleSlug; 30 | 31 | private String host; 32 | 33 | public Integer getVersion() { 34 | return version; 35 | } 36 | 37 | public void setVersion(Integer version) { 38 | this.version = version; 39 | } 40 | 41 | public String getPath() { 42 | return path; 43 | } 44 | 45 | public void setPath(String path) { 46 | this.path = path; 47 | } 48 | 49 | public String getFrontendQuestionId() { 50 | return frontendQuestionId; 51 | } 52 | 53 | public void setFrontendQuestionId(String frontendQuestionId) { 54 | this.frontendQuestionId = frontendQuestionId; 55 | } 56 | 57 | public String getContentPath() { 58 | return contentPath; 59 | } 60 | 61 | public void setContentPath(String contentPath) { 62 | this.contentPath = contentPath; 63 | } 64 | 65 | public String getTitleSlug() { 66 | return titleSlug; 67 | } 68 | 69 | public void setTitleSlug(String titleSlug) { 70 | this.titleSlug = titleSlug; 71 | } 72 | 73 | public String getHost() { 74 | return host; 75 | } 76 | 77 | public void setHost(String host) { 78 | this.host = host; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/utils/VelocityUtils.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.utils; 2 | 3 | import org.apache.velocity.VelocityContext; 4 | import org.apache.velocity.app.VelocityEngine; 5 | import org.apache.velocity.runtime.RuntimeConstants; 6 | 7 | import java.io.StringWriter; 8 | import java.util.Properties; 9 | 10 | /** 11 | * @author shuzijun 12 | */ 13 | public class VelocityUtils { 14 | 15 | private static String VM_LOG_TAG = "Leetcode VelocityUtils"; 16 | private static String VM_CONTEXT = "question"; 17 | private static VelocityEngine engine; 18 | 19 | 20 | static { 21 | engine = new VelocityEngine(); 22 | engine.setProperty(RuntimeConstants.PARSER_POOL_SIZE, 20); 23 | engine.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8"); 24 | //engine.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8"); 25 | 26 | Properties props = new Properties(); 27 | props.put("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.SimpleLog4JLogSystem"); 28 | props.put("runtime.log.logsystem.log4j.category", "velocity"); 29 | props.put("runtime.log.logsystem.log4j.logger", "velocity"); 30 | 31 | engine.init(props); 32 | } 33 | 34 | public static String convert(String template, Object data) { 35 | 36 | StringWriter writer = new StringWriter(); 37 | VelocityContext velocityContext = new VelocityContext(); 38 | velocityContext.put(VM_CONTEXT, data); 39 | velocityContext.put("velocityTool", new VelocityTool()); 40 | velocityContext.put("vt", new VelocityTool()); 41 | boolean isSuccess = engine.evaluate(velocityContext, writer, VM_LOG_TAG, template); 42 | if (!isSuccess) { 43 | 44 | } 45 | return writer.toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/icons/config.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/config_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/config_lc.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/icons/config_lc_dark.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/editor/TestcaseAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.editor; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.application.ApplicationManager; 5 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | import com.shuzijun.leetcode.plugin.utils.MessageUtils; 9 | import com.shuzijun.leetcode.plugin.utils.PropertiesUtils; 10 | import com.shuzijun.leetcode.plugin.window.dialog.TestcasePanel; 11 | import org.apache.commons.lang3.StringUtils; 12 | 13 | import java.util.concurrent.atomic.AtomicReference; 14 | 15 | /** 16 | * @author shuzijun 17 | */ 18 | public class TestcaseAction extends AbstractEditAction { 19 | @Override 20 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 21 | AtomicReference text = new AtomicReference<>(TestcaseAction.class.getName()); 22 | ApplicationManager.getApplication().invokeAndWait(() -> { 23 | TestcasePanel dialog = new TestcasePanel(anActionEvent.getProject(), question); 24 | dialog.setTitle(question.getFormTitle() + " Testcase"); 25 | dialog.setText(question.getTestCase()); 26 | if (dialog.showAndGet()) { 27 | text.set(dialog.testcaseText()); 28 | } 29 | }); 30 | if (!TestcaseAction.class.getName().equals(text.get())) { 31 | if (StringUtils.isBlank(text.get())) { 32 | MessageUtils.getInstance(anActionEvent.getProject()).showWarnMsg("info", PropertiesUtils.getInfo("test.case")); 33 | return; 34 | } else { 35 | question.setTestCase(text.get()); 36 | CodeManager.RunCodeCode(question.getTitleSlug(), anActionEvent.getProject()); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/actions/tree/TestcaseAction.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.actions.tree; 2 | 3 | import com.intellij.openapi.actionSystem.AnActionEvent; 4 | import com.intellij.openapi.application.ApplicationManager; 5 | import com.shuzijun.leetcode.plugin.manager.CodeManager; 6 | import com.shuzijun.leetcode.plugin.model.Config; 7 | import com.shuzijun.leetcode.plugin.model.Question; 8 | import com.shuzijun.leetcode.plugin.utils.MessageUtils; 9 | import com.shuzijun.leetcode.plugin.utils.PropertiesUtils; 10 | import com.shuzijun.leetcode.plugin.window.dialog.TestcasePanel; 11 | import org.apache.commons.lang3.StringUtils; 12 | 13 | import java.util.concurrent.atomic.AtomicReference; 14 | 15 | /** 16 | * @author shuzijun 17 | */ 18 | public class TestcaseAction extends AbstractTreeAction { 19 | @Override 20 | public void actionPerformed(AnActionEvent anActionEvent, Config config, Question question) { 21 | 22 | AtomicReference text = new AtomicReference<>(TestcaseAction.class.getName()); 23 | ApplicationManager.getApplication().invokeAndWait(() -> { 24 | TestcasePanel dialog = new TestcasePanel(anActionEvent.getProject(), question); 25 | dialog.setTitle(question.getFormTitle() + " Testcase"); 26 | dialog.setText(question.getTestCase()); 27 | if (dialog.showAndGet()) { 28 | text.set(dialog.testcaseText()); 29 | 30 | } 31 | }); 32 | if (!TestcaseAction.class.getName().equals(text.get())) { 33 | if (StringUtils.isBlank(text.get())) { 34 | MessageUtils.getInstance(anActionEvent.getProject()).showWarnMsg("info", PropertiesUtils.getInfo("test.case")); 35 | return; 36 | } else { 37 | question.setTestCase(text.get()); 38 | CodeManager.RunCodeCode(question.getTitleSlug(), anActionEvent.getProject()); 39 | } 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/shuzijun/leetcode/plugin/setting/SettingConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.shuzijun.leetcode.plugin.setting; 2 | 3 | import com.intellij.openapi.options.ConfigurationException; 4 | import com.intellij.openapi.options.SearchableConfigurable; 5 | import com.shuzijun.leetcode.plugin.model.PluginConstant; 6 | import org.jetbrains.annotations.Nls; 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | import javax.swing.*; 11 | 12 | /** 13 | * @author shuzijun 14 | */ 15 | public class SettingConfigurable implements SearchableConfigurable { 16 | 17 | public static final String DISPLAY_NAME = PluginConstant.APPLICATION_CONFIGURABLE_DISPLAY_NAME; 18 | 19 | private SettingUI mainPanel; 20 | 21 | @NotNull 22 | @Override 23 | public String getId() { 24 | return PluginConstant.APPLICATION_CONFIGURABLE_ID; 25 | } 26 | 27 | @Nls 28 | @Override 29 | public String getDisplayName() { 30 | return PluginConstant.APPLICATION_CONFIGURABLE_DISPLAY_NAME; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public String getHelpTopic() { 36 | return "leetcode.helpTopic"; 37 | } 38 | 39 | @Nullable 40 | @Override 41 | public Runnable enableSearch(String option) { 42 | return null; 43 | } 44 | 45 | @Nullable 46 | @Override 47 | public JComponent createComponent() { 48 | mainPanel = new SettingUI(); 49 | return mainPanel.getContentPane(); 50 | } 51 | 52 | @Override 53 | public boolean isModified() { 54 | return mainPanel.isModified(); 55 | } 56 | 57 | @Override 58 | public void apply() throws ConfigurationException { 59 | mainPanel.apply(); 60 | } 61 | 62 | @Override 63 | public void reset() { 64 | mainPanel.reset(); 65 | } 66 | 67 | @Override 68 | public void disposeUIResources() { 69 | mainPanel.disposeUIResources(); 70 | mainPanel = null; 71 | } 72 | 73 | } 74 | --------------------------------------------------------------------------------