From 3749f986990ec0aa2864bc5a7a391bc12b941e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E5=85=B8=E5=85=B8?= <413153189@qq.com> Date: Fri, 19 Jul 2024 14:06:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0router=20handle=20=E9=82=AE=E4=BB=B6=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e-intellij.fullLine.cppCore-2024.2+441.xml | 10 +++ ...odule-intellij.fullLine.css-2024.2+441.xml | 10 +++ ...Module-intellij.fullLine.js-2024.2+441.xml | 10 +++ ...le-intellij.fullLine.python-2024.2+441.xml | 10 +++ ...platform.collaborationTools-2024.2+441.xml | 10 +++ ...odule-intellij.platform.dap-2024.2+441.xml | 10 +++ ...ij.platform.navbar.frontend-2024.2+441.xml | 10 +++ ...-intellij.platform.vcs.impl-2024.2+441.xml | 10 +++ ...ellij.platform.vcs.log.impl-2024.2+441.xml | 10 +++ ...-intellij.profiler.asyncOne-2024.2+441.xml | 10 +++ ...ule-intellij.profiler.clion-2024.2+441.xml | 10 +++ ...le-intellij.profiler.common-2024.2+441.xml | 10 +++ .../bundledPlugin-Git4Idea-2024.2+441.xml | 14 +++ .../bundledPlugin-HtmlTools-2024.2+441.xml | 12 +++ ...undledPlugin-JavaScriptBase-2024.2+441.xml | 23 +++++ ...edPlugin-JavaScriptDebugger-2024.2+441.xml | 13 +++ .../bundledPlugin-XPathView-2024.2+441.xml | 10 +++ ...ellij.completion.ml.ranking-2024.2+441.xml | 12 +++ ...ugin-com.intellij.copyright-2024.2+441.xml | 12 +++ ...dledPlugin-com.intellij.css-2024.2+441.xml | 13 +++ ...Plugin-com.intellij.diagram-2024.2+441.xml | 12 +++ ...tellij.ml.inline.completion-2024.2+441.xml | 15 ++++ ...in-com.intellij.nativeDebug-2024.2+441.xml | 10 +++ ...om.intellij.platform.images-2024.2+441.xml | 10 +++ ...jetbrains.performancePlugin-2024.2+441.xml | 13 +++ ...rains.plugins.webDeployment-2024.2+441.xml | 10 +++ ...edPlugin-com.jetbrains.rust-2024.2+441.xml | 22 +++++ ...dledPlugin-com.jetbrains.sh-2024.2+441.xml | 14 +++ ...in-org.intellij.intelliLang-2024.2+441.xml | 12 +++ ...g.intellij.plugins.markdown-2024.2+441.xml | 15 ++++ ...brains.completion.full.line-2024.2+441.xml | 18 ++++ ....jetbrains.plugins.terminal-2024.2+441.xml | 12 +++ ...-org.jetbrains.plugins.yaml-2024.2+441.xml | 10 +++ ...bundledPlugin-org.toml.lang-2024.2+441.xml | 12 +++ .../bundledPlugin-tanvd.grazi-2024.2+441.xml | 14 +++ ...etbrains.intellij.rustrover-2024.2+441.xml | 10 +++ .intellijPlatform/self-update.lock | 2 +- build.gradle.kts | 23 +++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../salvorstool/action/GenerateDtoAction.kt | 2 +- .../action/GenerateHookFormAction.kt | 2 - .../action/GenerateRouterAction.kt | 2 +- .../action/GenerateServiceAction.kt | 2 +- .../base/BaseRsStructCodeGenerateAction.kt | 3 +- .../SalvoApiNavigatorToRouteImplAction.kt | 27 ++++++ .../salvorstool/dialog/GenerateDtoDialog.kt | 17 ++-- .../dialog/GenerateRouterDialog.kt | 3 +- .../dialog/GenerateServiceDialog.kt | 3 +- .../intention/CopyAntdTableColumnAction.kt | 9 +- .../intention/CopyTSInterfaceAction.kt | 10 ++- .../itbug/salvorstool/model/SalvoApiItem.kt | 32 +++---- .../searcheverywhere/SalvoSearchApi.kt | 2 +- .../salvorstool/service/RustProjectService.kt | 31 +++++++ .../salvorstool/service/SalvoApiService.kt | 45 +++++----- .../itbug/salvorstool/tool/AntdFactory.kt | 4 +- .../salvorstool/tool/ExtendedFuntions.kt | 78 ++++++++++++++-- .../salvorstool/tool/MyRsPsiElementManager.kt | 14 ++- .../itbug/salvorstool/tool/MyRsPsiFactory.kt | 60 ++++++------- .../salvorstool/tool/RsDotExprManager.kt | 75 ---------------- .../salvorstool/tool/RsLetDeclManager.kt | 90 +++++++++++++------ .../tool/RsMethodCallExprImplManager.kt | 64 +++++++++++++ .../salvorstool/tool/RsMethodCallManager.kt | 84 ++++++++--------- .../shop/itbug/salvorstool/tool/Tools.kt | 2 +- .../itbug/salvorstool/window/ApiScanWindow.kt | 2 +- src/main/resources/META-INF/plugin.xml | 17 +++- .../messages/pluginBundle.properties | 2 + .../messages/pluginBundle_ar.properties | 2 + .../messages/pluginBundle_de.properties | 2 + .../messages/pluginBundle_en.properties | 2 + .../messages/pluginBundle_fr.properties | 2 + .../messages/pluginBundle_hk.properties | 2 + .../messages/pluginBundle_it.properties | 2 + .../messages/pluginBundle_ja.properties | 2 + .../messages/pluginBundle_ko.properties | 2 + .../messages/pluginBundle_nl.properties | 2 + .../messages/pluginBundle_pl.properties | 2 + .../messages/pluginBundle_pt.properties | 2 + .../messages/pluginBundle_ru.properties | 2 + 78 files changed, 890 insertions(+), 281 deletions(-) create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.cppCore-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.css-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.js-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.python-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.collaborationTools-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.dap-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.navbar.frontend-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.impl-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.log.impl-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.asyncOne-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.clion-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.common-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-Git4Idea-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-HtmlTools-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptBase-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptDebugger-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-XPathView-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.completion.ml.ranking-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.copyright-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.css-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.diagram-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.ml.inline.completion-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.nativeDebug-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.platform.images-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.performancePlugin-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.plugins.webDeployment-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.rust-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.sh-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.intelliLang-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.plugins.markdown-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.completion.full.line-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.terminal-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.yaml-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-org.toml.lang-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/bundledPlugin-tanvd.grazi-2024.2+441.xml create mode 100644 .intellijPlatform/localPlatformArtifacts/localIde-com.jetbrains.intellij.rustrover-2024.2+441.xml create mode 100644 src/main/kotlin/shop/itbug/salvorstool/action/rightmenu/SalvoApiNavigatorToRouteImplAction.kt create mode 100644 src/main/kotlin/shop/itbug/salvorstool/service/RustProjectService.kt create mode 100644 src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallExprImplManager.kt diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.cppCore-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.cppCore-2024.2+441.xml new file mode 100644 index 0000000..3f11e9d --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.cppCore-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.css-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.css-2024.2+441.xml new file mode 100644 index 0000000..21ffb34 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.css-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.js-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.js-2024.2+441.xml new file mode 100644 index 0000000..465892f --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.js-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.python-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.python-2024.2+441.xml new file mode 100644 index 0000000..01f59b2 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.fullLine.python-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.collaborationTools-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.collaborationTools-2024.2+441.xml new file mode 100644 index 0000000..91f9c3d --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.collaborationTools-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.dap-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.dap-2024.2+441.xml new file mode 100644 index 0000000..a9abe39 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.dap-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.navbar.frontend-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.navbar.frontend-2024.2+441.xml new file mode 100644 index 0000000..dcfa61a --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.navbar.frontend-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.impl-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.impl-2024.2+441.xml new file mode 100644 index 0000000..7d6a100 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.impl-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.log.impl-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.log.impl-2024.2+441.xml new file mode 100644 index 0000000..b4bb0fd --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.platform.vcs.log.impl-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.asyncOne-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.asyncOne-2024.2+441.xml new file mode 100644 index 0000000..2e7fdcd --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.asyncOne-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.clion-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.clion-2024.2+441.xml new file mode 100644 index 0000000..dcec57f --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.clion-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.common-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.common-2024.2+441.xml new file mode 100644 index 0000000..94ca7fd --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledModule-intellij.profiler.common-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-Git4Idea-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-Git4Idea-2024.2+441.xml new file mode 100644 index 0000000..6b7175a --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-Git4Idea-2024.2+441.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-HtmlTools-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-HtmlTools-2024.2+441.xml new file mode 100644 index 0000000..5f7550e --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-HtmlTools-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptBase-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptBase-2024.2+441.xml new file mode 100644 index 0000000..c50df1c --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptBase-2024.2+441.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptDebugger-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptDebugger-2024.2+441.xml new file mode 100644 index 0000000..762796b --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-JavaScriptDebugger-2024.2+441.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-XPathView-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-XPathView-2024.2+441.xml new file mode 100644 index 0000000..1cbc0a2 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-XPathView-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.completion.ml.ranking-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.completion.ml.ranking-2024.2+441.xml new file mode 100644 index 0000000..cebf901 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.completion.ml.ranking-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.copyright-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.copyright-2024.2+441.xml new file mode 100644 index 0000000..813ba1c --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.copyright-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.css-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.css-2024.2+441.xml new file mode 100644 index 0000000..4858c10 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.css-2024.2+441.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.diagram-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.diagram-2024.2+441.xml new file mode 100644 index 0000000..ead7d5c --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.diagram-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.ml.inline.completion-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.ml.inline.completion-2024.2+441.xml new file mode 100644 index 0000000..7b0c34e --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.ml.inline.completion-2024.2+441.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.nativeDebug-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.nativeDebug-2024.2+441.xml new file mode 100644 index 0000000..9a85227 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.nativeDebug-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.platform.images-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.platform.images-2024.2+441.xml new file mode 100644 index 0000000..6bd0230 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.intellij.platform.images-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.performancePlugin-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.performancePlugin-2024.2+441.xml new file mode 100644 index 0000000..47b185f --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.performancePlugin-2024.2+441.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.plugins.webDeployment-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.plugins.webDeployment-2024.2+441.xml new file mode 100644 index 0000000..db74b79 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.plugins.webDeployment-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.rust-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.rust-2024.2+441.xml new file mode 100644 index 0000000..180c711 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.rust-2024.2+441.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.sh-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.sh-2024.2+441.xml new file mode 100644 index 0000000..761b2d8 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-com.jetbrains.sh-2024.2+441.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.intelliLang-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.intelliLang-2024.2+441.xml new file mode 100644 index 0000000..be1e87f --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.intelliLang-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.plugins.markdown-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.plugins.markdown-2024.2+441.xml new file mode 100644 index 0000000..a5695c9 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.intellij.plugins.markdown-2024.2+441.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.completion.full.line-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.completion.full.line-2024.2+441.xml new file mode 100644 index 0000000..433caa7 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.completion.full.line-2024.2+441.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.terminal-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.terminal-2024.2+441.xml new file mode 100644 index 0000000..14b8373 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.terminal-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.yaml-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.yaml-2024.2+441.xml new file mode 100644 index 0000000..a8263e6 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.jetbrains.plugins.yaml-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.toml.lang-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.toml.lang-2024.2+441.xml new file mode 100644 index 0000000..5250fb1 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-org.toml.lang-2024.2+441.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/bundledPlugin-tanvd.grazi-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-tanvd.grazi-2024.2+441.xml new file mode 100644 index 0000000..3501be4 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/bundledPlugin-tanvd.grazi-2024.2+441.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/localPlatformArtifacts/localIde-com.jetbrains.intellij.rustrover-2024.2+441.xml b/.intellijPlatform/localPlatformArtifacts/localIde-com.jetbrains.intellij.rustrover-2024.2+441.xml new file mode 100644 index 0000000..020f2d8 --- /dev/null +++ b/.intellijPlatform/localPlatformArtifacts/localIde-com.jetbrains.intellij.rustrover-2024.2+441.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.intellijPlatform/self-update.lock b/.intellijPlatform/self-update.lock index 60777fa..03864b5 100644 --- a/.intellijPlatform/self-update.lock +++ b/.intellijPlatform/self-update.lock @@ -1 +1 @@ -2024-06-20 \ No newline at end of file +2024-07-19 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 1aac9f0..c71f786 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,12 @@ import org.jetbrains.changelog.Changelog +import org.jetbrains.intellij.platform.gradle.TestFrameworkType import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { id("org.jetbrains.kotlin.jvm") version "2.0.0" - id("org.jetbrains.intellij.platform") version "2.0.0-beta8" + id("org.jetbrains.intellij.platform") version "2.0.0-beta9" id("org.jetbrains.changelog") version "2.2.0" } @@ -24,10 +26,15 @@ repositories { dependencies { intellijPlatform { - rustRover("2024.1.3") - bundledPlugins("com.jetbrains.rust","JavaScriptBase") +// local("/Users/ldd/Applications/RustRover.app") + rustRover("2024.1.5") + bundledPlugins("JavaScriptBase","com.jetbrains.rust","org.toml.lang") zipSigner() instrumentationTools() + + testFramework(TestFrameworkType.Platform) + + implementation("org.osgi:org.osgi.test.junit4:1.3.0") } } @@ -35,6 +42,7 @@ dependencies { val pushToken: String? = System.getenv("PUBLISH_TOKEN") tasks { + withType { sourceCompatibility = "17" targetCompatibility = "17" @@ -82,14 +90,6 @@ tasks { jvmArgs = listOf("-XX:+AllowEnhancedClassRedefinition") } - test { - useJUnitPlatform() - } - - prepareSandbox { - doNotTrackState("---") - } - } changelog { @@ -103,5 +103,4 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.0") implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0") implementation("com.google.guava:guava:31.1-jre") - testImplementation("junit:junit:4.13.2") } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..09523c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateDtoAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateDtoAction.kt index e6674f5..9d6e7da 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateDtoAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateDtoAction.kt @@ -15,7 +15,7 @@ class GenerateDtoAction : AnAction() { } } override fun update(e: AnActionEvent) { - e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement()!=null && e.tryGetRsStructPsiElement()?.myManager?.getTableName != null + e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement()!=null e.presentation.text = MyI18n.getMessage("g_dto") super.update(e) } diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt index 2c96e6e..6581178 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt @@ -28,12 +28,10 @@ class GenerateHookFormAction : AnAction() { } private inner class Dialog(project: Project,psi: RsStructItemImpl) : DialogWrapper(project) { - private val manager = psi.myManager private val tab = JBTabbedPane() init { super.init() - tab.add("Component", TypeJavaScriptEditor(project,manager.getHookForm)) } override fun createCenterPanel(): JComponent { diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateRouterAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateRouterAction.kt index 4b64a4c..9e4bdc1 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateRouterAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateRouterAction.kt @@ -17,7 +17,7 @@ class GenerateRouterAction : AnAction() { } override fun update(e: AnActionEvent) { - e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement() != null && e.tryGetRsStructPsiElement()?.myManager?.getTableName != null + e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement() != null e.presentation.text = MyI18n.getMessage("g_router") super.update(e) } diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateServiceAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateServiceAction.kt index 46fb375..0bb981b 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateServiceAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateServiceAction.kt @@ -16,7 +16,7 @@ class GenerateServiceAction : AnAction() { } override fun update(e: AnActionEvent) { - e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement() != null && e.tryGetRsStructPsiElement()?.myManager?.getTableName != null + e.presentation.isVisible = e.project != null && e.tryGetRsStructPsiElement() != null e.presentation.text = MyI18n.getMessage("g_service") super.update(e) } diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/base/BaseRsStructCodeGenerateAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/base/BaseRsStructCodeGenerateAction.kt index f1522ce..f5c38c9 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/base/BaseRsStructCodeGenerateAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/base/BaseRsStructCodeGenerateAction.kt @@ -8,6 +8,7 @@ import org.rust.lang.core.psi.RsNamedFieldDecl import org.rust.lang.core.psi.RsStructItem import shop.itbug.salvorstool.tool.MyRsStructManager import shop.itbug.salvorstool.tool.myManager +import shop.itbug.salvorstool.tool.structItemManager import shop.itbug.salvorstool.tool.tryGetRsStructPsiElement /** @@ -29,7 +30,7 @@ abstract class BaseRsStructCodeGenerateAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { val psiElement = e.tryGetRsStructPsiElement()!! val project = e.project!! - val manager: MyRsStructManager = psiElement.myManager + val manager: MyRsStructManager = psiElement.structItemManager val name: String? = manager.structName val props: List = manager.fieldList val model = Model(project, e, psiElement, manager, name, props) diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/rightmenu/SalvoApiNavigatorToRouteImplAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/rightmenu/SalvoApiNavigatorToRouteImplAction.kt new file mode 100644 index 0000000..7d98650 --- /dev/null +++ b/src/main/kotlin/shop/itbug/salvorstool/action/rightmenu/SalvoApiNavigatorToRouteImplAction.kt @@ -0,0 +1,27 @@ +package shop.itbug.salvorstool.action.rightmenu + +import com.intellij.icons.AllIcons +import com.intellij.openapi.actionSystem.ActionUpdateThread +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import shop.itbug.salvorstool.i18n.MyI18n +import shop.itbug.salvorstool.window.ApiScanWindow.Companion.JListSelectItemDataKey + +///跳转到router的实现 +class SalvoApiNavigatorToRouteImplAction: AnAction() { + override fun actionPerformed(e: AnActionEvent) { + val item = e.getData(JListSelectItemDataKey)!! + item.navToRouterImpl() + } + + override fun update(e: AnActionEvent) { + e.presentation.isEnabled = e.getData(JListSelectItemDataKey) !=null + e.presentation.text = "${MyI18n.getMessage("nav_to_psi")} Router Handle" + e.presentation.icon = AllIcons.Actions.FindForward + super.update(e) + } + + override fun getActionUpdateThread(): ActionUpdateThread { + return ActionUpdateThread.BGT + } +} \ No newline at end of file diff --git a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateDtoDialog.kt b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateDtoDialog.kt index 76c25de..bfabb91 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateDtoDialog.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateDtoDialog.kt @@ -11,10 +11,7 @@ import com.intellij.ui.dsl.builder.panel import org.rust.lang.core.psi.RsNamedFieldDecl import org.rust.lang.core.psi.impl.RsStructItemImpl import shop.itbug.salvorstool.i18n.MyI18n -import shop.itbug.salvorstool.tool.MyRsPsiFactory -import shop.itbug.salvorstool.tool.Tools -import shop.itbug.salvorstool.tool.myManager -import shop.itbug.salvorstool.tool.underlineToCamel +import shop.itbug.salvorstool.tool.* import shop.itbug.salvorstool.widget.RsEditor import java.awt.Dimension import java.util.* @@ -57,7 +54,7 @@ fun GenerateDtoDialogResultEnum.getOuterAttr(): String { ///过滤字段 fun GenerateDtoDialogResultEnum.getFields(list: List) : List { return when (this) { - GenerateDtoDialogResultEnum.AddRequest -> list.filter { !it.myManager.isPrimaryKey } + GenerateDtoDialogResultEnum.AddRequest -> list.filter { !it.namedFieldManager.isPrimaryKey } GenerateDtoDialogResultEnum.UpdateRequest -> list GenerateDtoDialogResultEnum.Response -> list } @@ -66,7 +63,7 @@ fun GenerateDtoDialogResultEnum.getFields(list: List) : List fun GenerateDtoDialogResultEnum.preview(field: RsNamedFieldDecl) : String? { return when (this) { GenerateDtoDialogResultEnum.UpdateRequest -> { - if(field.myManager.isPrimaryKey){ + if(field.namedFieldManager.isPrimaryKey){ return " #[salvo(extract(source(from = \"param\")))]" } return null @@ -99,13 +96,13 @@ class GenerateDtoDialog(private val project: Project, private val psiElement: R private val model = GenerateDtoDialogParam( addRequestText = MyRsPsiFactory.generateDto(GenerateDtoDialogResultEnum.AddRequest, psiElement), - addRequestName = GenerateDtoDialogResultEnum.AddRequest.getStructName(psiElement.myManager.getTableName ?: ""), + addRequestName = GenerateDtoDialogResultEnum.AddRequest.getStructName(psiElement.structItemManager.getTableName ?: ""), updateRequestText = MyRsPsiFactory.generateDto(GenerateDtoDialogResultEnum.UpdateRequest,psiElement), - updateRequestName = GenerateDtoDialogResultEnum.UpdateRequest.getStructName(psiElement.myManager.getTableName ?: ""), + updateRequestName = GenerateDtoDialogResultEnum.UpdateRequest.getStructName(psiElement.structItemManager.getTableName ?: ""), responseText = MyRsPsiFactory.generateDto(GenerateDtoDialogResultEnum.Response,psiElement), - responseName = GenerateDtoDialogResultEnum.Response.getStructName(psiElement.myManager.getTableName ?: ""), + responseName = GenerateDtoDialogResultEnum.Response.getStructName(psiElement.structItemManager.getTableName ?: ""), saveTo = Tools.getDtoFolder(project)?.path ?: "", - fileName = (psiElement.myManager.getTableName?:"root") + fileName = (psiElement.structItemManager.getTableName?:"root") ) private val tabView = JBTabbedPane() diff --git a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateRouterDialog.kt b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateRouterDialog.kt index 4e1a0d9..c7e57c5 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateRouterDialog.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateRouterDialog.kt @@ -13,6 +13,7 @@ import shop.itbug.salvorstool.i18n.MyI18n import shop.itbug.salvorstool.tool.MyRsPsiFactory import shop.itbug.salvorstool.tool.Tools import shop.itbug.salvorstool.tool.myManager +import shop.itbug.salvorstool.tool.structItemManager import shop.itbug.salvorstool.widget.RsEditor import java.awt.Dimension import javax.swing.JComponent @@ -30,7 +31,7 @@ class GenerateRouterDialog(private val project: Project, psiElement: RsStructIte private val model = GenerateRouterDialogModel( text = MyRsPsiFactory.generateRouterFile(psiElement), saveTo = Tools.getRouterFolder(project)?.path ?: "", - fileName = (psiElement.myManager.getTableName ?: "root") + fileName = (psiElement.structItemManager.getTableName ?: "root") ) init { diff --git a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateServiceDialog.kt b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateServiceDialog.kt index 97ae5d5..e06e077 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateServiceDialog.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/dialog/GenerateServiceDialog.kt @@ -14,6 +14,7 @@ import shop.itbug.salvorstool.i18n.MyI18n import shop.itbug.salvorstool.tool.MyRsPsiFactory import shop.itbug.salvorstool.tool.Tools import shop.itbug.salvorstool.tool.myManager +import shop.itbug.salvorstool.tool.structItemManager import shop.itbug.salvorstool.widget.RsEditor import java.awt.Dimension import javax.swing.JComponent @@ -57,7 +58,7 @@ class GenerateServiceDialog(private val project: Project, private val psiElement deleteText = MyRsPsiFactory.generateServiceByDelete(psiElement), findAllText = MyRsPsiFactory.generateServiceByAll(psiElement), saveTo = Tools.getServiceFolder(project)?.path ?: "", - fileName = (psiElement.myManager.getTableName?:"root") + fileName = (psiElement.structItemManager.getTableName?:"root") ) init { diff --git a/src/main/kotlin/shop/itbug/salvorstool/intention/CopyAntdTableColumnAction.kt b/src/main/kotlin/shop/itbug/salvorstool/intention/CopyAntdTableColumnAction.kt index b1305ab..3771f08 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/intention/CopyAntdTableColumnAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/intention/CopyAntdTableColumnAction.kt @@ -10,11 +10,14 @@ import com.intellij.psi.PsiFile import org.rust.lang.core.psi.impl.RsStructItemImpl import shop.itbug.salvorstool.tool.copy import shop.itbug.salvorstool.tool.myManager +import shop.itbug.salvorstool.tool.structItemManager + +/// class CopyAntdTableColumnAction : PsiElementBaseIntentionAction(), IntentionAction { override fun getFamilyName(): String { - return "SalvoRsTool: Copy Antd Table Column" + return "RustX: Copy Antd Table Column" } override fun getText(): String { @@ -27,13 +30,13 @@ class CopyAntdTableColumnAction : PsiElementBaseIntentionAction(), IntentionActi override fun invoke(project: Project, editor: Editor?, element: PsiElement) { val rs = element.parent as? RsStructItemImpl ?: return - rs.myManager.getAntdTableColumnDefine.copy() + rs.structItemManager.getAntdTableColumnDefine.copy() } override fun generatePreview(project: Project, editor: Editor, file: PsiFile): IntentionPreviewInfo { val rsPsi = getElement(editor, file)?.parent as? RsStructItemImpl rsPsi?.let { - return IntentionPreviewInfo.Html("""
${rsPsi.myManager.getAntdTableColumnDefine}
""".trimIndent()) + return IntentionPreviewInfo.Html("""
${rsPsi.structItemManager.getAntdTableColumnDefine}
""".trimIndent()) } return IntentionPreviewInfo.EMPTY } diff --git a/src/main/kotlin/shop/itbug/salvorstool/intention/CopyTSInterfaceAction.kt b/src/main/kotlin/shop/itbug/salvorstool/intention/CopyTSInterfaceAction.kt index 561730c..60b7bbe 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/intention/CopyTSInterfaceAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/intention/CopyTSInterfaceAction.kt @@ -9,11 +9,12 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import org.rust.lang.core.psi.impl.RsStructItemImpl import shop.itbug.salvorstool.tool.copy -import shop.itbug.salvorstool.tool.myManager +import shop.itbug.salvorstool.tool.structItemManager +/// class CopyTSInterfaceAction: PsiElementBaseIntentionAction(),IntentionAction { override fun getFamilyName(): String { - return "SalvoRsTool: Copy TS interface" + return "RustX: Copy TS interface" } override fun getText(): String { @@ -23,16 +24,17 @@ class CopyTSInterfaceAction: PsiElementBaseIntentionAction(),IntentionAction { override fun isAvailable(project: Project, editor: Editor?, element: PsiElement): Boolean { return element.parent is RsStructItemImpl } + override fun invoke(project: Project, editor: Editor?, element: PsiElement) { val rs = element.parent as? RsStructItemImpl ?: return - rs.myManager.getTSInterface.copy() + rs.structItemManager.getTSInterface.copy() } override fun generatePreview(project: Project, editor: Editor, file: PsiFile): IntentionPreviewInfo { var preview = IntentionPreviewInfo.Html("") val psiElement = getElement(editor,file)?.parent as? RsStructItemImpl psiElement?.let { - preview = IntentionPreviewInfo.Html("
${it.myManager.getTSInterface}
") + preview = IntentionPreviewInfo.Html("
${it.structItemManager.getTSInterface}
") } return preview } diff --git a/src/main/kotlin/shop/itbug/salvorstool/model/SalvoApiItem.kt b/src/main/kotlin/shop/itbug/salvorstool/model/SalvoApiItem.kt index 07f7a53..98c3663 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/model/SalvoApiItem.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/model/SalvoApiItem.kt @@ -1,11 +1,7 @@ package shop.itbug.salvorstool.model -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.project.Project -import com.intellij.pom.Navigatable -import com.intellij.psi.search.searches.ReferencesSearch import org.rust.lang.core.psi.RsMethodCall +import org.rust.lang.core.psi.impl.RsPathImpl import shop.itbug.salvorstool.tool.* import java.util.* @@ -15,9 +11,13 @@ enum class SalvoApiItemMethod { Post, Update, Delete, - Put + Put, + Patch, + Unknown } +data class SalvoApiItemFunction(val method: SalvoApiItemMethod,val element: RsMethodCall) + data class SalvoApiItem(val api: String,val method: SalvoApiItemMethod,val rsMethodPsiElement: RsMethodCall){ override fun toString(): String { return "\n${api} - $method" @@ -89,14 +89,16 @@ data class SalvoApiItem(val api: String,val method: SalvoApiItemMethod,val rsMet /** * 跳到代码位置 */ - fun navTo(project: Project) { - val navigationElement = rsMethodPsiElement.navigationElement - ApplicationManager.getApplication().invokeLater { - if (navigationElement != null && navigationElement is Navigatable && (navigationElement as Navigatable).canNavigate()) { - (navigationElement as Navigatable).navigate(true) - }else{ - FileEditorManager.getInstance(project).openFile(rsMethodPsiElement.containingFile.virtualFile) - } - } + fun navTo() { + rsMethodPsiElement.tryNavTo() + } + + /** + * 跳转到service实现 + */ + fun navToRouterImpl(){ + rsMethodPsiElement.findFirstChild()?.let { rxPath -> + rxPath.reference?.resolve()?.tryNavTo() + } } } diff --git a/src/main/kotlin/shop/itbug/salvorstool/searcheverywhere/SalvoSearchApi.kt b/src/main/kotlin/shop/itbug/salvorstool/searcheverywhere/SalvoSearchApi.kt index 3e0ae6b..7cc28fb 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/searcheverywhere/SalvoSearchApi.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/searcheverywhere/SalvoSearchApi.kt @@ -51,7 +51,7 @@ class SalvoSearchApi : SearchEverywhereContributorFactory { } override fun processSelectedItem(selected: SalvoApiItem, modifiers: Int, searchText: String): Boolean { - selected.navTo(project) + selected.navTo() return true } diff --git a/src/main/kotlin/shop/itbug/salvorstool/service/RustProjectService.kt b/src/main/kotlin/shop/itbug/salvorstool/service/RustProjectService.kt new file mode 100644 index 0000000..64a1833 --- /dev/null +++ b/src/main/kotlin/shop/itbug/salvorstool/service/RustProjectService.kt @@ -0,0 +1,31 @@ +package shop.itbug.salvorstool.service + +import com.intellij.openapi.components.Service +import com.intellij.openapi.project.Project +import com.intellij.openapi.vfs.LocalFileSystem +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.PsiManager +import org.toml.lang.psi.TomlFile +import org.toml.lang.psi.TomlKeyValue +import shop.itbug.salvorstool.tool.filterByType +import java.io.File + +@Service(Service.Level.PROJECT) +class RustProjectService (val project: Project){ + + + /** + * 是否使用了salvo的依赖 + */ + fun hasSalvoDependencies() : Boolean { + val tomlFilePath = project.basePath + File.separator + "Cargo.toml" + val tomlFile: VirtualFile = LocalFileSystem.getInstance().findFileByPath(tomlFilePath) ?: return false + val file = PsiManager.getInstance(project).findFile(tomlFile) as? TomlFile ?: return false + val keyValues = file.filterByType() + return keyValues.any { it.key.text == "salvo" } + } + + companion object { + fun getInstance(project: Project): RustProjectService = project.getService(RustProjectService::class.java) + } +} \ No newline at end of file diff --git a/src/main/kotlin/shop/itbug/salvorstool/service/SalvoApiService.kt b/src/main/kotlin/shop/itbug/salvorstool/service/SalvoApiService.kt index f080799..cfc49c5 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/service/SalvoApiService.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/service/SalvoApiService.kt @@ -19,15 +19,15 @@ import shop.itbug.salvorstool.messageing.ApiScanMessaging import shop.itbug.salvorstool.model.SalvoApiItem import shop.itbug.salvorstool.tool.myManager import shop.itbug.salvorstool.tool.rsFileType +import shop.itbug.salvorstool.tool.rsLetDeclImplManager @Service(Service.Level.PROJECT) class SalvoApiService(val project: Project) { - private var projectApiList = mutableListOf() init { - project.messageBus.connect().subscribe(DumbService.DUMB_MODE, object : DumbService.DumbModeListener { + project.messageBus.connect().subscribe(DumbService.DUMB_MODE, object : DumbService.DumbModeListener { override fun exitDumbMode() { startScan() super.exitDumbMode() @@ -35,8 +35,7 @@ class SalvoApiService(val project: Project) { }) } - - fun getApiList() : List { + fun getApiList(): List { return projectApiList } @@ -46,27 +45,30 @@ class SalvoApiService(val project: Project) { @OptIn(DelicateCoroutinesApi::class) private fun startScan() { + ApplicationManager.getApplication().invokeLater { - GlobalScope.launch(Dispatchers.Default) { - var files = emptyList() - readAction { - files = FileTypeIndex.getFiles(rsFileType, SalvoSearchGlobal(project)).toList() - } - val tasks = files.map { file -> - GlobalScope.async { - findRouterRsFunction(file) + val hasSalvoDeps = RustProjectService.getInstance(project).hasSalvoDependencies() + if (hasSalvoDeps) { + GlobalScope.launch(Dispatchers.Default) { + var files = emptyList() + readAction { + files = FileTypeIndex.getFiles(rsFileType, SalvoSearchGlobal(project)).toList() } - } - val result = tasks.awaitAll().flatten() - val apis = mutableListOf() - result.forEach { r -> - ApplicationManager.getApplication().runReadAction { - val api = r.myManager.allLet.map { let -> let.myManager.apiList } - apis.addAll(api.flatten()) + val tasks = files.map { file -> + GlobalScope.async { + findRouterRsFunction(file) + } + } + val result = tasks.awaitAll().flatten() + val apis = mutableListOf() + result.forEach { r: RsFunctionImpl -> + ApplicationManager.getApplication().runReadAction { + r.myManager.allLet.map { let -> apis.addAll(let.rsLetDeclImplManager.allApi) } + } } + projectApiList = apis + project.messageBus.syncPublisher(ApiScanMessaging.TOPIC).apiScanEed(apis) } - projectApiList = apis - project.messageBus.syncPublisher(ApiScanMessaging.TOPIC).apiScanEed(apis) } } @@ -81,6 +83,7 @@ class SalvoApiService(val project: Project) { return@readAction find } } + companion object { fun getInstance(project: Project): SalvoApiService { diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/AntdFactory.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/AntdFactory.kt index 0eb27ff..833b254 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/AntdFactory.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/AntdFactory.kt @@ -19,7 +19,7 @@ object AntdFactory { ///生成form fun generateAntdForm(psiElement: RsStructItemImpl): String { val sb = StringBuilder() - val manager = psiElement.myManager + val manager = psiElement.structItemManager val jsModels = manager.jsModelList //1.添加参数 @@ -49,7 +49,7 @@ object AntdFactory { } ///生成form item - fun generateFormItem(model: MyFieldPsiElementManager.JsModel): String { + private fun generateFormItem(model: MyFieldPsiElementManager.JsModel): String { val type = when (model.type) { JavascriptType.Number -> "ProFormDigit" JavascriptType.String -> "ProFormText" diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/ExtendedFuntions.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/ExtendedFuntions.kt index cad8326..eae2eff 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/ExtendedFuntions.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/ExtendedFuntions.kt @@ -3,10 +3,19 @@ package shop.itbug.salvorstool.tool import com.google.common.base.CaseFormat import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileTypes.FileTypeManager import com.intellij.openapi.ide.CopyPasteManager +import com.intellij.pom.Navigatable import com.intellij.psi.PsiElement +import com.intellij.psi.PsiFile +import com.intellij.psi.PsiReference +import com.intellij.psi.impl.source.tree.LeafPsiElement +import com.intellij.psi.search.LocalSearchScope +import com.intellij.psi.search.searches.ReferencesSearch +import com.intellij.psi.util.PsiTreeUtil import org.rust.lang.core.psi.RsNamedFieldDecl import org.rust.lang.core.psi.RsOuterAttr import org.rust.lang.core.psi.impl.RsStructItemImpl @@ -17,11 +26,9 @@ import javax.swing.JPanel import javax.swing.JScrollPane val rsFileType = FileTypeManager.getInstance().getFileTypeByExtension("rs") -val PsiElement.myManager get() = MyRsPsiElementManager(this) -val RsStructItemImpl.myManager get() = MyRsStructManager(this) -val RsNamedFieldDecl.myManager get() = MyFieldPsiElementManager(this) -val RsOuterAttr.myManager get() = MyRsOuterAttrPsiElementManager(this) -fun T.logger() = Logger.getInstance(this::class.java) +val RsStructItemImpl.structItemManager get() = MyRsStructManager(this) +val RsNamedFieldDecl.namedFieldManager get() = MyFieldPsiElementManager(this) +val RsOuterAttr.outerAttrManager get() = MyRsOuterAttrPsiElementManager(this) val JScrollPane.removeBorder get() = this.apply { this.border = BorderFactory.createEmptyBorder(0, 0, 0, 0) } val JPanel.padding get() = this.apply { this.border = BorderFactory.createEmptyBorder(12, 12, 12, 12) } val JPanel.vertical get() = this.apply { this.border = BorderFactory.createEmptyBorder(12, 0, 12, 0) } @@ -53,14 +60,69 @@ fun firstCharToLowercase(input: String): String { } } +///尝试获取Rs struct 模型 fun AnActionEvent.tryGetRsStructPsiElement(): RsStructItemImpl? { val psiElement = this.getData(CommonDataKeys.PSI_ELEMENT) - if (psiElement != null && psiElement.myManager.isStruct) { - return psiElement as? RsStructItemImpl + if(psiElement is RsStructItemImpl){ + return psiElement } - return null + val firstParent = PsiTreeUtil.findFirstParent(psiElement){it is RsStructItemImpl} + return firstParent as? RsStructItemImpl } fun String.copy() { CopyPasteManager.getInstance().setContents(StringSelection(this)) +} + +inline fun PsiElement.filterByType(): List { + return PsiTreeUtil.findChildrenOfAnyType(this, T::class.java).toList() +} + +inline fun PsiElement.findByTypeAndText(text: String): T? { + return filterByType().find { it.text == text } +} + +/** + * 递归查找符合[T]类型的第一个元素 + */ +inline fun PsiElement.findFirstChild(): T? { + try { + return PsiTreeUtil.findChildOfType(this, T::class.java) + } catch (e: Exception) { + return null + } +} + +fun PsiElement.findLastLeafChild(): PsiElement? { + return filterByType().lastOrNull() +} + + +/** + * 查找第一个匹配的[T]父元素 + */ +inline fun PsiElement.findFirstParentChild(): PsiElement? { + return PsiTreeUtil.findFirstParent(this){ + return@findFirstParent it is T + } +} + +/** + * 查找[element]在文件中的引用列表 + */ +fun PsiFile.getUseAge(element: PsiElement) : List { + return ReferencesSearch.search(element, LocalSearchScope(this)).findAll().toList() +} + +/** + * 尝试跳转到代码为止 + */ +fun PsiElement.tryNavTo() { + ApplicationManager.getApplication().invokeLater { + if (navigationElement != null && navigationElement is Navigatable && (navigationElement as Navigatable).canNavigate()) { + (navigationElement as Navigatable).navigate(true) + }else{ + FileEditorManager.getInstance(project).openFile(this.containingFile.virtualFile) + } + } } \ No newline at end of file diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiElementManager.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiElementManager.kt index e0e99b4..f9bdc77 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiElementManager.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiElementManager.kt @@ -27,10 +27,6 @@ enum class JavascriptType { Number, String, Bool, Unknown } -/// psi操作管理 -class MyRsPsiElementManager(context: PsiElement) { - val isStruct = context is RsStructItemImpl -} /// struct操作管理 class MyRsStructManager(private val psiElement: RsStructItemImpl) { @@ -47,18 +43,18 @@ class MyRsStructManager(private val psiElement: RsStructItemImpl) { ///获取表名 val getTableName: String? get() { - val outerAttr = psiElement.outerAttrList.find { it.myManager.getSeaOrmTabName != null } + val outerAttr = psiElement.outerAttrList.find { it.outerAttrManager.getSeaOrmTabName != null } ?: return null - val tabName = outerAttr.myManager.getSeaOrmTabName + val tabName = outerAttr.outerAttrManager.getSeaOrmTabName return tabName } ///主键字段 - val primaryField = fieldList.find { it.myManager.isPrimaryKey } + val primaryField = fieldList.find { it.namedFieldManager.isPrimaryKey } ///js 模型列表 val jsModelList: List = - fieldList.mapNotNull { it.myManager.getJsModel } + fieldList.mapNotNull { it.namedFieldManager.getJsModel } ///获取ts模型 val getTSInterface: String get() { @@ -193,7 +189,7 @@ class MyFieldPsiElementManager(private val psiElement: RsNamedFieldDecl) { ///查找meta,比较精确的查找 private fun hasMetaItem(name: String, filter: (item: RsMetaItem) -> Boolean): Boolean { - val find = psiElement.outerAttrList.find { it.myManager.isMeta(name) } ?: return false + val find = psiElement.outerAttrList.find { it.outerAttrManager.isMeta(name) } ?: return false val args = find.metaItem.metaItemArgs args?.metaItemList?.forEach { meta -> run { diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiFactory.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiFactory.kt index 669ae4d..501a6b8 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiFactory.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/MyRsPsiFactory.kt @@ -11,22 +11,22 @@ object MyRsPsiFactory { ///生成对象 fun generateDto(type: GenerateDtoDialogResultEnum, psiElement: RsStructItemImpl): String { - psiElement.myManager.structName ?: throw MyRsPsiFactoryError("获取名称失败") - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表明失败") + psiElement.structItemManager.structName ?: throw MyRsPsiFactoryError("获取名称失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表明失败") val generateStructName = type.getStructName(tabName) val outer = type.getOuterAttr() ///组装 val sb = StringBuilder() sb.appendLine(outer) sb.appendLine("pub struct $generateStructName {") - var fields = psiElement.myManager.fieldList + var fields = psiElement.structItemManager.fieldList fields = type.getFields(fields) fields.forEach { field -> val pre = type.preview(field) if (pre != null) { sb.appendLine(pre) } - sb.appendLine(" " + field.myManager.getSimpleText + if (field == fields.lastOrNull()) "" else ",") + sb.appendLine(" " + field.namedFieldManager.getSimpleText + if (field == fields.lastOrNull()) "" else ",") } sb.appendLine("}") return sb.toString() @@ -40,17 +40,17 @@ object MyRsPsiFactory { fun generateServiceWithAdd(psiElement: RsStructItemImpl): String { val type = GenerateDtoDialogResultEnum.AddRequest val typeResponse = GenerateDtoDialogResultEnum.Response - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") val structName = type.getStructName(tabName) val responseName = typeResponse.getStructName(tabName) ///生成字段 val sb = StringBuilder() - val fs = psiElement.myManager.fieldList + val fs = psiElement.structItemManager.fieldList fs.forEach { field -> run { - val manager = field.myManager + val manager = field.namedFieldManager if (manager.isPrimaryKey) { sb.appendLine("\t\t\t${manager.name}: NotSet,") } else { @@ -65,15 +65,15 @@ object MyRsPsiFactory { } ///获取主键字段 - val primaryField = psiElement.myManager.fieldList.find { it.myManager.isPrimaryKey } + val primaryField = psiElement.structItemManager.fieldList.find { it.namedFieldManager.isPrimaryKey } ?: throw MyRsPsiFactoryError("获取主键字段失败") ///获取除主键以外的其他字段 - val fields = psiElement.myManager.fieldList.filter { !it.myManager.isPrimaryKey } + val fields = psiElement.structItemManager.fieldList.filter { !it.namedFieldManager.isPrimaryKey } val fsb = StringBuilder() fields.forEach { field -> run { - val m = field.myManager + val m = field.namedFieldManager if(fields.lastOrNull() == field){ fsb.append("\t\t${m.name}: req.${m.name}") }else{ @@ -94,7 +94,7 @@ $sb }; let result = ${tabName.underlineToCamel.capitalizeFirstLetter()}::insert(model).exec(db).await?; Ok($responseName { - ${primaryField.myManager.name}: result.last_insert_id, + ${primaryField.namedFieldManager.name}: result.last_insert_id, $fsb }) }""".trimIndent() @@ -107,27 +107,27 @@ $fsb fun generateServiceByUpdate(psiElement: RsStructItemImpl): String { val type = GenerateDtoDialogResultEnum.UpdateRequest val typeResponse = GenerateDtoDialogResultEnum.Response - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") val structName = type.getStructName(tabName) val responseName = typeResponse.getStructName(tabName) ///获取主键字段 - val primaryField = psiElement.myManager.fieldList.find { it.myManager.isPrimaryKey } + val primaryField = psiElement.structItemManager.fieldList.find { it.namedFieldManager.isPrimaryKey } ?: throw MyRsPsiFactoryError("获取主键字段失败") - val fields = psiElement.myManager.fieldList.filter { !it.myManager.isPrimaryKey } + val fields = psiElement.structItemManager.fieldList.filter { !it.namedFieldManager.isPrimaryKey } val sb = StringBuilder() fields.forEach { - val m = it.myManager + val m = it.namedFieldManager sb.appendLine("\tmodel.${m.name} = Set(req.${it.name});") } - val responseFields = typeResponse.getFields(psiElement.myManager.fieldList) + val responseFields = typeResponse.getFields(psiElement.structItemManager.fieldList) val fsb = StringBuilder() responseFields.forEach { - val f = it.myManager.name + val f = it.namedFieldManager.name fsb.appendLine("\t\t$f: result.${f},") } @@ -138,7 +138,7 @@ pub async fn update_$tabName(req: $structName) -> AppResult<$responseName> { .get() .ok_or(anyhow::anyhow!("Database connection failed."))?; - let find = ${tabName.underlineToCamel.capitalizeFirstLetter()}::find_by_id(req.${primaryField.myManager.name}).one(db).await?; + let find = ${tabName.underlineToCamel.capitalizeFirstLetter()}::find_by_id(req.${primaryField.namedFieldManager.name}).one(db).await?; if find.is_none() { return Err(anyhow::anyhow!("${tabName.underlineToCamel.capitalizeFirstLetter()} does not exist.").into()); } @@ -161,15 +161,15 @@ $fsb */ fun generateServiceByDelete(psiElement: RsStructItemImpl): String { - val primaryField = psiElement.myManager.fieldList.find { it.myManager.isPrimaryKey } + val primaryField = psiElement.structItemManager.fieldList.find { it.namedFieldManager.isPrimaryKey } ?: throw MyRsPsiFactoryError("获取主键字段失败") - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") val text = """ - pub async fn delete_$tabName(${primaryField.myManager.name}: ${primaryField.myManager.typeString}) -> AppResult<()> { + pub async fn delete_$tabName(${primaryField.namedFieldManager.name}: ${primaryField.namedFieldManager.typeString}) -> AppResult<()> { let db = DB .get() .ok_or(anyhow::anyhow!("Database connection failed."))?; - ${tabName.underlineToCamel.capitalizeFirstLetter()}::delete_by_id(${primaryField.myManager.name}).exec(db).await?; + ${tabName.underlineToCamel.capitalizeFirstLetter()}::delete_by_id(${primaryField.namedFieldManager.name}).exec(db).await?; Ok(()) } """.trimIndent() @@ -181,13 +181,13 @@ $fsb * 获取列表 */ fun generateServiceByAll(psiElement: RsStructItemImpl): String { - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") val typeResponse = GenerateDtoDialogResultEnum.Response val typeStructName = typeResponse.getStructName(tabName) - val responseFields = typeResponse.getFields(psiElement.myManager.fieldList) + val responseFields = typeResponse.getFields(psiElement.structItemManager.fieldList) val fsb = StringBuilder() responseFields.forEach { - val f = it.myManager.name + val f = it.namedFieldManager.name fsb.appendLine("\t\t\t$f: r.${f},") } val text = """ @@ -213,11 +213,11 @@ $fsb * 获取路由 */ fun generateRouterFile(psiElement: RsStructItemImpl): String { - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") val addReq = GenerateDtoDialogResultEnum.AddRequest.getStructName(tabName) val response = GenerateDtoDialogResultEnum.Response.getStructName(tabName) val updateReq = GenerateDtoDialogResultEnum.UpdateRequest.getStructName(tabName) - val primaryField = psiElement.myManager.primaryField ?: throw MyRsPsiFactoryError("获取主键失败") + val primaryField = psiElement.structItemManager.primaryField ?: throw MyRsPsiFactoryError("获取主键失败") val text = """ use crate::{ app_writer::{AppResult, AppWriter}, @@ -231,7 +231,7 @@ $fsb Request, }; - //Router::with_path("/api/$tabName").get(get_${tabName}_all).post(post_add_$tabName).push(Router::with_path("<${primaryField.myManager.name}>").put(put_update_$tabName).delete(delete_$tabName)) + //Router::with_path("/api/$tabName").get(get_${tabName}_all).post(post_add_$tabName).push(Router::with_path("<${primaryField.namedFieldManager.name}>").put(put_update_$tabName).delete(delete_$tabName)) #[endpoint(tags("$tabName"))] pub async fn post_add_$tabName(new_$tabName: JsonBody<$addReq>) -> AppWriter<$response> { @@ -247,8 +247,8 @@ $fsb } #[endpoint(tags("$tabName"))] - pub async fn delete_$tabName(${primaryField.myManager.name}: PathParam<${primaryField.myManager.typeString}>) -> AppWriter<()> { - let result = $tabName::delete_$tabName(${primaryField.myManager.name}.0).await; + pub async fn delete_$tabName(${primaryField.namedFieldManager.name}: PathParam<${primaryField.namedFieldManager.typeString}>) -> AppWriter<()> { + let result = $tabName::delete_$tabName(${primaryField.namedFieldManager.name}.0).await; AppWriter(result) } diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/RsDotExprManager.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/RsDotExprManager.kt index 9cff52d..21f99d0 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/RsDotExprManager.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/RsDotExprManager.kt @@ -1,78 +1,3 @@ package shop.itbug.salvorstool.tool -import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil -import com.intellij.util.containers.toMutableSmartList -import org.rust.lang.core.psi.RsDotExpr -import org.rust.lang.core.psi.ext.stringValue -import org.rust.lang.core.psi.impl.RsCallExprImpl -import org.rust.lang.core.psi.impl.RsDotExprImpl -import org.rust.lang.core.psi.impl.RsLitExprImpl -import org.rust.lang.core.psi.impl.RsMethodCallImpl -import org.rust.lang.core.psi.impl.RsPathExprImpl -import shop.itbug.salvorstool.model.SalvoApiItem -import shop.itbug.salvorstool.model.SalvoApiItemMethod - -val RsDotExprImpl.myManager: DotExprManager get() = DotExprManager(this) - -//表达式 -class DotExprManager(private val dotExpr: RsDotExprImpl) { - - ///常见函数 - private val salvoMethod: SalvoApiItemMethod? get() { - return dotExpr.methodCall?.methodManager?.myApiMethod - } - - private val isPushDot: Boolean - get() { - return dotExpr.methodCall?.identifier?.text == "push" - } - - //是否为路由请求path - val isRouterWith: Boolean - get() { - val call = rsCallExpr ?: return false - return PsiTreeUtil.findChildOfType(call, RsPathExprImpl::class.java)?.text == "Router::with_path" - } - - //获取api - val startApi: String? - get() { - if (isRouterWith.not()) return null - if (rsCallExpr == null) return null - val arg = rsCallExpr!!.valueArgumentList - val lit = PsiTreeUtil.findChildOfType(arg, RsLitExprImpl::class.java) ?: return null - return lit.stringValue - } - - private val rsCallExpr: RsCallExprImpl? - get() { - return PsiTreeUtil.findChildOfType(getFinalDotExpr, RsCallExprImpl::class.java) - } - - private val getFinalDotExpr: RsDotExprImpl - get() { - val find = PsiTreeUtil.findChildOfType(dotExpr, RsDotExprImpl::class.java) - return find ?: dotExpr - } - - private val getPushDotExpr: RsDotExprImpl? - get() { - val arg = dotExpr.methodCall?.valueArgumentList ?: return null - return PsiTreeUtil.findChildrenOfType(arg, RsDotExprImpl::class.java).firstOrNull() - } - - - fun getApiItemList(): List { - return getSimpleApiItemList() - } - - - private fun getSimpleApiItemList(): List { - val list = PsiTreeUtil.findChildrenOfType(dotExpr, RsMethodCallImpl::class.java) - .filter { it.methodManager.myApiMethod != null }.mapNotNull { it.methodManager.getApiItem() }.toList() - return list - } - -} diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/RsLetDeclManager.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/RsLetDeclManager.kt index 47ba381..9c57078 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/RsLetDeclManager.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/RsLetDeclManager.kt @@ -1,42 +1,80 @@ package shop.itbug.salvorstool.tool +import com.intellij.openapi.project.Project import com.intellij.psi.util.PsiTreeUtil -import org.rust.lang.core.psi.RsCallExpr -import org.rust.lang.core.psi.RsDotExpr -import org.rust.lang.core.psi.ext.stringValue -import org.rust.lang.core.psi.impl.RsCallExprImpl -import org.rust.lang.core.psi.impl.RsDotExprImpl -import org.rust.lang.core.psi.impl.RsLetDeclImpl -import org.rust.lang.core.psi.impl.RsLitExprImpl -import org.rust.lang.core.psi.impl.RsPathExprImpl -import org.rust.lang.core.psi.impl.RsPathImpl +import org.rust.lang.core.psi.impl.* import shop.itbug.salvorstool.model.SalvoApiItem -val RsLetDeclImpl.myManager get() = RsLetDeclManager(this) +val RsLetDeclImpl.rsLetDeclImplManager get() = RsLetDeclManager(this) + +/** + * let 表达式 + * 例子: + * let product_router = Router::with_path("/api/product").get(get_product_all) + * .post(post_add_product) + * .push( + * Router::with_path("") + * .put(put_update_product) + * .delete(delete_product), + * ); + */ + + +data class LetModel( + ///表达式名称 -> product_router + val letName: String? = null +) + -//let表达式相关操作 class RsLetDeclManager(val psi: RsLetDeclImpl) { - //api - val apiStartString: String? + val project: Project = psi.project + val getModel: LetModel get() { - val dot = firstDotExprImpl ?: return null - return DotExprManager(dot).startApi + return LetModel(letName = psi.pat?.text) } - // first dot - private val firstDotExprImpl: RsDotExprImpl? - get() { - return PsiTreeUtil.findChildrenOfAnyType(psi, RsDotExprImpl::class.java).firstOrNull() as? RsDotExprImpl - } + /// 获取root ele 节点 + private val rootMethodExpr: RsMethodCallExprImpl? get() { + val root = PsiTreeUtil.findChildOfType(psi, RsMethodCallExprImpl::class.java) + return PsiTreeUtil.findChildOfType(root, RsMethodCallExprImpl::class.java) ?: root + } + - // api list - val apiList: List + ///获取所有的api列表 + val allApi: List get() { - val dot = firstDotExprImpl ?: return emptyList() - val list = dot.myManager.getApiItemList() -// println("\n$list\n") - return list + val result = mutableListOf() + val root = rootMethodExpr ?: return emptyList() + val rootManager = root.methodCallExprManager() + val rootApi = rootManager.rootApiPath ?: return emptyList() + val rootMethods = rootManager.getAllApiMethods + //添加root path + rootMethods.forEach { + result.add(SalvoApiItem(rootApi,it.method,it.element)) + } + + // 添加子URL + allPushMethodCall.forEach { + val manager = it.methodCallManager + val methods = manager.allMethods + methods.forEach { methodFun -> + val api = rootApi + "/"+ manager.withPathString + result.add(SalvoApiItem(api,methodFun.method,methodFun.element)) + } + } + return result.toList() } + + ///全部带有push的节点 + val allPushMethodCall: List get() { + val allPushPsiElement = PsiTreeUtil.findChildrenOfType(psi, RsMethodCallImpl::class.java).filter { it.methodCallManager.isPushMethodCall } + return allPushPsiElement + } + + + + + } diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallExprImplManager.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallExprImplManager.kt new file mode 100644 index 0000000..0f471be --- /dev/null +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallExprImplManager.kt @@ -0,0 +1,64 @@ +package shop.itbug.salvorstool.tool + +import com.intellij.psi.PsiElement +import com.intellij.psi.util.PsiTreeUtil +import org.rust.lang.core.psi.RsExpr +import org.rust.lang.core.psi.impl.* +import shop.itbug.salvorstool.model.SalvoApiItemFunction +import shop.itbug.salvorstool.model.SalvoApiItemMethod + +fun RsMethodCallExprImpl.methodCallExprManager() = RsMethodCallExprImplFactory(this) + + class RsMethodCallExprImplFactory(private val methodPsiElement: RsMethodCallExprImpl) { + + + ///获取接口路径 + val rootApiPath: String? + get() { + val rec: RsCallExprImpl? = PsiTreeUtil.findChildOfType(methodPsiElement,RsCallExprImpl::class.java) + if (rec != null) { + val exCall = rec + if (exCall.firstChild is RsPathExprImpl && exCall.firstChild.text == "Router::with_path") { + var apiText = (exCall.valueArgumentList.exprList.first() as? RsLitExprImpl)?.stringLiteral?.text ?: "" + if (apiText.startsWith("\"")) { + apiText = apiText.removePrefix("\"") + } + if (apiText.endsWith("\"")) { + apiText = apiText.removeSuffix("\"") + } + return apiText + } + } + return null + } + + + val getAllApiMethods: List + get() { + val list = mutableListOf() + val children = PsiTreeUtil.findChildrenOfAnyType(methodPsiElement, RsMethodCallImpl::class.java) + children.forEach { + val manager = RsMethodCallImplFactory(it) + val methodType = manager.getApiType + list.add(SalvoApiItemFunction(methodType,it)) + } + return list.filter { it.method != SalvoApiItemMethod.Unknown } + } + + + private class RsMethodCallImplFactory(private val methodCallPsiElement: RsMethodCallImpl) { + val getApiType: SalvoApiItemMethod + get() { + return when (methodCallPsiElement.identifier.text) { + "put" -> SalvoApiItemMethod.Put + "get" -> SalvoApiItemMethod.Get + "delete" -> SalvoApiItemMethod.Delete + "post" -> SalvoApiItemMethod.Post + "update" -> SalvoApiItemMethod.Update + "patch" -> SalvoApiItemMethod.Patch + else -> SalvoApiItemMethod.Unknown + } + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallManager.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallManager.kt index a6321ec..07458d4 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallManager.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/RsMethodCallManager.kt @@ -1,66 +1,52 @@ package shop.itbug.salvorstool.tool -import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.rust.lang.core.psi.RsMethodCall -import org.rust.lang.core.psi.impl.RsDotExprImpl -import org.rust.lang.core.psi.impl.RsLetDeclImpl +import org.rust.lang.core.psi.impl.RsCallExprImpl +import org.rust.lang.core.psi.impl.RsLitExprImpl +import org.rust.lang.core.psi.impl.RsMethodCallExprImpl import org.rust.lang.core.psi.impl.RsPathExprImpl -import shop.itbug.salvorstool.model.SalvoApiItem -import shop.itbug.salvorstool.model.SalvoApiItemMethod -import java.util.* +import shop.itbug.salvorstool.model.SalvoApiItemFunction -val RsMethodCall.methodManager: RsMethodCallManager get() = RsMethodCallManager(this) +val RsMethodCall.methodCallManager: RsMethodCallManager get() = RsMethodCallManager(this) -/// method call -class RsMethodCallManager(val psiElement: RsMethodCall) { +/** + * + * push( + * Router::with_path("") + * .put(put_update_post) + * .delete(delete_post) + * .get(get_post_by_id), + * ) + */ - private val myIdText: String get() = psiElement.identifier.text - //是否有push函数 - private val hasPush: Boolean get() = dtoChild != null +class RsMethodCallManager(val psiElement: RsMethodCall) { - //找到dot - private val dtoChild: RsDotExprImpl? - get() { - val va = psiElement.valueArgumentList - return PsiTreeUtil.findChildOfType(va, RsDotExprImpl::class.java) - } + ///返回 push + private val myIdText: String get() = psiElement.identifier.text - // rsPath - val rsPathChild: RsPathExprImpl? - get() { - val va = psiElement.valueArgumentList - return PsiTreeUtil.findChildOfType(va, RsPathExprImpl::class.java) - } + ///是否 .push + val isPushMethodCall: Boolean get() = myIdText == "push" - // method - val myApiMethod: SalvoApiItemMethod? - get() { - return SalvoApiItemMethod.entries.find { it.name.lowercase(Locale.getDefault()) == myIdText.lowercase(Locale.getDefault()) } + /// 返回 + val withPathString : String get() { + val eles = PsiTreeUtil.findChildrenOfType(psiElement.valueArgumentList,RsCallExprImpl::class.java).filter { it.firstChild is RsPathExprImpl && it.firstChild.text == "Router::with_path" } + if(eles.isNotEmpty()){ + val first = eles.first() + val lit = first.valueArgumentList.exprList.firstOrNull() as? RsLitExprImpl + return lit?.stringLiteral?.text?.replace("\"","") ?: "" } - - - // 生成item - fun getApiItem(): SalvoApiItem? { - val m = myApiMethod ?: return null - val dots = getParentList(psiElement).reversed() - val finalUrl = dots.map { it.myManager.startApi }.joinToString("/") - return SalvoApiItem(finalUrl, m,psiElement) + return "" } -} -private fun getParentList(element: RsMethodCall): List { - val parentList = mutableListOf() - var currentElement: PsiElement? = element.parent - while (currentElement != null) { - if (currentElement is RsDotExprImpl && currentElement.myManager.startApi != null && currentElement.myManager.isRouterWith && parentList.find { it.myManager.startApi == (currentElement as RsDotExprImpl).myManager.startApi } == null) { - parentList.add(currentElement) - } - currentElement = currentElement.parent - if (currentElement is RsLetDeclImpl) { - break + /// 获取全部的get,post.... + val allMethods : List get() { + val expr: RsMethodCallExprImpl? = psiElement.valueArgumentList.exprList.firstOrNull() as? RsMethodCallExprImpl + if(expr != null){ + return expr.methodCallExprManager().getAllApiMethods } + return emptyList() } - return parentList -} \ No newline at end of file + +} diff --git a/src/main/kotlin/shop/itbug/salvorstool/tool/Tools.kt b/src/main/kotlin/shop/itbug/salvorstool/tool/Tools.kt index d25f03d..01c577b 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/tool/Tools.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/tool/Tools.kt @@ -78,7 +78,7 @@ object Tools { } fun getServiceImportPackages(psiElement: RsStructItemImpl) : String { - val tabName = psiElement.myManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") + val tabName = psiElement.structItemManager.getTableName ?: throw MyRsPsiFactoryError("获取表名失败") return """ use crate::{ app_writer::AppResult, diff --git a/src/main/kotlin/shop/itbug/salvorstool/window/ApiScanWindow.kt b/src/main/kotlin/shop/itbug/salvorstool/window/ApiScanWindow.kt index d9cd5a8..221d787 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/window/ApiScanWindow.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/window/ApiScanWindow.kt @@ -85,7 +85,7 @@ class ApiScanWindow(private val myProject: Project, toolWindow: ToolWindow) : Bo if (!it.valueIsAdjusting) { val selectedIndex = list.selectedIndex if (selectedIndex != -1) { - list.selectedValue.navTo(myProject) + list.selectedValue.navTo() } } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 69ab6ed..ee987c0 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -5,6 +5,7 @@ com.intellij.modules.platform com.jetbrains.rust JavaScriptBase + org.toml.lang messages.pluginBundle @@ -20,7 +21,7 @@ - + @@ -46,10 +47,18 @@ + + + + + + @@ -65,8 +74,9 @@ - + text="Sea Orm Commands" popup="true" + class="shop.itbug.salvorstool.action.seaorm.SeamOrmCommandActionGroup"> + @@ -90,6 +100,5 @@ - \ No newline at end of file diff --git a/src/main/resources/messages/pluginBundle.properties b/src/main/resources/messages/pluginBundle.properties index 26176c4..fe42155 100644 --- a/src/main/resources/messages/pluginBundle.properties +++ b/src/main/resources/messages/pluginBundle.properties @@ -26,3 +26,5 @@ valid_failed=数据验证失败 sea_orm_json_tips=输入json字符串,只支持简单的对象,不支持嵌套对象和数组 run=运行 + +nav_to_psi=跳转到 diff --git a/src/main/resources/messages/pluginBundle_ar.properties b/src/main/resources/messages/pluginBundle_ar.properties index 47dc19a..47cbad2 100644 --- a/src/main/resources/messages/pluginBundle_ar.properties +++ b/src/main/resources/messages/pluginBundle_ar.properties @@ -26,3 +26,5 @@ valid_failed=فشل التحقق من البيانات sea_orm_json_tips=أدخل جسون سلسلة ، فقط دعم الكائنات البسيطة ، لا تدعم الكائنات المتداخلة والمصفوفات run=تشغيل . + +nav_to_psi=القفز diff --git a/src/main/resources/messages/pluginBundle_de.properties b/src/main/resources/messages/pluginBundle_de.properties index d6c9af9..6b500dc 100644 --- a/src/main/resources/messages/pluginBundle_de.properties +++ b/src/main/resources/messages/pluginBundle_de.properties @@ -26,3 +26,5 @@ valid_failed=Datenvalidierung fehlgeschlagen sea_orm_json_tips=JSON-Zeichenfolge eingeben, unterstützt nur einfache Objekte, unterstützt keine verschachtelten Objekte und Arrays run=Funktion + +nav_to_psi=Springen zu diff --git a/src/main/resources/messages/pluginBundle_en.properties b/src/main/resources/messages/pluginBundle_en.properties index b1cce6e..e114eba 100644 --- a/src/main/resources/messages/pluginBundle_en.properties +++ b/src/main/resources/messages/pluginBundle_en.properties @@ -26,3 +26,5 @@ valid_failed=Data validation failed sea_orm_json_tips=Input JSON string, only supports simple objects, does not support nested objects and arrays run=function + +nav_to_psi=Jump to diff --git a/src/main/resources/messages/pluginBundle_fr.properties b/src/main/resources/messages/pluginBundle_fr.properties index 708dc18..b2c42e1 100644 --- a/src/main/resources/messages/pluginBundle_fr.properties +++ b/src/main/resources/messages/pluginBundle_fr.properties @@ -26,3 +26,5 @@ valid_failed=Échec de la validation des données sea_orm_json_tips=Entrez une chaîne json, seuls les objets simples sont pris en charge, pas les objets imbriqués et les tableaux run=Fonctionnement + +nav_to_psi=Sauter à diff --git a/src/main/resources/messages/pluginBundle_hk.properties b/src/main/resources/messages/pluginBundle_hk.properties index e2267a3..aed2143 100644 --- a/src/main/resources/messages/pluginBundle_hk.properties +++ b/src/main/resources/messages/pluginBundle_hk.properties @@ -24,3 +24,5 @@ preview-the-code=程式碼預覽 sea_orm_json_tips=輸入json字串,只支持簡單的對象,不支持嵌套對象和數組 run=運行 + +nav_to_psi=跳轉到 diff --git a/src/main/resources/messages/pluginBundle_it.properties b/src/main/resources/messages/pluginBundle_it.properties index 1f278ef..4604abf 100644 --- a/src/main/resources/messages/pluginBundle_it.properties +++ b/src/main/resources/messages/pluginBundle_it.properties @@ -26,3 +26,5 @@ valid_failed=Validazione dei dati non riuscita sea_orm_json_tips=Stringa JSON di input, supporta solo oggetti semplici, non supporta oggetti nidificati e array run=funzione + +nav_to_psi=Vai a diff --git a/src/main/resources/messages/pluginBundle_ja.properties b/src/main/resources/messages/pluginBundle_ja.properties index e5a7f69..d4291b0 100644 --- a/src/main/resources/messages/pluginBundle_ja.properties +++ b/src/main/resources/messages/pluginBundle_ja.properties @@ -26,3 +26,5 @@ valid_failed=データ検証に失敗しました sea_orm_json_tips=単純なオブジェクトのみをサポートし、ネストされたオブジェクトや配列はサポートしないjson文字列を入力します run=うんてん + +nav_to_psi=ジャンプ先 diff --git a/src/main/resources/messages/pluginBundle_ko.properties b/src/main/resources/messages/pluginBundle_ko.properties index a57f142..a631223 100644 --- a/src/main/resources/messages/pluginBundle_ko.properties +++ b/src/main/resources/messages/pluginBundle_ko.properties @@ -26,3 +26,5 @@ valid_failed=데이터 검증 실패 sea_orm_json_tips=json 문자열을 입력하십시오. 간단한 객체만 지원하고 중첩된 객체와 배열은 지원되지 않습니다. run=실행 + +nav_to_psi=다음으로 이동 diff --git a/src/main/resources/messages/pluginBundle_nl.properties b/src/main/resources/messages/pluginBundle_nl.properties index 2618146..c78fba8 100644 --- a/src/main/resources/messages/pluginBundle_nl.properties +++ b/src/main/resources/messages/pluginBundle_nl.properties @@ -26,3 +26,5 @@ valid_failed=Gegevensvalidatie mislukt sea_orm_json_tips=JSON-tekenreeks invoeren, ondersteunt alleen eenvoudige objecten, ondersteunt geen geneste objecten en arrays run=functie + +nav_to_psi=Ga naar diff --git a/src/main/resources/messages/pluginBundle_pl.properties b/src/main/resources/messages/pluginBundle_pl.properties index 48f3f01..9b56073 100644 --- a/src/main/resources/messages/pluginBundle_pl.properties +++ b/src/main/resources/messages/pluginBundle_pl.properties @@ -26,3 +26,5 @@ valid_failed=Niepowodzenie walidacji danych sea_orm_json_tips=Wprowadzanie łańcucha JSON, obsługuje tylko proste obiekty, nie obsługuje zagnieżdżonych obiektów i tablic run=funkcja + +nav_to_psi=Przejdź do diff --git a/src/main/resources/messages/pluginBundle_pt.properties b/src/main/resources/messages/pluginBundle_pt.properties index 7d3cd0d..eaa6328 100644 --- a/src/main/resources/messages/pluginBundle_pt.properties +++ b/src/main/resources/messages/pluginBundle_pt.properties @@ -26,3 +26,5 @@ valid_failed=A validação dos dados falhou sea_orm_json_tips=Entrada JSON string, suporta apenas objetos simples, não suporta objetos aninhados e arrays run=função + +nav_to_psi=Saltar para diff --git a/src/main/resources/messages/pluginBundle_ru.properties b/src/main/resources/messages/pluginBundle_ru.properties index 3fa6e3d..f292fff 100644 --- a/src/main/resources/messages/pluginBundle_ru.properties +++ b/src/main/resources/messages/pluginBundle_ru.properties @@ -26,3 +26,5 @@ valid_failed=Ошибка проверки данных sea_orm_json_tips=Введите строку json, которая поддерживает только простые объекты, а не встроенные объекты и массивы run=Запуск + +nav_to_psi=Перейти на From 721414ab7aef3eaabc2d996a02d6f20cec99833e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E5=85=B8=E5=85=B8?= <413153189@qq.com> Date: Fri, 19 Jul 2024 15:09:46 +0800 Subject: [PATCH 2/2] release 2.0.0 --- CHANGELOG.md | 6 ++++ build.gradle.kts | 2 +- .../action/GenerateHookFormAction.kt | 4 +-- src/main/resources/META-INF/plugin.xml | 36 +++++++++++-------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90fe37c..8e14d7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [2.0.0] -2024-07-19 + +- Completely rewritten `salvo api` scanning implementation +- Added right-click menu operation function to jump to `salvo router handle` +- Group `salvo` Code generate function operations +- [changelog](https://mdddj.github.io/SalvoRsToolDocument/changelog%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97.html) ## [1.9.0] -2024-07-04 diff --git a/build.gradle.kts b/build.gradle.kts index c71f786..2396cd4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "shop.itbug" -version = "1.9.0" +version = "2.0.0" repositories { mavenCentral() diff --git a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt index 6581178..f19485a 100644 --- a/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt +++ b/src/main/kotlin/shop/itbug/salvorstool/action/GenerateHookFormAction.kt @@ -5,11 +5,10 @@ import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper +import com.intellij.ui.components.JBLabel import com.intellij.ui.components.JBTabbedPane import org.rust.lang.core.psi.impl.RsStructItemImpl -import shop.itbug.salvorstool.tool.myManager import shop.itbug.salvorstool.tool.tryGetRsStructPsiElement -import shop.itbug.salvorstool.widget.TypeJavaScriptEditor import javax.swing.JComponent class GenerateHookFormAction : AnAction() { @@ -31,6 +30,7 @@ class GenerateHookFormAction : AnAction() { private val tab = JBTabbedPane() init { + tab.add(JBLabel("Removed!")) super.init() } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index ee987c0..30de41a 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -24,28 +24,41 @@ + + - - - + + + + + text="Generate Antd From"/> + + + + + + + + + + - + + - + @@ -57,16 +70,11 @@ - - + + - - - - -