first commint

pull/376/head
John Mai 11 months ago
parent afe711755b
commit a55e9187ac

@ -1,23 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Please do not use this issue tracker for support or questions, use Forum or Slack listed here:
https://plugins.jetbrains.com/docs/intellij/getting-help.html
Please **always** provide link to sources if possible. -->
**Describe the bug:**
<!-- A clear and concise description of what the bug is. -->
**Steps to reproduce:**
<!-- Steps to reproduce the issue. -->
**Expected behavior:**
<!-- A clear and concise description of what you expected to happen. -->
**Additional context:**
<!-- Add any other context about the problem here. -->

@ -1,17 +0,0 @@
# Dependabot configuration:
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for Gradle dependencies
- package-ecosystem: "gradle"
directory: "/"
target-branch: "next"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "next"
schedule:
interval: "daily"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

@ -1,52 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="2024" height="305" viewBox="0 0 745.71429 112.5">
<defs>
<linearGradient id="linear-gradient" x1="21.98732" y1="-879.27899" x2="91.77826" y2="-949.06994" gradientTransform="matrix(1, 0, 0, -1, 0, -853.5)" gradientUnits="userSpaceOnUse">
<stop offset="0.15937" stop-color="#3bea62"/>
<stop offset="0.5404" stop-color="#3c99cc"/>
<stop offset="0.93739" stop-color="#6b57ff"/>
</linearGradient>
</defs>
<g>
<g fill="#fff">
<g>
<path d="M112.7808,40.71086l1.61129-1.40324c1.21437,1.86213,2.45824,2.864,4.5225,2.864,2.23248,0,3.8718-1.63342,3.8718-4.81172V23.93107h2.262V37.33336a7.2901,7.2901,0,0,1-1.809,5.26766,6.02144,6.02144,0,0,1-4.35283,1.66145A6.76237,6.76237,0,0,1,112.7808,40.71086Z"/>
<path d="M128.35213,36.61625v-.05607c0-4.26724,2.9688-7.70377,7.01027-7.70377,4.32479,0,6.81254,3.49259,6.81254,7.81739a5.86042,5.86042,0,0,1-.028.71564H130.55805a5.13042,5.13042,0,0,0,5.14371,5.01091,6.01592,6.01592,0,0,0,4.60808-2.08936l1.356,1.2306a7.50169,7.50169,0,0,1-6.02019,2.777C131.63224,44.31854,128.35213,41.19779,128.35213,36.61625Zm11.61836-.85877c-.22723-2.69137-1.75293-5.04042-4.66416-5.04042-2.54383,0-4.46645,2.14838-4.74828,5.04042Z"/>
<path d="M146.04527,40.05277V31.1184H144.009V29.1707h2.03625V24.70425h2.17642V29.1707h4.63465v1.9477h-4.63465v8.64812a2.17465,2.17465,0,0,0,2.45824,2.46267,4.53615,4.53615,0,0,0,2.12035-.51644v1.89016a5.4128,5.4128,0,0,1-2.62941.63C147.82624,44.233,146.04527,43.05844,146.04527,40.05277Z"/>
<path d="M156.35926,23.93107h8.42384a7.21772,7.21772,0,0,1,5.17323,1.77509,4.48482,4.48482,0,0,1,1.27191,3.20781V28.97a4.8351,4.8351,0,0,1-3.13846,4.63909c2.34611.71711,4.24068,2.09083,4.24068,4.83975v.05755c0,3.43652-2.85515,5.46981-7.17995,5.46981h-8.79125Zm12.607,5.29865c0-1.97722-1.55374-3.26536-4.38087-3.26536h-6.02018v6.90107h5.85051c2.68547,0,4.55054-1.2306,4.55054-3.57965Zm-4.1551,5.63949h-6.24595v7.07372h6.64139c2.99681,0,4.86189-1.34569,4.86189-3.57965v-.05754C170.06846,36.12932,168.25945,34.86921,164.81113,34.86921Z"/>
<path d="M175.69173,29.1707h2.1764v3.8659a6.26083,6.26083,0,0,1,5.9641-4.12264v2.37561H183.664c-3.19453,0-5.7959,2.31954-5.7959,6.78746v5.89919h-2.17642Z"/>
<path d="M184.62166,39.67946v-.05607c0-3.12223,2.54383-4.78221,6.24742-4.78221a15.34686,15.34686,0,0,1,4.49448.63007v-.51646c0-2.66186-1.61129-4.03706-4.35283-4.03706a10.05314,10.05314,0,0,0-4.43842,1.08894l-.64923-1.80457a11.92286,11.92286,0,0,1,5.3134-1.23208,6.36624,6.36624,0,0,1,4.72023,1.63342,5.88893,5.88893,0,0,1,1.49767,4.32332v9.04946h-2.09082v-2.234a6.378,6.378,0,0,1-5.28684,2.54825C187.36469,44.29051,184.62166,42.71611,184.62166,39.67946Zm10.76995-1.145V37.10318a15.03578,15.03578,0,0,0-4.29676-.63006c-2.74154,0-4.26724,1.20255-4.26724,3.06469v.05607c0,1.86212,1.69539,2.94959,3.67408,2.94959C193.18715,42.54348,195.39161,40.8835,195.39161,38.53446Z"/>
<path d="M201.43834,23.50169h2.48775v2.43463h-2.48775Zm.14165,5.669h2.17641V43.97622H201.58Z"/>
<path d="M208.10629,29.1707h2.17642v2.57776a5.52394,5.52394,0,0,1,5.00354-2.89205c3.53392,0,5.5967,2.40512,5.5967,5.92722v9.19258h-2.17642V35.3281c0-2.74892-1.46965-4.46644-4.0415-4.46644a4.33064,4.33064,0,0,0-4.38234,4.63908v8.47548h-2.17643Z"/>
<path d="M223.595,42.08458l1.10223-1.57291a8.48365,8.48365,0,0,0,5.05962,1.88868c1.75147,0,3.02485-.91631,3.02485-2.34758v-.05754c0-1.48882-1.7249-2.06132-3.64753-2.60579-2.28857-.65809-4.83237-1.46078-4.83237-4.18167V33.1517c0-2.54825,2.09084-4.23774,4.974-4.23774a9.88682,9.88682,0,0,1,5.25732,1.63194l-.9886,1.66146a8.188,8.188,0,0,0-4.32478-1.43277c-1.72491,0-2.82714.91631-2.82714,2.1469v.059c0,1.40175,1.809,1.94625,3.75965,2.54677,2.26051.6876,4.69219,1.57587,4.69219,4.23921V39.824c0,2.80648-2.29,4.43841-5.20126,4.43841A9.96351,9.96351,0,0,1,223.595,42.08458Z"/>
</g>
<g>
<path d="M115.968,52.15661h3.9692V87.79078H115.968Z"/>
<path d="M124.30768,81.986l2.864-2.49366c2.16019,3.30815,4.37053,5.0906,8.03872,5.0906,3.96772,0,6.8819-2.90089,6.8819-8.5522V52.15661h4.01936v23.824c0,4.17281-1.20551,7.33046-3.2152,9.3667a10.71062,10.71062,0,0,1-7.73622,2.95106A12.0199,12.0199,0,0,1,124.30768,81.986Z"/>
<path d="M165.55775,52.15661H178.7195c7.9369,0,13.16177,4.2761,13.16177,11.29964v.10329c0,7.68606-6.33,11.65672-13.81544,11.65672h-8.54039V87.79077h-3.96772ZM178.21636,71.551c5.82837,0,9.64558-3.15617,9.64558-7.83952v-.10181c0-5.0906-3.767-7.73771-9.44342-7.73771h-8.89308V71.551Z"/>
<path d="M196.3079,50.62793h3.86886V87.79076H196.3079Z"/>
<path d="M204.69779,80.15339v-.10033c0-5.54949,4.521-8.502,11.10342-8.502a27.211,27.211,0,0,1,7.98706,1.11994v-.91631c0-4.73352-2.864-7.177-7.73624-7.177a17.9221,17.9221,0,0,0-7.88821,1.93295l-1.15535-3.20634a21.22123,21.22123,0,0,1,9.4449-2.18822c3.66819,0,6.48056.96648,8.3899,2.90089,1.75885,1.78245,2.66186,4.32627,2.66186,7.68755V87.79076h-3.71689V83.81862A11.32989,11.32989,0,0,1,214.39351,88.35C209.57149,88.35,204.69779,85.5509,204.69779,80.15339Zm19.14065-2.03624V75.57333a26.73167,26.73167,0,0,0-7.63589-1.12139c-4.87369,0-7.58572,2.13951-7.58572,5.44768v.1018c0,3.30963,3.01453,5.24259,6.53071,5.24259,4.77187,0,8.6909-2.95109,8.6909-7.12686Z"/>
<path d="M234.3413,80.81591V64.93325h-3.61654V61.47164h3.61654V53.53031h3.86885v7.94133h8.2394v3.46161h-8.2394V80.30686c0,3.20781,1.75884,4.37791,4.37055,4.37791a8.05285,8.05285,0,0,0,3.767-.91631v3.35979a9.6214,9.6214,0,0,1-4.67157,1.11993C237.50632,88.24818,234.3413,86.16177,234.3413,80.81591Z"/>
<path d="M252.22922,64.93325h-3.56636v-3.41h3.56636V59.23178c0-3.00271.80416-5.29422,2.26051-6.77123a7.59978,7.59978,0,0,1,5.57753-2.03625,11.59177,11.59177,0,0,1,4.2702.66252v3.40995a12.78069,12.78069,0,0,0-3.76851-.661c-3.01452,0-4.521,1.83261-4.521,5.59965v2.138h8.23938v3.35979h-8.1892V87.79075h-3.86886Z"/>
<path d="M264.59124,74.75884v-.10329a13.53974,13.53974,0,1,1,27.07755-.10033v.10034A13.57821,13.57821,0,0,1,278.054,88.40164,13.39652,13.39652,0,0,1,264.59124,74.75884Zm23.10837,0v-.10329c0-5.64982-4.16987-10.28153-9.64558-10.28153-5.6262,0-9.495,4.63171-9.495,10.1812v.10033c0,5.6513,4.1197,10.23284,9.5954,10.23284C283.78058,84.88838,287.69961,80.30685,287.69961,74.75884Z"/>
<path d="M296.1441,61.47164H300.013v6.87157c1.90787-4.37644,5.67637-7.53409,10.60023-7.33047v4.22594h-.30249c-5.67637,0-10.29777,4.12264-10.29777,12.064V87.79075h-3.86885Z"/>
<path d="M313.98036,61.47164h3.86885v4.42808c1.7072-2.59547,4.01788-4.98731,8.38843-4.98731a8.81582,8.81582,0,0,1,8.33973,5.24257,10.32787,10.32787,0,0,1,9.14388-5.24257c5.9774,0,9.64558,4.07247,9.64558,10.58844v16.2899H349.498V72.41568c0-5.0906-2.51136-7.94133-6.73138-7.94133-3.919,0-7.18438,2.954-7.18438,8.145V87.79076H331.765V72.31535c0-4.93862-2.563-7.841-6.6827-7.841-4.11823,0-7.23307,3.46161-7.23307,8.29841v15.018h-3.86886Z"/>
<path d="M372.31491,52.15661h13.16177c7.93544,0,13.16177,4.2761,13.16177,11.29964v.10329c0,7.68606-6.33,11.65672-13.8169,11.65672h-8.5404V87.79077h-3.96624ZM384.97205,71.551c5.82837,0,9.647-3.15617,9.647-7.83952v-.10181c0-5.0906-3.76851-7.73771-9.44344-7.73771h-8.89451V71.551Z"/>
<path d="M403.06211,50.62793H406.931V87.79076h-3.86886Z"/>
<path d="M413.0131,77.81319V61.47164H416.879V76.84525c0,4.887,2.61464,7.94133,7.18584,7.94133,4.42072,0,7.78494-3.30816,7.78494-8.24677V61.47164h3.81868V87.79077H431.8498v-4.583A9.87131,9.87131,0,0,1,422.95823,88.35C416.67837,88.35,413.0131,84.07389,413.0131,77.81319Z"/>
<path d="M441.55,92.37083l1.75885-3.05438a16.446,16.446,0,0,0,9.99824,3.36127c5.72506,0,9.44344-3.20782,9.44344-9.3667V80.205c-2.26054,3.05438-5.427,5.54949-10.1989,5.54949A12.08515,12.08515,0,0,1,440.346,73.43379v-.10034a12.26417,12.26417,0,0,1,22.35433-7.12683v-4.735h3.86886V83.20775c0,4.0725-1.207,7.17848-3.317,9.31652-2.31066,2.34168-5.77523,3.51178-9.89495,3.51178A20.18232,20.18232,0,0,1,441.55,92.37083Zm21.30083-18.98719v-.10182c0-5.396-4.62137-8.9078-9.54379-8.9078a8.64347,8.64347,0,0,0-8.99486,8.85616v.10328a8.84778,8.84778,0,0,0,8.99486,8.95946C458.22945,82.29292,462.85082,78.67785,462.85082,73.38364Z"/>
<path d="M472.80183,51.39226h4.42072v4.32627h-4.42072Zm.25082,10.07938h3.86886V87.79076h-3.86886Z"/>
<path d="M483.40207,61.47164h3.86885v4.58153a9.81531,9.81531,0,0,1,8.89157-5.14076c6.27986,0,9.94807,4.2761,9.94807,10.53679V87.79075h-3.86885V72.41568c0-4.887-2.61171-7.94133-7.1829-7.94133-4.4709,0-7.78789,3.30963-7.78789,8.24826V87.79078h-3.86885Z"/>
<path d="M534.19883,55.872H522.34144V52.15661h27.681V55.872H538.168V87.79078h-3.9692Z"/>
<path d="M546.31,74.70719v-.10181c0-7.58425,5.27358-13.693,12.45648-13.693,7.68754,0,12.10826,6.209,12.10826,13.89659a10.352,10.352,0,0,1-.05017,1.2719H550.22611c.55481,5.70147,4.521,8.90929,9.14539,8.90929a10.68587,10.68587,0,0,0,8.18628-3.7154l2.414,2.18822a13.3417,13.3417,0,0,1-10.70058,4.93861C552.13543,88.40163,546.31,82.85215,546.31,74.70719ZM566.95574,73.18c-.40134-4.78516-3.1134-8.95945-8.28958-8.95945-4.521,0-7.93541,3.81868-8.44005,8.95945Z"/>
<path d="M575.15085,61.47164h3.86886v4.42808c1.70573-2.59547,4.01639-4.98731,8.38693-4.98731a8.81427,8.81427,0,0,1,8.33971,5.24257,10.33034,10.33034,0,0,1,9.14538-5.24257c5.97592,0,9.64408,4.07247,9.64408,10.58844v16.2899H610.667V72.41568c0-5.0906-2.51136-7.94133-6.73139-7.94133-3.919,0-7.1829,2.954-7.1829,8.145V87.79076H592.934V72.31535c0-4.93862-2.56153-7.841-6.68121-7.841s-7.23307,3.46161-7.23307,8.29841v15.018h-3.86886Z"/>
<path d="M620.26974,61.47164h3.86886v5.29422c2.11-3.15617,5.17323-5.85345,9.94513-5.85345,6.22969,0,12.40925,4.98731,12.40925,13.64281v.10033c0,8.60384-6.12939,13.69447-12.40925,13.69447a11.68492,11.68492,0,0,1-9.94513-5.59966V95.93574h-3.86886Zm22.254,13.23555v-.10181c0-6.21053-4.22-10.1812-9.14244-10.1812-4.82207,0-9.39326,4.12265-9.39326,10.131v.10034c0,6.10871,4.57119,10.18119,9.39326,10.18119C638.4041,84.83674,642.52378,81.07117,642.52378,74.70719Z"/>
<path d="M651.46846,50.62793h3.86886V87.79076h-3.86886Z"/>
<path d="M659.86133,80.15339v-.10033c0-5.54949,4.521-8.502,11.10193-8.502a27.21427,27.21427,0,0,1,7.98853,1.11994v-.91631c0-4.73352-2.86547-7.177-7.73771-7.177a17.93248,17.93248,0,0,0-7.88823,1.93295L662.172,63.30425a21.2147,21.2147,0,0,1,9.44344-2.18822c3.66815,0,6.48056.96648,8.38987,2.90089,1.75884,1.78245,2.66188,4.32627,2.66188,7.68755V87.79076h-3.71539V83.81862a11.33082,11.33082,0,0,1-9.3962,4.53137C664.73352,88.35,659.86133,85.5509,659.86133,80.15339ZM679.002,78.11715V75.57333a26.7344,26.7344,0,0,0-7.63737-1.12139c-4.87224,0-7.58424,2.13951-7.58424,5.44768v.1018c0,3.30963,3.01305,5.24259,6.53073,5.24259,4.77185,0,8.69088-2.95109,8.69088-7.12686Z"/>
<path d="M689.5048,80.81591V64.93325h-3.618V61.47164h3.618V53.53031h3.86885v7.94133h8.23945v3.46161h-8.23945V80.30686c0,3.20781,1.75885,4.37791,4.37055,4.37791a8.0669,8.0669,0,0,0,3.76851-.91631v3.35979a9.63752,9.63752,0,0,1-4.67449,1.11993C692.66837,88.24818,689.5048,86.16177,689.5048,80.81591Z"/>
<path d="M703.57554,74.70719v-.10181c0-7.58425,5.27358-13.693,12.45648-13.693,7.68754,0,12.10826,6.209,12.10826,13.89659a10.36192,10.36192,0,0,1-.05017,1.2719H707.49162c.55481,5.70147,4.521,8.90929,9.14539,8.90929a10.68594,10.68594,0,0,0,8.18628-3.7154l2.414,2.18822a13.3417,13.3417,0,0,1-10.70058,4.93861C709.40094,88.40163,703.57554,82.85215,703.57554,74.70719ZM724.2212,73.18c-.40134-4.78516-3.1134-8.95945-8.28957-8.95945-4.521,0-7.93542,3.81868-8.44006,8.95945Z"/>
</g>
</g>
<path d="M80.37373,31.871V23.97684H64.21736v7.993H48.20705v-7.993H31.95183V31.871H24.10714V88.08737H48.15763V80.0826a8.00515,8.00515,0,0,1,16.0103,0v8.00477H88.21842V31.871Z" fill="url(#linear-gradient)"/>
<rect width="745.71429" height="112.5" fill="none"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

@ -1,52 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="2024" height="305" viewBox="0 0 745.71429 112.5">
<defs>
<linearGradient id="linear-gradient" x1="21.98732" y1="-879.27899" x2="91.77826" y2="-949.06994" gradientTransform="matrix(1, 0, 0, -1, 0, -853.5)" gradientUnits="userSpaceOnUse">
<stop offset="0.15937" stop-color="#3bea62"/>
<stop offset="0.5404" stop-color="#3c99cc"/>
<stop offset="0.93739" stop-color="#6b57ff"/>
</linearGradient>
</defs>
<g>
<g>
<g>
<path d="M112.7808,40.71086l1.61129-1.40324c1.21437,1.86213,2.45824,2.864,4.5225,2.864,2.23248,0,3.8718-1.63342,3.8718-4.81172V23.93107h2.262V37.33336a7.2901,7.2901,0,0,1-1.809,5.26766,6.02144,6.02144,0,0,1-4.35283,1.66145A6.76237,6.76237,0,0,1,112.7808,40.71086Z"/>
<path d="M128.35213,36.61625v-.05607c0-4.26724,2.9688-7.70377,7.01027-7.70377,4.32479,0,6.81254,3.49259,6.81254,7.81739a5.86042,5.86042,0,0,1-.028.71564H130.55805a5.13042,5.13042,0,0,0,5.14371,5.01091,6.01592,6.01592,0,0,0,4.60808-2.08936l1.356,1.2306a7.50169,7.50169,0,0,1-6.02019,2.777C131.63224,44.31854,128.35213,41.19779,128.35213,36.61625Zm11.61836-.85877c-.22723-2.69137-1.75293-5.04042-4.66416-5.04042-2.54383,0-4.46645,2.14838-4.74828,5.04042Z"/>
<path d="M146.04527,40.05277V31.1184H144.009V29.1707h2.03625V24.70425h2.17642V29.1707h4.63465v1.9477h-4.63465v8.64812a2.17465,2.17465,0,0,0,2.45824,2.46267,4.53615,4.53615,0,0,0,2.12035-.51644v1.89016a5.4128,5.4128,0,0,1-2.62941.63C147.82624,44.233,146.04527,43.05844,146.04527,40.05277Z"/>
<path d="M156.35926,23.93107h8.42384a7.21772,7.21772,0,0,1,5.17323,1.77509,4.48482,4.48482,0,0,1,1.27191,3.20781V28.97a4.8351,4.8351,0,0,1-3.13846,4.63909c2.34611.71711,4.24068,2.09083,4.24068,4.83975v.05755c0,3.43652-2.85515,5.46981-7.17995,5.46981h-8.79125Zm12.607,5.29865c0-1.97722-1.55374-3.26536-4.38087-3.26536h-6.02018v6.90107h5.85051c2.68547,0,4.55054-1.2306,4.55054-3.57965Zm-4.1551,5.63949h-6.24595v7.07372h6.64139c2.99681,0,4.86189-1.34569,4.86189-3.57965v-.05754C170.06846,36.12932,168.25945,34.86921,164.81113,34.86921Z"/>
<path d="M175.69173,29.1707h2.1764v3.8659a6.26083,6.26083,0,0,1,5.9641-4.12264v2.37561H183.664c-3.19453,0-5.7959,2.31954-5.7959,6.78746v5.89919h-2.17642Z"/>
<path d="M184.62166,39.67946v-.05607c0-3.12223,2.54383-4.78221,6.24742-4.78221a15.34686,15.34686,0,0,1,4.49448.63007v-.51646c0-2.66186-1.61129-4.03706-4.35283-4.03706a10.05314,10.05314,0,0,0-4.43842,1.08894l-.64923-1.80457a11.92286,11.92286,0,0,1,5.3134-1.23208,6.36624,6.36624,0,0,1,4.72023,1.63342,5.88893,5.88893,0,0,1,1.49767,4.32332v9.04946h-2.09082v-2.234a6.378,6.378,0,0,1-5.28684,2.54825C187.36469,44.29051,184.62166,42.71611,184.62166,39.67946Zm10.76995-1.145V37.10318a15.03578,15.03578,0,0,0-4.29676-.63006c-2.74154,0-4.26724,1.20255-4.26724,3.06469v.05607c0,1.86212,1.69539,2.94959,3.67408,2.94959C193.18715,42.54348,195.39161,40.8835,195.39161,38.53446Z"/>
<path d="M201.43834,23.50169h2.48775v2.43463h-2.48775Zm.14165,5.669h2.17641V43.97622H201.58Z"/>
<path d="M208.10629,29.1707h2.17642v2.57776a5.52394,5.52394,0,0,1,5.00354-2.89205c3.53392,0,5.5967,2.40512,5.5967,5.92722v9.19258h-2.17642V35.3281c0-2.74892-1.46965-4.46644-4.0415-4.46644a4.33064,4.33064,0,0,0-4.38234,4.63908v8.47548h-2.17643Z"/>
<path d="M223.595,42.08458l1.10223-1.57291a8.48365,8.48365,0,0,0,5.05962,1.88868c1.75147,0,3.02485-.91631,3.02485-2.34758v-.05754c0-1.48882-1.7249-2.06132-3.64753-2.60579-2.28857-.65809-4.83237-1.46078-4.83237-4.18167V33.1517c0-2.54825,2.09084-4.23774,4.974-4.23774a9.88682,9.88682,0,0,1,5.25732,1.63194l-.9886,1.66146a8.188,8.188,0,0,0-4.32478-1.43277c-1.72491,0-2.82714.91631-2.82714,2.1469v.059c0,1.40175,1.809,1.94625,3.75965,2.54677,2.26051.6876,4.69219,1.57587,4.69219,4.23921V39.824c0,2.80648-2.29,4.43841-5.20126,4.43841A9.96351,9.96351,0,0,1,223.595,42.08458Z"/>
</g>
<g>
<path d="M115.968,52.15661h3.9692V87.79078H115.968Z"/>
<path d="M124.30768,81.986l2.864-2.49366c2.16019,3.30815,4.37053,5.0906,8.03872,5.0906,3.96772,0,6.8819-2.90089,6.8819-8.5522V52.15661h4.01936v23.824c0,4.17281-1.20551,7.33046-3.2152,9.3667a10.71062,10.71062,0,0,1-7.73622,2.95106A12.0199,12.0199,0,0,1,124.30768,81.986Z"/>
<path d="M165.55775,52.15661H178.7195c7.9369,0,13.16177,4.2761,13.16177,11.29964v.10329c0,7.68606-6.33,11.65672-13.81544,11.65672h-8.54039V87.79077h-3.96772ZM178.21636,71.551c5.82837,0,9.64558-3.15617,9.64558-7.83952v-.10181c0-5.0906-3.767-7.73771-9.44342-7.73771h-8.89308V71.551Z"/>
<path d="M196.3079,50.62793h3.86886V87.79076H196.3079Z"/>
<path d="M204.69779,80.15339v-.10033c0-5.54949,4.521-8.502,11.10342-8.502a27.211,27.211,0,0,1,7.98706,1.11994v-.91631c0-4.73352-2.864-7.177-7.73624-7.177a17.9221,17.9221,0,0,0-7.88821,1.93295l-1.15535-3.20634a21.22123,21.22123,0,0,1,9.4449-2.18822c3.66819,0,6.48056.96648,8.3899,2.90089,1.75885,1.78245,2.66186,4.32627,2.66186,7.68755V87.79076h-3.71689V83.81862A11.32989,11.32989,0,0,1,214.39351,88.35C209.57149,88.35,204.69779,85.5509,204.69779,80.15339Zm19.14065-2.03624V75.57333a26.73167,26.73167,0,0,0-7.63589-1.12139c-4.87369,0-7.58572,2.13951-7.58572,5.44768v.1018c0,3.30963,3.01453,5.24259,6.53071,5.24259,4.77187,0,8.6909-2.95109,8.6909-7.12686Z"/>
<path d="M234.3413,80.81591V64.93325h-3.61654V61.47164h3.61654V53.53031h3.86885v7.94133h8.2394v3.46161h-8.2394V80.30686c0,3.20781,1.75884,4.37791,4.37055,4.37791a8.05285,8.05285,0,0,0,3.767-.91631v3.35979a9.6214,9.6214,0,0,1-4.67157,1.11993C237.50632,88.24818,234.3413,86.16177,234.3413,80.81591Z"/>
<path d="M252.22922,64.93325h-3.56636v-3.41h3.56636V59.23178c0-3.00271.80416-5.29422,2.26051-6.77123a7.59978,7.59978,0,0,1,5.57753-2.03625,11.59177,11.59177,0,0,1,4.2702.66252v3.40995a12.78069,12.78069,0,0,0-3.76851-.661c-3.01452,0-4.521,1.83261-4.521,5.59965v2.138h8.23938v3.35979h-8.1892V87.79075h-3.86886Z"/>
<path d="M264.59124,74.75884v-.10329a13.53974,13.53974,0,1,1,27.07755-.10033v.10034A13.57821,13.57821,0,0,1,278.054,88.40164,13.39652,13.39652,0,0,1,264.59124,74.75884Zm23.10837,0v-.10329c0-5.64982-4.16987-10.28153-9.64558-10.28153-5.6262,0-9.495,4.63171-9.495,10.1812v.10033c0,5.6513,4.1197,10.23284,9.5954,10.23284C283.78058,84.88838,287.69961,80.30685,287.69961,74.75884Z"/>
<path d="M296.1441,61.47164H300.013v6.87157c1.90787-4.37644,5.67637-7.53409,10.60023-7.33047v4.22594h-.30249c-5.67637,0-10.29777,4.12264-10.29777,12.064V87.79075h-3.86885Z"/>
<path d="M313.98036,61.47164h3.86885v4.42808c1.7072-2.59547,4.01788-4.98731,8.38843-4.98731a8.81582,8.81582,0,0,1,8.33973,5.24257,10.32787,10.32787,0,0,1,9.14388-5.24257c5.9774,0,9.64558,4.07247,9.64558,10.58844v16.2899H349.498V72.41568c0-5.0906-2.51136-7.94133-6.73138-7.94133-3.919,0-7.18438,2.954-7.18438,8.145V87.79076H331.765V72.31535c0-4.93862-2.563-7.841-6.6827-7.841-4.11823,0-7.23307,3.46161-7.23307,8.29841v15.018h-3.86886Z"/>
<path d="M372.31491,52.15661h13.16177c7.93544,0,13.16177,4.2761,13.16177,11.29964v.10329c0,7.68606-6.33,11.65672-13.8169,11.65672h-8.5404V87.79077h-3.96624ZM384.97205,71.551c5.82837,0,9.647-3.15617,9.647-7.83952v-.10181c0-5.0906-3.76851-7.73771-9.44344-7.73771h-8.89451V71.551Z"/>
<path d="M403.06211,50.62793H406.931V87.79076h-3.86886Z"/>
<path d="M413.0131,77.81319V61.47164H416.879V76.84525c0,4.887,2.61464,7.94133,7.18584,7.94133,4.42072,0,7.78494-3.30816,7.78494-8.24677V61.47164h3.81868V87.79077H431.8498v-4.583A9.87131,9.87131,0,0,1,422.95823,88.35C416.67837,88.35,413.0131,84.07389,413.0131,77.81319Z"/>
<path d="M441.55,92.37083l1.75885-3.05438a16.446,16.446,0,0,0,9.99824,3.36127c5.72506,0,9.44344-3.20782,9.44344-9.3667V80.205c-2.26054,3.05438-5.427,5.54949-10.1989,5.54949A12.08515,12.08515,0,0,1,440.346,73.43379v-.10034a12.26417,12.26417,0,0,1,22.35433-7.12683v-4.735h3.86886V83.20775c0,4.0725-1.207,7.17848-3.317,9.31652-2.31066,2.34168-5.77523,3.51178-9.89495,3.51178A20.18232,20.18232,0,0,1,441.55,92.37083Zm21.30083-18.98719v-.10182c0-5.396-4.62137-8.9078-9.54379-8.9078a8.64347,8.64347,0,0,0-8.99486,8.85616v.10328a8.84778,8.84778,0,0,0,8.99486,8.95946C458.22945,82.29292,462.85082,78.67785,462.85082,73.38364Z"/>
<path d="M472.80183,51.39226h4.42072v4.32627h-4.42072Zm.25082,10.07938h3.86886V87.79076h-3.86886Z"/>
<path d="M483.40207,61.47164h3.86885v4.58153a9.81531,9.81531,0,0,1,8.89157-5.14076c6.27986,0,9.94807,4.2761,9.94807,10.53679V87.79075h-3.86885V72.41568c0-4.887-2.61171-7.94133-7.1829-7.94133-4.4709,0-7.78789,3.30963-7.78789,8.24826V87.79078h-3.86885Z"/>
<path d="M534.19883,55.872H522.34144V52.15661h27.681V55.872H538.168V87.79078h-3.9692Z"/>
<path d="M546.31,74.70719v-.10181c0-7.58425,5.27358-13.693,12.45648-13.693,7.68754,0,12.10826,6.209,12.10826,13.89659a10.352,10.352,0,0,1-.05017,1.2719H550.22611c.55481,5.70147,4.521,8.90929,9.14539,8.90929a10.68587,10.68587,0,0,0,8.18628-3.7154l2.414,2.18822a13.3417,13.3417,0,0,1-10.70058,4.93861C552.13543,88.40163,546.31,82.85215,546.31,74.70719ZM566.95574,73.18c-.40134-4.78516-3.1134-8.95945-8.28958-8.95945-4.521,0-7.93541,3.81868-8.44005,8.95945Z"/>
<path d="M575.15085,61.47164h3.86886v4.42808c1.70573-2.59547,4.01639-4.98731,8.38693-4.98731a8.81427,8.81427,0,0,1,8.33971,5.24257,10.33034,10.33034,0,0,1,9.14538-5.24257c5.97592,0,9.64408,4.07247,9.64408,10.58844v16.2899H610.667V72.41568c0-5.0906-2.51136-7.94133-6.73139-7.94133-3.919,0-7.1829,2.954-7.1829,8.145V87.79076H592.934V72.31535c0-4.93862-2.56153-7.841-6.68121-7.841s-7.23307,3.46161-7.23307,8.29841v15.018h-3.86886Z"/>
<path d="M620.26974,61.47164h3.86886v5.29422c2.11-3.15617,5.17323-5.85345,9.94513-5.85345,6.22969,0,12.40925,4.98731,12.40925,13.64281v.10033c0,8.60384-6.12939,13.69447-12.40925,13.69447a11.68492,11.68492,0,0,1-9.94513-5.59966V95.93574h-3.86886Zm22.254,13.23555v-.10181c0-6.21053-4.22-10.1812-9.14244-10.1812-4.82207,0-9.39326,4.12265-9.39326,10.131v.10034c0,6.10871,4.57119,10.18119,9.39326,10.18119C638.4041,84.83674,642.52378,81.07117,642.52378,74.70719Z"/>
<path d="M651.46846,50.62793h3.86886V87.79076h-3.86886Z"/>
<path d="M659.86133,80.15339v-.10033c0-5.54949,4.521-8.502,11.10193-8.502a27.21427,27.21427,0,0,1,7.98853,1.11994v-.91631c0-4.73352-2.86547-7.177-7.73771-7.177a17.93248,17.93248,0,0,0-7.88823,1.93295L662.172,63.30425a21.2147,21.2147,0,0,1,9.44344-2.18822c3.66815,0,6.48056.96648,8.38987,2.90089,1.75884,1.78245,2.66188,4.32627,2.66188,7.68755V87.79076h-3.71539V83.81862a11.33082,11.33082,0,0,1-9.3962,4.53137C664.73352,88.35,659.86133,85.5509,659.86133,80.15339ZM679.002,78.11715V75.57333a26.7344,26.7344,0,0,0-7.63737-1.12139c-4.87224,0-7.58424,2.13951-7.58424,5.44768v.1018c0,3.30963,3.01305,5.24259,6.53073,5.24259,4.77185,0,8.69088-2.95109,8.69088-7.12686Z"/>
<path d="M689.5048,80.81591V64.93325h-3.618V61.47164h3.618V53.53031h3.86885v7.94133h8.23945v3.46161h-8.23945V80.30686c0,3.20781,1.75885,4.37791,4.37055,4.37791a8.0669,8.0669,0,0,0,3.76851-.91631v3.35979a9.63752,9.63752,0,0,1-4.67449,1.11993C692.66837,88.24818,689.5048,86.16177,689.5048,80.81591Z"/>
<path d="M703.57554,74.70719v-.10181c0-7.58425,5.27358-13.693,12.45648-13.693,7.68754,0,12.10826,6.209,12.10826,13.89659a10.36192,10.36192,0,0,1-.05017,1.2719H707.49162c.55481,5.70147,4.521,8.90929,9.14539,8.90929a10.68594,10.68594,0,0,0,8.18628-3.7154l2.414,2.18822a13.3417,13.3417,0,0,1-10.70058,4.93861C709.40094,88.40163,703.57554,82.85215,703.57554,74.70719ZM724.2212,73.18c-.40134-4.78516-3.1134-8.95945-8.28957-8.95945-4.521,0-7.93542,3.81868-8.44006,8.95945Z"/>
</g>
</g>
<path d="M80.37373,31.871V23.97684H64.21736v7.993H48.20705v-7.993H31.95183V31.871H24.10714V88.08737H48.15763V80.0826a8.00515,8.00515,0,0,1,16.0103,0v8.00477H88.21842V31.871Z" fill="url(#linear-gradient)"/>
<rect width="745.71429" height="112.5" fill="none"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

@ -1,15 +0,0 @@
# Dependabot configuration:
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for Gradle dependencies
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

@ -1,7 +0,0 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
# %NAME% Changelog
## [Unreleased]
### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)

@ -1,44 +0,0 @@
# %NAME%
![Build](https://github.com/%REPOSITORY%/workflows/Build/badge.svg)
[![Version](https://img.shields.io/jetbrains/plugin/v/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
## Template ToDo list
- [x] Create a new [IntelliJ Platform Plugin Template][template] project.
- [ ] Get familiar with the [template documentation][template].
- [ ] Adjust the [pluginGroup](./gradle.properties), [plugin ID](./src/main/resources/META-INF/plugin.xml) and [sources package](./src/main/kotlin).
- [ ] Adjust the plugin description in `README` (see [Tips][docs:plugin-description])
- [ ] Review the [Legal Agreements](https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html?from=IJPluginTemplate).
- [ ] [Publish a plugin manually](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate) for the first time.
- [ ] Set the `PLUGIN_ID` in the above README badges.
- [ ] Set the [Plugin Signing](https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate) related [secrets](https://github.com/JetBrains/intellij-platform-plugin-template#environment-variables).
- [ ] Set the [Deployment Token](https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html?from=IJPluginTemplate).
- [ ] Click the <kbd>Watch</kbd> button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes.
<!-- Plugin description -->
This Fancy IntelliJ Platform Plugin is going to be your implementation of the brilliant ideas that you have.
This specific section is a source for the [plugin.xml](/src/main/resources/META-INF/plugin.xml) file which will be extracted by the [Gradle](/build.gradle.kts) during the build process.
To keep everything working, do not remove `<!-- ... -->` sections.
<!-- Plugin description end -->
## Installation
- Using IDE built-in plugin system:
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "%NAME%"</kbd> >
<kbd>Install Plugin</kbd>
- Manually:
Download the [latest release](https://github.com/%REPOSITORY%/releases/latest) and install it manually using
<kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>
---
Plugin based on the [IntelliJ Platform Plugin Template][template].
[template]: https://github.com/JetBrains/intellij-platform-plugin-template
[docs:plugin-description]: https://plugins.jetbrains.com/docs/intellij/plugin-user-experience.html#plugin-description-and-presentation

@ -1,37 +0,0 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup = %GROUP%
pluginName = %NAME%
pluginRepositoryUrl = https://github.com/%REPOSITORY%
# SemVer format -> https://semver.org
pluginVersion = 0.0.1
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222
pluginUntilBuild = 232.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2022.2.5
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins =
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.1.1
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
systemProp.org.gradle.unsafe.kotlin.assignment = true
# Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom
kotlin.incremental.useClasspathSnapshot = false

@ -1 +0,0 @@
rootProject.name = "%NAME%"

@ -1,173 +0,0 @@
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
# - validate Gradle Wrapper,
# - run 'test' and 'verifyPlugin' tasks,
# - run Qodana inspections,
# - run 'buildPlugin' task and prepare artifact for the further tests,
# - run 'runPluginVerifier' task,
# - create a draft release.
#
# Workflow is triggered on push and pull_request events.
#
# GitHub Actions reference: https://help.github.com/en/actions
#
## JBIJPPTPL
name: Build
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main]
# Trigger the workflow on any pull request
pull_request:
jobs:
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
# Build plugin and provide the artifact for the next workflow jobs
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:
# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.6
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
# Run tests
- name: Run Tests
run: ./gradlew check
# Collect Tests Result of failed tests
- name: Collect Tests Result
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests
# Upload Kover report to CodeCov
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier
# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2023.1.0
# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
# Create a new release draft which is not publicly visible and requires manual acceptance
- name: Create Release Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ needs.build.outputs.version }} \
--draft \
--title "v${{ needs.build.outputs.version }}" \
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"

@ -1,97 +0,0 @@
# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.
name: Release
on:
release:
types: [prereleased, released]
jobs:
# Prepare and publish the plugin to the Marketplace repository
release:
name: Publish Plugin
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
${{ github.event.release.body }}
EOM
)"
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Update Unreleased section with the current release note
- name: Patch Changelog
if: ${{ steps.properties.outputs.changelog != '' }}
env:
CHANGELOG: ${{ steps.properties.outputs.changelog }}
run: |
./gradlew patchChangelog --release-note="$CHANGELOG"
# Publish the plugin to the Marketplace
- name: Publish Plugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
run: ./gradlew publishPlugin
# Upload artifact as a release asset
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
# Create pull request
- name: Create Pull Request
if: ${{ steps.properties.outputs.changelog != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name }}"
BRANCH="changelog-update-$VERSION"
LABEL="release changelog"
git config user.email "action@github.com"
git config user.name "GitHub Action"
git checkout -b $BRANCH
git commit -am "Changelog update - $VERSION"
git push --set-upstream origin $BRANCH
gh label create "$LABEL" \
--description "Pull requests with release changelog update" \
|| true
gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
--label "$LABEL" \
--head $BRANCH

@ -1,60 +0,0 @@
# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI
# - wait for IDE to start
# - run UI tests with separate Gradle task
#
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
#
# Workflow is triggered manually.
name: Run UI Tests
on:
workflow_dispatch
jobs:
testUI:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
runIde: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x16 &
gradle runIdeForUiTests &
- os: windows-latest
runIde: start gradlew.bat runIdeForUiTests
- os: macos-latest
runIde: ./gradlew runIdeForUiTests &
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle
# Run IDEA prepared for UI testing
- name: Run IDE
run: ${{ matrix.runIde }}
# Wait for IDEA to be started
- name: Health Check
uses: jtalk/url-health-check-action@v3
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
# Run tests
- name: Tests
run: ./gradlew test

@ -1,82 +0,0 @@
# GitHub Actions Workflow responsible for cleaning up the IntelliJ Platform Plugin Template repository from
# the template-specific files and configurations. This workflow is supposed to be triggered automatically
# when a new template-based repository has been created.
name: Template Cleanup
on:
push:
branches: [main]
jobs:
# Run a cleaning process only if the workflow is triggered by the non-"intellij-platform-plugin-template" repository.
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'intellij-platform-plugin-template'
permissions:
contents: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
# Cleanup project
- name: Cleanup
run: |
export LC_CTYPE=C
export LANG=C
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]')
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME"
# Replace placeholders in the template-cleanup files
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/*
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/*
sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/*
# Replace template package name in project files with $GROUP
find src -type f -exec sed -i "s/org.jetbrains.plugins.template/$GROUP/g" {} +
find src -type f -exec sed -i "s/IntelliJ Platform Plugin/$NAME/g" {} +
find src -type f -exec sed -i "s/JetBrains/$ACTOR/g" {} +
# Move content
mkdir -p src/main/kotlin/${GROUP//.//}
mkdir -p src/test/kotlin/${GROUP//.//}
cp -R .github/template-cleanup/* .
cp -R src/main/kotlin/org/jetbrains/plugins/template/* src/main/kotlin/${GROUP//.//}/
cp -R src/test/kotlin/org/jetbrains/plugins/template/* src/test/kotlin/${GROUP//.//}/
# Cleanup
rm -rf \
.github/ISSUE_TEMPLATE \
.github/readme \
.github/template-cleanup \
.github/workflows/template-cleanup.yml \
.github/workflows/template-verify.yml \
.idea/icon.png \
src/main/kotlin/org \
src/test/kotlin/org \
src/main/resources/META-INF/pluginIcon.svg \
CODE_OF_CONDUCT.md \
LICENSE
# Commit modified files
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Template cleanup"
# Push changes
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}

@ -1,43 +0,0 @@
# GitHub Actions Workflow verifies if the template repository is consistent with all provided content.
name: Template Verify
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main]
paths: ['**/gradle.properties']
# Trigger the workflow on any pull request
pull_request:
paths: ['**/gradle.properties']
jobs:
build:
name: Template Verify
if: github.event.repository.name == 'intellij-platform-plugin-template'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
# Compare `gradle.properties` with `.github/template-cleanup/gradle.properties`
- name: Verify gradle.properties
run: |
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
diff -U 0 \
-I '^pluginVersion' \
-I '^pluginGroup' \
-I '^pluginName' \
-I '^pluginRepositoryUrl' \
--label .github/template-cleanup/gradle.properties \
--label gradle.properties \
.github/template-cleanup/gradle.properties gradle.properties \
>> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

@ -1,621 +1,44 @@
# IntelliJ Platform Plugin Template
[![official JetBrains project](https://jb.gg/badges/official.svg)][jb:github]
[![Twitter Follow](https://img.shields.io/badge/follow-%40JBPlatform-1DA1F2?logo=twitter)](https://twitter.com/JBPlatform)
[![Build](https://github.com/JetBrains/intellij-platform-plugin-template/workflows/Build/badge.svg)][gh:build]
[![Slack](https://img.shields.io/badge/Slack-%23intellij--platform-blue?style=flat-square&logo=Slack)](https://plugins.jetbrains.com/slack)
![IntelliJ Platform Plugin Template][file:intellij-platform-plugin-template-dark]
![IntelliJ Platform Plugin Template][file:intellij-platform-plugin-template-light]
> **Note**
>
> Click the <kbd>Use this template</kbd> button and clone it in IntelliJ IDEA.
<!-- Plugin description -->
**IntelliJ Platform Plugin Template** is a repository that provides a pure template to make it easier to create a new plugin project (check the [Creating a repository from a template][gh:template] article).
The main goal of this template is to speed up the setup phase of plugin development for both new and experienced developers by preconfiguring the project scaffold and CI, linking to the proper documentation pages, and keeping everything organized.
[gh:template]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template
<!-- Plugin description end -->
If you're still not quite sure what this is all about, read our introduction: [What is the IntelliJ Platform?][docs:intro]
> **Note**
>
> Click the <kbd>Watch</kbd> button on the top to be notified about releases containing new features and fixes.
### Table of contents
In this README, we will highlight the following elements of template-project creation:
- [Getting started](#getting-started)
- [Gradle configuration](#gradle-configuration)
- [Plugin template structure](#plugin-template-structure)
- [Plugin configuration file](#plugin-configuration-file)
- [Sample code](#sample-code):
- listeners project lifecycle listener
- services project and application-level services
- [Testing](#testing)
- [Functional tests](#functional-tests)
- [Code coverage](#code-coverage)
- [UI tests](#ui-tests)
- [Qodana integration](#qodana-integration)
- [Predefined Run/Debug configurations](#predefined-rundebug-configurations)
- [Continuous integration](#continuous-integration) based on GitHub Actions
- [Dependencies management](#dependencies-management) with Dependabot
- [Changelog maintenance](#changelog-maintenance) with the Gradle Changelog Plugin
- [Release flow](#release-flow) using GitHub Releases
- [Plugin signing](#plugin-signing) with your private certificate
- [Publishing the plugin](#publishing-the-plugin) with the Gradle IntelliJ Plugin
- [FAQ](#faq)
- [Useful links](#useful-links)
## Getting started
Before we dive into plugin development and everything related to it, it's worth mentioning the benefits of using GitHub Templates.
By creating a new project using the current template, you start with no history or reference to this repository.
This allows you to create a new repository easily without copying and pasting previous content, clone repositories, or clearing the history manually.
All you have to do is click the <kbd>Use this template</kbd> button (you must be logged in with your GitHub account).
![Use this template][file:use-this-template.png]
After using the template to create your blank project, the [Template Cleanup][file:template_cleanup.yml] workflow will be triggered to override or remove any template-specific configurations, such as the plugin name, current changelog, etc.
Once this is complete, the project is ready to be cloned to your local environment and opened with [IntelliJ IDEA][jb:download-ij].
For the last step, you have to manually review the configuration variables described in the [`gradle.properties`][file:gradle.properties] file and *optionally* move sources from the *com.github.username.repository* package to the one that works best for you.
Then you can get to work implementing your ideas.
> **Note**
>
> To use Java in your plugin, create the `/src/main/java` directory.
## Gradle configuration
The recommended method for plugin development involves using the [Gradle][gradle] setup with the [gradle-intellij-plugin][gh:gradle-intellij-plugin] installed.
The `gradle-intellij-plugin` makes it possible to run the IDE with your plugin and publish your plugin to JetBrains Marketplace.
> **Note**
>
> Make sure to always upgrade to the latest version of `gradle-intellij-plugin`.
A project built using the IntelliJ Platform Plugin Template includes a Gradle configuration already set up.
Feel free to read through the [Using Gradle][docs:using-gradle] articles to understand your build better and learn how to customize it.
The most significant parts of the current configuration are:
- Integration with the [gradle-intellij-plugin][gh:gradle-intellij-plugin] for smoother development.
- Configuration written with [Gradle Kotlin DSL][gradle:kotlin-dsl].
- Support for Kotlin and Java implementation.
- Integration with the [gradle-changelog-plugin][gh:gradle-changelog-plugin], which automatically patches the change notes based on the `CHANGELOG.md` file.
- [Plugin publishing][docs:publishing] using the token.
For more details regarding Kotlin integration, please see [Kotlin for Plugin Developers][docs:kotlin] in the IntelliJ Platform Plugin SDK documentation.
### Gradle properties
The project-specific configuration file [`gradle.properties`][file:gradle.properties] contains:
| Property name | Description |
|-----------------------|-----------------------------------------------------------------------------------------------------------|
| `pluginGroup` | Package name - after *using* the template, this will be set to `com.github.username.repo`. |
| `pluginName` | Plugin name displayed in the JetBrains Marketplace and the Plugins Repository. |
| `pluginRepositoryUrl` | Repository URL used for generating URLs by the [Gradle Changelog Plugin][gh:gradle-changelog-plugin] |
| `pluginVersion` | The current version of the plugin in [SemVer][semver] format. |
| `pluginSinceBuild` | The `since-build` attribute of the `<idea-version>` tag. |
| `pluginUntilBuild` | The `until-build` attribute of the `<idea-version>` tag. |
| `platformType` | The type of IDE distribution. |
| `platformVersion` | The version of the IntelliJ Platform IDE will be used to build the plugin. |
| `platformPlugins` | Comma-separated list of dependencies to the bundled IDE plugins and plugins from the Plugin Repositories. |
| `gradleVersion` | Version of Gradle used for plugin development. |
The properties listed define the plugin itself or configure the [gradle-intellij-plugin][gh:gradle-intellij-plugin] check its documentation for more details.
In addition, extra behaviours are configured through the [`gradle.properties`][file:gradle.properties] file, such as:
| Property name | Value | Description |
|--------------------------------------------------|---------|------------------------------------------------------------------------------------------------|
| `kotlin.stdlib.default.dependency` | `false` | Opt-out flag for bundling [Kotlin standard library][docs:kotlin-stdlib] |
| `org.gradle.configuration-cache` | `true` | Enable [Gradle Configuration Cache][gradle:configuration-cache] |
| `org.gradle.caching` | `true` | Enable [Gradle Build Cache][gradle:build-cache] |
| `systemProp.org.gradle.unsafe.kotlin.assignment` | `true` | Enable [Gradle Kotlin DSL Lazy Property Assignment][gradle:kotlin-dsl-assignment] |
| `kotlin.incremental.useClasspathSnapshot` | `false` | Temporary workaround for [Kotlin Compiler OutOfMemoryError][docs:intellij-platform-kotlin-oom] |
### Environment variables
Some values used for the Gradle configuration shouldn't be stored in files to avoid publishing them to the Version Control System.
To avoid that, environment variables are introduced, which can be provided within the *Run/Debug Configuration* within the IDE, or on the CI like for GitHub: `⚙️ Settings > Secrets`.
Environment variables used by the current project are related to the [plugin signing](#plugin-signing) and [publishing](#publishing-the-plugin).
| Environment variable name | Description |
|---------------------------|--------------------------------------------------------------------------------------------------------------|
| `PRIVATE_KEY` | Certificate private key, should contain: `-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----` |
| `PRIVATE_KEY_PASSWORD` | Password used for encrypting the certificate file. |
| `CERTIFICATE_CHAIN` | Certificate chain, should contain: `-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----` |
| `PUBLISH_TOKEN` | Publishing token generated in your JetBrains Marketplace profile dashboard. |
For more details on how to generate proper values, check the relevant sections mentioned above.
To configure GitHub secret environment variables, go to the `⚙️ Settings > Secrets` section of your project repository:
![Settings > Secrets][file:settings-secrets.png]
## Plugin template structure
A generated IntelliJ Platform Plugin Template repository contains the following content structure:
```
.
├── .github/ GitHub Actions workflows and Dependabot configuration files
├── .run/ Predefined Run/Debug Configurations
├── build/ Output build directory
├── gradle
│ ├── wrapper/ Gradle Wrapper
│ └── libs.versions.toml Gradle version catalog
├── src Plugin sources
│ ├── main
│ │ ├── kotlin/ Kotlin production sources
│ │ └── resources/ Resources - plugin.xml, icons, messages
│ └── test
│ ├── kotlin/ Kotlin test sources
│ └── testData/ Test data used by tests
├── .gitignore Git ignoring rules
├── build.gradle.kts Gradle configuration
├── CHANGELOG.md Full change history
├── gradle.properties Gradle configuration properties
├── gradlew *nix Gradle Wrapper script
├── gradlew.bat Windows Gradle Wrapper script
├── LICENSE License, MIT by default
├── qodana.yml Qodana configuration file
├── README.md README
└── settings.gradle.kts Gradle project settings
```
In addition to the configuration files, the most crucial part is the `src` directory, which contains our implementation and the manifest for our plugin [plugin.xml][file:plugin.xml].
> **Note**
>
> To use Java in your plugin, create the `/src/main/java` directory.
## Plugin configuration file
The plugin configuration file is a [plugin.xml][file:plugin.xml] file located in the `src/main/resources/META-INF` directory.
It provides general information about the plugin, its dependencies, extensions, and listeners.
```xml
<idea-plugin>
<id>org.jetbrains.plugins.template</id>
<name>Template</name>
<vendor>JetBrains</vendor>
<depends>com.intellij.modules.platform</depends>
<resource-bundle>messages.MyBundle</resource-bundle>
<extensions defaultExtensionNs="com.intellij">
<toolWindow factoryClass="..." id="..."/>
</extensions>
<applicationListeners>
<listener class="..." topic="..."/>
</applicationListeners>
</idea-plugin>
```
You can read more about this file in the [Plugin Configuration File][docs:plugin.xml] section of our documentation.
## Sample code
The prepared template provides as little code as possible because it is impossible for a general scaffold to fulfill all the specific requirements for all types of plugins (language support, build tools, VCS related tools).
Therefore, the template contains only the following files:
```
.
├── MyBundle.kt Bundle class providing access to the resources messages
├── listeners
│ └── MyApplicationActivationListener.kt Application activation listener — detects when IDE frame is activated
├── services
│ └── MyProjectService.kt Project level service
├── toolWindow
│ └── MyToolWindowFactory.kt Tool window factory — creates tool window content
```
These files are located in `src/main/kotlin`.
This location indicates the language being used.
So if you decide to use Java instead (or in addition to Kotlin), these sources should be located in the `src/main/java` directory.
To start with the actual implementation, you may check our [IntelliJ Platform SDK DevGuide][docs], which contains an introduction to the essential areas of the plugin development together with dedicated tutorials.
> **Warning**
>
> Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.
For those who value example codes the most, there are also available [IntelliJ SDK Code Samples][gh:code-samples] and [IntelliJ Platform Explorer][jb:ipe] a search tool for browsing Extension Points inside existing implementations of open-source IntelliJ Platform plugins.
## Testing
[Testing plugins][docs:testing-plugins] is an essential part of the plugin development to make sure that everything works as expected between IDE releases and plugin refactorings.
The IntelliJ Platform Plugin Template project provides integration of two testing approaches functional and UI tests.
### Functional tests
Most of the IntelliJ Platform codebase tests are model-level, run in a headless environment using an actual IDE instance.
The tests usually test a feature as a whole rather than individual functions that comprise its implementation, like in unit tests.
In `src/test/kotlin`, you'll find a basic `MyPluginTest` test that utilizes `BasePlatformTestCase` and runs a few checks against the XML files to indicate an example operation of creating files on the fly or reading them from `src/test/testData/rename` test resources.
> **Note**
>
> Run your tests using predefined *Run Tests* configuration or by invoking the `./gradlew check` Gradle task.
### Code coverage
The [Kover][gh:kover] a Gradle plugin for Kotlin code coverage agents: IntelliJ and JaCoCo is integrated into the project to provide the code coverage feature.
Code coverage makes it possible to measure and track the degree of testing of the plugin sources.
The code coverage gets executed when running the `check` Gradle task.
The final test report is sent to [CodeCov][codecov] for better results visualization.
### UI tests
If your plugin provides complex user interfaces, you should consider covering them with tests and the functionality they utilize.
[IntelliJ UI Test Robot][gh:intellij-ui-test-robot] allows you to write and execute UI tests within the IntelliJ IDE running instance.
You can use the [XPath query language][xpath] to find components in the currently available IDE view.
Once IDE with `robot-server` has started, you can open the `http://localhost:8082` page that presents the currently available IDEA UI components hierarchy in HTML format and use a simple `XPath` generator, which can help test your plugin's interface.
> **Note**
>
> Run IDE for UI tests using predefined *Run IDE for UI Tests* and then *Run Tests* configurations or by invoking the `./gradlew runIdeForUiTests` and `./gradlew check` Gradle tasks.
Check the UI Test Example project you can use as a reference for setting up UI testing in your plugin: [intellij-ui-test-robot/ui-test-example][gh:ui-test-example].
<div align="center">
<img src="./src/main/resources/icons/icon64x64.svg" alt="Go ORM Helper"/>
<h1 align="center">Go ORM Helper</h1>
</div>
```kotlin
class MyUITest {
<p align="center">一个为了让你在 Goland 上写 ORM 能自动补全数据库字段、Tag、生成Struct 的 Jetbrains 插件。支持gorm、xorm、beego、database/sql...</p>
@Test
fun openAboutFromWelcomeScreen() {
val robot = RemoteRobot("http://127.0.0.1:8082")
robot.find<ComponentFixture>(byXpath("//div[@myactionlink = 'gearHover.svg']")).click()
// ...
}
}
```
> 灵感来源 [Laravel Idea](https://plugins.jetbrains.com/plugin/13441-laravel-idea) &
> [PhpStorm metadata](https://www.jetbrains.com/help/phpstorm/ide-advanced-metadata.html)。 本人使用 golang 的 orm 包时,
> 一些 ORM 函数的参数是字符串并且ide不支持代码补全在字段贼多的情况下记不清楚写起来就会很不方便。以前本人写php的时候就用到前面的插件
> 感觉非常爽,所以就有了这个插件~~
![UI Testing][file:ui-testing.png]
## 特性
A dedicated [Run UI Tests](.github/workflows/run-ui-tests.yml) workflow is available for manual triggering to run UI tests against three different operating systems: macOS, Windows, and Linux.
Due to its optional nature, this workflow isn't set as an automatic one, but this can be easily achieved by changing the `on` trigger event, like in the [Build](.github/workflows/build.yml) workflow file.
- [x] ORM 代码补全
- [x] @Model 注解辅助补全
- [ ] @Table 注解辅助补全 🚧[WIP]
- [ ] 自定义 SQL 辅助不全 🚧[WIP]
- [x] SQL 转 Struct
- [x] Gorm
- [x] Xorm
- [x] 通用 Struct
- [ ] GoFrame
- [ ] Beego
- [ ] sqlx
- [ ] Tag 代码补全 🚧[WIP]
- 更多等你去发现与改进...
## Qodana integration
## 支持的ORM
To increase the project value, the IntelliJ Platform Plugin Template got integrated with [Qodana][jb:qodana], a code quality monitoring platform that allows you to check the condition of your implementation and find any possible problems that may require enhancing.
- [x] [Gorm](https://github.com/go-gorm/gorm)
- [x] [Xorm](https://gitea.com/xorm/xorm)
- [ ] [GoFrame](https://github.com/gogf/gf) 🚧[WIP]
- [ ] [Beego](https://github.com/beego/beego) 🚧[WIP]
- [ ] [sqlx](https://github.com/jmoiron/sqlx) 🚧[WIP]
- 更多等你去发现与改进...
Qodana brings into your CI/CD pipelines all the smart features you love in the JetBrains IDEs and generates an HTML report with the actual inspection status.
## 使用
Qodana inspections are accessible within the project on two levels:
![guide.gif](assets%2Fguide.gif)
- using the [Qodana IntelliJ GitHub Action][jb:qodana-github-action], run automatically within the [Build](.github/workflows/build.yml) workflow,
- with the [Gradle Qodana Plugin][gh:gradle-qodana-plugin], so you can use it on the local environment or any CI other than GitHub Actions.
Qodana inspection is configured with the `qodana { ... }` section in the Gradle build file and [`qodana.yml`][file:qodana.yml] YAML configuration file.
> **Note**
>
> Qodana requires Docker to be installed and available in your environment.
To run inspections, you can use a predefined *Run Qodana* configuration, which will provide a full report on `http://localhost:8080`, or invoke the Gradle task directly with the `./gradlew runInspections` command.
A final report is available in the `./build/reports/inspections/` directory.
![Qodana][file:qodana.png]
## Predefined Run/Debug configurations
Within the default project structure, there is a `.run` directory provided containing predefined *Run/Debug configurations* that expose corresponding Gradle tasks:
![Run/Debug configurations][file:run-debug-configurations.png]
| Configuration name | Description |
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Run Plugin | Runs [`:runIde`][gh:gradle-intellij-plugin-runIde] Gradle IntelliJ Plugin task. Use the *Debug* icon for plugin debugging. |
| Run Verifications | Runs [`:runPluginVerifier`][gh:gradle-intellij-plugin-runPluginVerifier] Gradle IntelliJ Plugin task to check the plugin compatibility against the specified IntelliJ IDEs. |
| Run Tests | Runs [`:test`][gradle:lifecycle-tasks] Gradle task. |
| Run IDE for UI Tests | Runs [`:runIdeForUiTests`][gh:intellij-ui-test-robot] Gradle IntelliJ Plugin task to allow for running UI tests within the IntelliJ IDE running instance. |
| Run Qodana | Runs [`:runInspections`][gh:gradle-qodana-plugin] Gradle Qodana Plugin task. Starts Qodana inspections in a Docker container and serves generated report on `localhost:8080`. |
> **Note**
>
> You can find the logs from the running task in the `idea.log` tab.
>
> ![Run/Debug configuration logs][file:run-logs.png]
## Continuous integration
Continuous integration depends on [GitHub Actions][gh:actions], a set of workflows that make it possible to automate your testing and release process.
Thanks to such automation, you can delegate the testing and verification phases to the Continuous Integration (CI) and instead focus on development (and writing more tests).
In the `.github/workflows` directory, you can find definitions for the following GitHub Actions workflows:
- [Build](.github/workflows/build.yml)
- Triggered on `push` and `pull_request` events.
- Runs the *Gradle Wrapper Validation Action* to verify the wrapper's checksum.
- Runs the `verifyPlugin` and `test` Gradle tasks.
- Builds the plugin with the `buildPlugin` Gradle task and provides the artifact for the next jobs in the workflow.
- Verifies the plugin using the *IntelliJ Plugin Verifier* tool.
- Prepares a draft release of the GitHub Releases page for manual verification.
- [Release](.github/workflows/release.yml)
- Triggered on `released` event.
- Updates `CHANGELOG.md` file with the content provided with the release note.
- Signs the plugin with a provided certificate before publishing.
- Publishes the plugin to JetBrains Marketplace using the provided `PUBLISH_TOKEN`.
- Sets publish channel depending on the plugin version, i.e. `1.0.0-beta` -> `beta` channel.
- Patches the Changelog and commits.
- [Run UI Tests](.github/workflows/run-ui-tests.yml)
- Triggered manually.
- Runs for macOS, Windows, and Linux separately.
- Runs `runIdeForUiTests` and `test` Gradle tasks.
- [Template Cleanup](.github/workflows/template-cleanup.yml)
- Triggered once on the `push` event when a new template-based repository has been created.
- Overrides the scaffold with files from the `.github/template-cleanup` directory.
- Overrides JetBrains-specific sentences or package names with ones specific to the target repository.
- Removes redundant files.
All the workflow files have accurate documentation, so it's a good idea to take a look through their sources.
### Dependencies management
This Template project depends on Gradle plugins and external libraries and during the development, you will add more of them.
All plugins and dependencies used by Gradle are managed with [Gradle version catalog][gradle:version-catalog], which defines versions and coordinates of your dependencies in the [`gradle/libs.versions.toml`][file:libs.versions.toml] file.
> **Note**
>
> To add a new dependency to the project, in the `dependencies { ... }` block, add:
>
> ```kotlin
> dependencies {
> implementation(libs.annotations)
> }
> ```
>
> and define the dependency in the [`gradle/libs.versions.toml`][file:libs.versions.toml] file as follows:
> ```toml
> [versions]
> annotations = "24.0.1"
>
> [libraries]
> annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
> ```
Keeping the project in good shape and having all the dependencies up-to-date requires time and effort, but it is possible to automate that process using [Dependabot][gh:dependabot].
Dependabot is a bot provided by GitHub to check the build configuration files and review any outdated or insecure dependencies of yours in case if any update is available, it creates a new pull request providing [the proper change][gh:dependabot-pr].
> **Note**
>
> Dependabot doesn't yet support checking of the Gradle Wrapper.
> Check the [Gradle Releases][gradle:releases] page and update your `gradle.properties` file with:
> ```properties
> gradleVersion = ...
> ```
> and run
> ```bash
> ./gradlew wrapper
> ```
### Changelog maintenance
When releasing an update, it is essential to let your users know what the new version offers.
The best way to do this is to provide release notes.
The changelog is a curated list that contains information about any new features, fixes, and deprecations.
When they're provided, these lists are available in a few different places:
- the [CHANGELOG.md](./CHANGELOG.md) file,
- the [Releases page][gh:releases],
- the *What's new* section of JetBrains Marketplace Plugin page,
- and inside the Plugin Manager's item details.
There are many methods for handling the project's changelog.
The one used in the current template project is the [Keep a Changelog][keep-a-changelog] approach.
The [Gradle Changelog Plugin][gh:gradle-changelog-plugin] takes care of propagating information provided within the [CHANGELOG.md](./CHANGELOG.md) to the [Gradle IntelliJ Plugin][gh:gradle-intellij-plugin].
You only have to take care of writing down the actual changes in proper sections of the `[Unreleased]` section.
You start with an almost empty changelog:
```
# YourPlugin Changelog
## [Unreleased]
### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
```
Now proceed with providing more entries to the `Added` group, or any other one that suits your change the most (see [How do I make a good changelog?][keep-a-changelog-how] for more details).
When releasing a plugin update, you don't have to care about bumping the `[Unreleased]` header to the upcoming version it will be handled automatically on the Continuous Integration (CI) after you publish your plugin.
GitHub Actions will swap it and provide you an empty section for the next release so that you can proceed with your development:
```
# YourPlugin Changelog
## [Unreleased]
## [0.0.1]
### Added
- An awesome feature
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
### Fixed
- One annoying bug
```
To configure how the Changelog plugin behaves, i.e., to create headers with the release date, see [Gradle Changelog Plugin][gh:gradle-changelog-plugin] README file.
### Release flow
The release process depends on the workflows already described above.
When your main branch receives a new pull request or a direct push, the [Build](.github/workflows/build.yml) workflow runs multiple tests on your plugin and prepares a draft release.
![Release draft][file:draft-release.png]
The draft release is a working copy of a release, which you can review before publishing.
It includes a predefined title and git tag, the current plugin version, for example, `v0.0.1`.
The changelog is provided automatically using the [gradle-changelog-plugin][gh:gradle-changelog-plugin].
An artifact file is also built with the plugin attached.
Every new Build overrides the previous draft to keep your *Releases* page clean.
When you edit the draft and use the <kbd>Publish release</kbd> button, GitHub will tag your repository with the given version and add a new entry to the Releases tab.
Next, it will notify users who are *watching* the repository, triggering the final [Release](.github/workflows/release.yml) workflow.
### Plugin signing
Plugin Signing is a mechanism introduced in the 2021.2 release cycle to increase security in [JetBrains Marketplace](https://plugins.jetbrains.com) and all of our IntelliJ-based IDEs.
JetBrains Marketplace signing is designed to ensure that plugins aren't modified over the course of the publishing and delivery pipeline.
The current project provides a predefined plugin signing configuration that lets you sign and publish your plugin from the Continuous Integration (CI) and local environments.
All the configuration related to the signing should be provided using [environment variables](#environment-variables).
To find out how to generate signing certificates, check the [Plugin Signing][docs:plugin-signing] section in the IntelliJ Platform Plugin SDK documentation.
> **Note**
>
> Remember to encode your secret environment variables using `base64` encoding to avoid issues with multi-line values.
### Publishing the plugin
Releasing a plugin to JetBrains Marketplace is a straightforward operation that uses the `publishPlugin` Gradle task provided by the [gradle-intellij-plugin][gh:gradle-intellij-plugin-docs].
In addition, the [Release](.github/workflows/release.yml) workflow automates this process by running the task when a new release appears in the GitHub Releases section.
> **Note**
>
> Set a suffix to the plugin version to publish it in the custom repository channel, i.e. `v1.0.0-beta` will push your plugin to the `beta` [release channel][docs:release-channel].
The authorization process relies on the `PUBLISH_TOKEN` secret environment variable, specified in the _Secrets_ section of the repository _Settings_.
You can get that token in your JetBrains Marketplace profile dashboard in the [My Tokens][jb:my-tokens] tab.
> **Warning**
>
> Before using the automated deployment process, it is necessary to manually create a new plugin in JetBrains Marketplace to specify options like the license, repository URL, etc.
> Please follow the [Publishing a Plugin][docs:publishing] instructions.
## FAQ
### How to use Java in my project?
Java language is supported by default along with Kotlin.
Initially, the `/src/main/kotlin` directory is available with minimal examples.
You can still replace it or add the `/src/main/java` directory to start working with Java language instead.
### How to disable *tests* or *build* job using the `[skip ci]` commit message?
Since February 2021, GitHub Actions [support the skip CI feature][github-actions-skip-ci].
If the message contains one of the following strings: `[skip ci]`, `[ci skip]`, `[no ci]`, `[skip actions]`, or `[actions skip]` workflows will not be triggered.
### Why draft release no longer contains built plugin artifact?
All the binaries created with each workflow are still available, but as an output artifact of each run together with tests and Qodana results.
That approach gives more possibilities for testing and debugging pre-releases, for example, in your local environment.
## Useful links
- [IntelliJ Platform SDK Plugin SDK][docs]
- [Gradle IntelliJ Plugin Documentation][gh:gradle-intellij-plugin-docs]
- [IntelliJ Platform Explorer][jb:ipe]
- [Marketplace Quality Guidelines][jb:quality-guidelines]
- [IntelliJ Platform UI Guidelines][jb:ui-guidelines]
- [Marketplace Paid Plugins][jb:paid-plugins]
- [Kotlin UI DSL][docs:kotlin-ui-dsl]
- [IntelliJ SDK Code Samples][gh:code-samples]
- [JetBrains Platform Slack][jb:slack]
- [JetBrains Platform Twitter][jb:twitter]
- [IntelliJ IDEA Open API and Plugin Development Forum][jb:forum]
- [Keep a Changelog][keep-a-changelog]
- [GitHub Actions][gh:actions]
[docs]: https://plugins.jetbrains.com/docs/intellij?from=IJPluginTemplate
[docs:intellij-platform-kotlin-oom]: https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#incremental-compilation
[docs:intro]: https://plugins.jetbrains.com/docs/intellij/intellij-platform.html?from=IJPluginTemplate
[docs:kotlin-ui-dsl]: https://plugins.jetbrains.com/docs/intellij/kotlin-ui-dsl-version-2.html?from=IJPluginTemplate
[docs:kotlin]: https://plugins.jetbrains.com/docs/intellij/using-kotlin.html?from=IJPluginTemplate
[docs:kotlin-stdlib]: https://plugins.jetbrains.com/docs/intellij/using-kotlin.html?from=IJPluginTemplate#kotlin-standard-library
[docs:plugin.xml]: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html?from=IJPluginTemplate
[docs:publishing]: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate
[docs:release-channel]: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate#specifying-a-release-channel
[docs:using-gradle]: https://plugins.jetbrains.com/docs/intellij/developing-plugins.html?from=IJPluginTemplate
[docs:plugin-signing]: https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate
[docs:testing-plugins]: https://plugins.jetbrains.com/docs/intellij/testing-plugins.html?from=IJPluginTemplate
[file:use-this-template.png]: .github/readme/use-this-template.png
[file:draft-release.png]: .github/readme/draft-release.png
[file:gradle.properties]: ./gradle.properties
[file:libs.versions.toml]: ./gradle/libs.versions.toml
[file:run-logs.png]: .github/readme/run-logs.png
[file:plugin.xml]: ./src/main/resources/META-INF/plugin.xml
[file:run-debug-configurations.png]: .github/readme/run-debug-configurations.png
[file:settings-secrets.png]: .github/readme/settings-secrets.png
[file:template_cleanup.yml]: ./.github/workflows/template-cleanup.yml
[file:intellij-platform-plugin-template-dark]: ./.github/readme/intellij-platform-plugin-template-dark.svg#gh-dark-mode-only
[file:intellij-platform-plugin-template-light]: ./.github/readme/intellij-platform-plugin-template-light.svg#gh-light-mode-only
[file:ui-testing.png]: ./.github/readme/ui-testing.png
[file:qodana.yml]: ./qodana.yml
[file:qodana.png]: .github/readme/qodana.png
[gh:actions]: https://help.github.com/en/actions
[gh:build]: https://github.com/JetBrains/intellij-platform-plugin-template/actions?query=workflow%3ABuild
[gh:code-samples]: https://github.com/JetBrains/intellij-sdk-code-samples
[gh:dependabot]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-dependencies-updated-automatically
[gh:dependabot-pr]: https://github.com/JetBrains/intellij-platform-plugin-template/pull/73
[gh:gradle-changelog-plugin]: https://github.com/JetBrains/gradle-changelog-plugin
[gh:gradle-intellij-plugin]: https://github.com/JetBrains/gradle-intellij-plugin
[gh:gradle-intellij-plugin-docs]: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
[gh:gradle-intellij-plugin-runIde]: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#tasks-runide
[gh:gradle-intellij-plugin-runPluginVerifier]: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#tasks-runpluginverifier
[gh:gradle-qodana-plugin]: https://github.com/JetBrains/gradle-qodana-plugin
[gh:intellij-ui-test-robot]: https://github.com/JetBrains/intellij-ui-test-robot
[gh:kover]: https://github.com/Kotlin/kotlinx-kover
[gh:releases]: https://github.com/JetBrains/intellij-platform-plugin-template/releases
[gh:ui-test-example]: https://github.com/JetBrains/intellij-ui-test-robot/tree/master/ui-test-example
[gradle]: https://gradle.org
[gradle:build-cache]: https://docs.gradle.org/current/userguide/build_cache.html
[gradle:configuration-cache]: https://docs.gradle.org/current/userguide/configuration_cache.html
[gradle:kotlin-dsl]: https://docs.gradle.org/current/userguide/kotlin_dsl.html
[gradle:kotlin-dsl-assignment]: https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
[gradle:lifecycle-tasks]: https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks
[gradle:releases]: https://gradle.org/releases
[gradle:version-catalog]: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
[jb:github]: https://github.com/JetBrains/.github/blob/main/profile/README.md
[jb:download-ij]: https://www.jetbrains.com/idea/download
[jb:forum]: https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development
[jb:ipe]: https://jb.gg/ipe
[jb:my-tokens]: https://plugins.jetbrains.com/author/me/tokens
[jb:paid-plugins]: https://plugins.jetbrains.com/docs/marketplace/paid-plugins-marketplace.html
[jb:qodana]: https://www.jetbrains.com/help/qodana
[jb:qodana-github-action]: https://www.jetbrains.com/help/qodana/qodana-intellij-github-action.html
[jb:quality-guidelines]: https://plugins.jetbrains.com/docs/marketplace/quality-guidelines.html
[jb:slack]: https://plugins.jetbrains.com/slack
[jb:twitter]: https://twitter.com/JBPlatform
[jb:ui-guidelines]: https://jetbrains.github.io/ui
[codecov]: https://codecov.io
[github-actions-skip-ci]: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
[keep-a-changelog]: https://keepachangelog.com
[keep-a-changelog-how]: https://keepachangelog.com/en/1.0.0/#how
[semver]: https://semver.org
[xpath]: https://www.w3.org/TR/xpath-21/
<!-- Plugin description end -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 MiB

@ -24,6 +24,13 @@ repositories {
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
// implementation(libs.annotations)
implementation(libs.snakeyaml)
implementation(libs.guava)
implementation(libs.druid)
implementation(libs.jsqlparser)
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
}
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
@ -39,6 +46,8 @@ intellij {
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
updateSinceUntilBuild = false
}
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin

@ -0,0 +1,14 @@
module example
go 1.20
require (
gorm.io/driver/mysql v1.5.1
gorm.io/gorm v1.25.2
)
require (
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
)

@ -0,0 +1,11 @@
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw=
gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o=
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho=
gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=

@ -0,0 +1,50 @@
package main
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"log"
)
type User struct {
ID uint // 主键
Name string // 姓名
Email *string // 邮箱
}
func (u *User) TableName() string {
return "users"
}
type User2 struct {
ID uint // 主键2
Name string // 姓名2
Email *string // 邮箱2
}
type Post struct {
ID int32 `gorm:"column:id;type:int(12);primaryKey" json:"id"` // 主讲
Context int32 `gorm:"column:body;type:tinyint(4);not null" json:"body"` // 内容
CreateTime int32 `gorm:"column:created_at;not null" json:"created_at"` // 创建时间
}
func main() {
dsn := ""
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
if err != nil {
log.Fatal(err)
}
// @Model(User)
query1 := db.Select("id", "name")
query1 = query1.Where("name = ?", "")
var user2 User2
query2 := db.Where("name <> ?", "")
query2.Where("id > ?").Find(&user2)
var post Post
query3 := db.Select("body", "created_at")
query3 = query3.Where("id IN ?", "")
query3.Find(&post)
}

@ -1,22 +1,22 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup = org.jetbrains.plugins.template
pluginName = IntelliJ Platform Plugin Template
pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-template
pluginGroup = com.github.maiqingqiang.goormhelper
pluginName = Go ORM Helper
pluginRepositoryUrl = https://github.com/maiqingqiang/go-orm-helper
# SemVer format -> https://semver.org
pluginVersion = 1.7.0
pluginVersion = 1.0.0
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222
pluginUntilBuild = 232.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformType = GO
platformVersion = 2022.2.5
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins =
platformPlugins = org.jetbrains.plugins.go
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.1.1
@ -35,3 +35,6 @@ systemProp.org.gradle.unsafe.kotlin.assignment = true
# Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom
kotlin.incremental.useClasspathSnapshot = false
org.gradle.parallel = true
org.gradle.jvmargs = '-Dfile.encoding=UTF-8'

@ -1,17 +1,28 @@
[versions]
# libraries
annotations = "24.0.1"
snakeyaml = "2.0"
lombok = "1.18.28"
guava = "32.0.1-jre"
druid = "1.2.18"
jsqlparser = "4.6"
# plugins
dokka = "1.8.10"
kotlin = "1.8.21"
changelog = "2.1.0"
gradleIntelliJPlugin = "1.14.1"
gradleIntelliJPlugin = "1.14.2"
qodana = "0.1.13"
kover = "0.7.1"
[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
druid = { group = "com.alibaba", name = "druid", version.ref = "druid" }
jsqlparser = { group = "com.github.jsqlparser", name = "jsqlparser", version.ref = "jsqlparser" }
[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }

@ -1 +1 @@
rootProject.name = "IntelliJ Platform Plugin Template"
rootProject.name = "Go ORM Helper"

@ -0,0 +1,69 @@
package com.github.maiqingqiang.goormhelper;
import com.alibaba.druid.DbType;
import com.github.maiqingqiang.goormhelper.sql2struct.ISQL2Struct;
import com.github.maiqingqiang.goormhelper.sql2struct.impl.SQL2GormStruct;
import com.github.maiqingqiang.goormhelper.sql2struct.impl.SQL2Struct;
import com.github.maiqingqiang.goormhelper.sql2struct.impl.SQL2XormStruct;
import java.util.regex.Pattern;
public interface Types {
String MODEL_ANNOTATION = "@Model";
Pattern MODEL_ANNOTATION_PATTERN = Pattern.compile(MODEL_ANNOTATION + "\\((.*?)\\)");
String TABLE_ANNOTATION = "@Table";
Pattern TABLE_ANNOTATION_PATTERN = Pattern.compile(TABLE_ANNOTATION + "\\((.*?)\\)");
enum ORM {
AskEveryTime(GoORMHelperBundle.message("orm.AskEveryTime")),
General(GoORMHelperBundle.message("orm.General")),
Gorm("Gorm"),
Xorm("Xorm");
private final String name;
ORM(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
public ISQL2Struct sql2Struct(String sql, DbType dbType) {
return switch (this) {
case General -> new SQL2Struct(sql, dbType);
case Gorm -> new SQL2GormStruct(sql, dbType);
case Xorm -> new SQL2XormStruct(sql, dbType);
default -> null;
};
}
}
enum Database {
AskEveryTime(GoORMHelperBundle.message("database.AskEveryTime")),
MySQL("MySQL"),
PostgreSQL("PostgreSQL");
private final String name;
Database(String name) {
this.name = name;
}
public DbType toDbType() {
return switch (this) {
case MySQL -> DbType.mysql;
case PostgreSQL -> DbType.postgresql;
default -> null;
};
}
@Override
public String toString() {
return name;
}
}
}

@ -0,0 +1,89 @@
package com.github.maiqingqiang.goormhelper.actions;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.github.maiqingqiang.goormhelper.sql2struct.ISQL2Struct;
import com.github.maiqingqiang.goormhelper.ui.ConvertSettingDialogWrapper;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.Project;
import net.sf.jsqlparser.util.validation.Validation;
import net.sf.jsqlparser.util.validation.ValidationError;
import net.sf.jsqlparser.util.validation.feature.FeaturesAllowed;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.datatransfer.DataFlavor;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class EditorPasteListener extends EditorActionHandler {
private static final Logger LOG = Logger.getInstance(EditorPasteListener.class);
private final EditorActionHandler handler;
public EditorPasteListener(EditorActionHandler handler) {
this.handler = handler;
}
@Override
protected void doExecute(@NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) {
String text = CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
if (verifySQL(text)) {
Project project = editor.getProject();
GoORMHelperProjectSettings.State state = Objects.requireNonNull(GoORMHelperProjectSettings.getInstance(Objects.requireNonNull(project)).getState());
Types.ORM selectedORM = state.defaultORM;
Types.Database selectedDatabase = state.defaultDatabase;
if (selectedORM == Types.ORM.AskEveryTime || selectedDatabase == Types.Database.AskEveryTime) {
ConvertSettingDialogWrapper wrapper = new ConvertSettingDialogWrapper(project);
if (!wrapper.showAndGet()) {
this.handler.execute(editor, caret, dataContext);
return;
}
selectedORM = (Types.ORM) wrapper.getOrmComponent().getComponent().getSelectedItem();
selectedDatabase = (Types.Database) wrapper.getDatabaseComponent().getComponent().getSelectedItem();
}
final Types.ORM finalSelectedORM = selectedORM;
final Types.Database finalSelectedDatabase = selectedDatabase;
WriteCommandAction.runWriteCommandAction(editor.getProject(), () -> {
if (text == null || text.isEmpty() || finalSelectedORM == null || finalSelectedDatabase == null) return;
ISQL2Struct sql2Struct = finalSelectedORM.sql2Struct(text, finalSelectedDatabase.toDbType());
Caret currentCaret = editor.getCaretModel().getCurrentCaret();
int start = currentCaret.getSelectionStart();
editor.getDocument().insertString(start, sql2Struct.convert());
});
} else {
this.handler.execute(editor, caret, dataContext);
}
}
private boolean verifySQL(String sql) {
Validation validation = new Validation(Collections.singletonList(FeaturesAllowed.CREATE), sql);
List<ValidationError> errors = validation.validate();
for (ValidationError error : errors) {
LOG.warn(error.toString());
}
return errors.size() == 0;
}
}

@ -0,0 +1,56 @@
package com.github.maiqingqiang.goormhelper.actions;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.github.maiqingqiang.goormhelper.sql2struct.ISQL2Struct;
import com.github.maiqingqiang.goormhelper.sql2struct.impl.SQL2GormStruct;
import com.github.maiqingqiang.goormhelper.ui.ConvertSettingDialogWrapper;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class SQL2StructAction extends AnAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
GoORMHelperProjectSettings.State state = Objects.requireNonNull(GoORMHelperProjectSettings.getInstance(Objects.requireNonNull(e.getProject())).getState());
Types.ORM selectedORM = state.defaultORM;
Types.Database selectedDatabase = state.defaultDatabase;
if (selectedORM == Types.ORM.AskEveryTime || selectedDatabase == Types.Database.AskEveryTime) {
ConvertSettingDialogWrapper wrapper = new ConvertSettingDialogWrapper(e.getProject());
if (!wrapper.showAndGet()) return;
selectedORM = (Types.ORM) wrapper.getOrmComponent().getComponent().getSelectedItem();
selectedDatabase = (Types.Database) wrapper.getDatabaseComponent().getComponent().getSelectedItem();
}
Editor editor = e.getData(CommonDataKeys.EDITOR);
if (editor == null) return;
String text = editor.getSelectionModel().getSelectedText();
Caret currentCaret = editor.getCaretModel().getCurrentCaret();
int start = currentCaret.getSelectionStart();
int end = currentCaret.getSelectionEnd();
final Types.ORM finalSelectedORM = selectedORM;
final Types.Database finalSelectedDatabase = selectedDatabase;
WriteCommandAction.runWriteCommandAction(e.getProject(), () -> {
if (text == null || text.isEmpty() || finalSelectedORM == null || finalSelectedDatabase == null) return;
ISQL2Struct sql2Struct = finalSelectedORM.sql2Struct(text, finalSelectedDatabase.toDbType());
editor.getDocument().replaceString(start, end, sql2Struct.convert());
});
}
}

@ -0,0 +1,11 @@
package com.github.maiqingqiang.goormhelper.bean;
import java.util.ArrayList;
import java.util.List;
@lombok.NoArgsConstructor
@lombok.Data
public class ScannedPath {
private List<String> schema = new ArrayList<>();
private long lastModified;
}

@ -0,0 +1,93 @@
package com.github.maiqingqiang.goormhelper.codeInsights;
import com.github.maiqingqiang.goormhelper.Types;
import com.goide.psi.GoFile;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.codeInsight.daemon.impl.HighlightVisitor;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class GoORMHelperHighlightVisitor implements HighlightVisitor {
private HighlightInfoHolder holder;
@Override
public boolean suitableForFile(@NotNull PsiFile file) {
return file instanceof GoFile;
}
@Override
public void visit(@NotNull PsiElement element) {
if (element instanceof PsiComment psiComment) {
modelAnnotation(psiComment);
tableAnnotation(psiComment);
}
}
private void modelAnnotation(PsiComment psiComment) {
int index = psiComment.getText().indexOf(Types.MODEL_ANNOTATION);
if (index > -1) {
Matcher matcher;
if ((matcher = Types.MODEL_ANNOTATION_PATTERN.matcher(psiComment.getText())).find()) {
holder.add(HighlightInfo.newHighlightInfo(
new HighlightInfoType.HighlightInfoTypeImpl(
HighlightSeverity.INFORMATION,
DefaultLanguageHighlighterColors.METADATA)
).range(psiComment, TextRange.from(index, Types.MODEL_ANNOTATION.length())).create());
holder.add(HighlightInfo.newHighlightInfo(
new HighlightInfoType.HighlightInfoTypeImpl(
HighlightSeverity.INFORMATION, DefaultLanguageHighlighterColors.IDENTIFIER)
).range(psiComment, TextRange.from(index + Types.MODEL_ANNOTATION.length(), matcher.group(0).length() - Types.MODEL_ANNOTATION.length())).create());
}
}
}
private void tableAnnotation(PsiComment psiComment) {
int index = psiComment.getText().indexOf(Types.TABLE_ANNOTATION);
if (index > -1) {
Matcher matcher;
if ((matcher = Types.TABLE_ANNOTATION_PATTERN.matcher(psiComment.getText())).find()) {
holder.add(HighlightInfo.newHighlightInfo(
new HighlightInfoType.HighlightInfoTypeImpl(
HighlightSeverity.INFORMATION,
DefaultLanguageHighlighterColors.METADATA)
).range(psiComment, TextRange.from(index, Types.TABLE_ANNOTATION.length())).create());
holder.add(HighlightInfo.newHighlightInfo(
new HighlightInfoType.HighlightInfoTypeImpl(
HighlightSeverity.INFORMATION, DefaultLanguageHighlighterColors.IDENTIFIER)
).range(psiComment, TextRange.from(index + Types.TABLE_ANNOTATION.length(), matcher.group(0).length() - Types.TABLE_ANNOTATION.length())).create());
}
}
}
@Override
public boolean analyze(@NotNull PsiFile file, boolean updateWholeFile, @NotNull HighlightInfoHolder holder, @NotNull Runnable action) {
this.holder = holder;
try {
action.run();
} finally {
this.holder = null;
}
return true;
}
@Override
public @NotNull HighlightVisitor clone() {
return new GoORMHelperHighlightVisitor();
}
}

@ -0,0 +1,51 @@
package com.github.maiqingqiang.goormhelper.listeners;
import com.github.maiqingqiang.goormhelper.GoORMHelperBundle;
import com.github.maiqingqiang.goormhelper.actions.EditorPasteListener;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperManager;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.goide.GoFileType;
import com.goide.psi.GoFile;
import com.goide.psi.GoStructType;
import com.goide.psi.GoTypeSpec;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.BackgroundTaskQueue;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManagerListener;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiManager;
import com.intellij.workspaceModel.ide.VirtualFileUrlManagerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MyProjectManagerListener implements ProjectManagerListener {
private static final Logger LOG = Logger.getInstance(MyProjectManagerListener.class);
@Override
public void projectOpened(@NotNull Project project) {
intializing(project);
}
private void intializing(@NotNull Project project) {
BackgroundTaskQueue taskQueue = new BackgroundTaskQueue(project, GoORMHelperBundle.message("name"));
taskQueue.run(new Task.Backgroundable(project, GoORMHelperBundle.message("initializing.title")) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
GoORMHelperManager.getInstance(project).scan();
}
});
}
}

@ -0,0 +1,40 @@
package com.github.maiqingqiang.goormhelper.listeners;
import com.github.maiqingqiang.goormhelper.bean.ScannedPath;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperManager;
import com.goide.GoFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SchemaFileListener implements BulkFileListener {
private final Project project;
public SchemaFileListener(Project project) {
this.project = project;
}
@Override
public void after(@NotNull List<? extends @NotNull VFileEvent> events) {
for (VFileEvent event : events) {
if (event.isFromSave() && event.getFile() != null && event.getFile().isValid() && event.getPath().endsWith('.' + GoFileType.DEFAULT_EXTENSION)) {
VirtualFile file = event.getFile();
GoORMHelperManager goORMHelperManager = GoORMHelperManager.getInstance(this.project);
ScannedPath scannedPath = goORMHelperManager.getScannedPath(file);
if (scannedPath == null) continue;
goORMHelperManager.clearScanned(file);
goORMHelperManager.parseGoFile(file);
}
}
}
}

@ -0,0 +1,78 @@
package com.github.maiqingqiang.goormhelper.orm.gorm;
import com.goide.inspections.core.GoCallableDescriptor;
import com.goide.inspections.core.GoCallableDescriptorSet;
import com.goide.inspections.core.GoMethodDescriptor;
import java.util.List;
import java.util.Map;
public interface GormTypes {
Map<GoCallableDescriptor, Integer> GORM_CALLABLES = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Where"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Select"), -1),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Distinct"), -1),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).First"), 1),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Find"), 1),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Not"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Or"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Order"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Group"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Having"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Attrs"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Pluck"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Omit"), -1),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).UpdateColumn"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Delete"), 1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Where"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Select"), -1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Distinct"), -1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).First"), 1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Find"), 1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Not"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Or"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Order"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Group"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Having"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Attrs"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Pluck"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Omit"), -1),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).UpdateColumn"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Delete"), 1)
);
Map<GoCallableDescriptor, Integer> GORM_MODEL_CALLABLES = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Model"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).First"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Find"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Delete"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).FirstOrInit"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).FirstOrCreate"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Take"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Last"), 0),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Create"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Model"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).First"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Find"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Delete"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).FirstOrInit"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).FirstOrCreate"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Take"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Last"), 0),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Create"), 0)
);
List<String> OPERATOR_EXPR = List.of(
"%s = ?", "%s <> ?", "%s IN ?", "%s LIKE ?", "%s > ?", "%s BETWEEN ? AND ?");
Map<GoCallableDescriptor, List<String>> GORM_WHERE_EXPR = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Where"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*gorm.io/gorm.DB).Having"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Where"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*github.com/jinzhu/gorm.DB).Having"), OPERATOR_EXPR)
);
GoCallableDescriptorSet ORM_MODEL_CALLABLES_SET = new GoCallableDescriptorSet(GORM_MODEL_CALLABLES.keySet());
GoCallableDescriptorSet GORM_CALLABLES_SET = new GoCallableDescriptorSet(GORM_CALLABLES.keySet());
}

@ -0,0 +1,298 @@
package com.github.maiqingqiang.goormhelper.orm.gorm.codeInsights.completion;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.orm.gorm.GormTypes;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperManager;
import com.github.maiqingqiang.goormhelper.ui.Icons;
import com.github.maiqingqiang.goormhelper.utils.Strings;
import com.goide.documentation.GoDocumentationProvider;
import com.goide.inspections.core.GoCallableDescriptor;
import com.goide.psi.*;
import com.goide.psi.impl.GoPsiUtil;
import com.google.common.base.CaseFormat;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.CompletionProvider;
import com.intellij.codeInsight.completion.CompletionResultSet;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiReference;
import com.intellij.psi.ResolveState;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.regex.Matcher;
public class GormColumnCompletionProvider extends CompletionProvider<CompletionParameters> {
private static final Logger LOG = Logger.getInstance(GormColumnCompletionProvider.class);
static boolean hasArgumentAtIndex(@NotNull GoCallExpr call, int argumentIndex, @NotNull PsiElement argument) {
if (argumentIndex == -1) return true;
argument = GoPsiUtil.skipParens(argument);
return argument == ContainerUtil.getOrElse(call.getArgumentList().getExpressionList(), argumentIndex, (Object) null);
}
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) {
Project project = parameters.getPosition().getProject();
GoCallExpr goCallExpr = (GoCallExpr) PsiTreeUtil.findFirstParent(parameters.getPosition(), element -> element instanceof GoCallExpr);
if (goCallExpr == null) return;
GoCallableDescriptor descriptor = GormTypes.GORM_CALLABLES_SET.find(goCallExpr, false);
if (descriptor == null) return;
Integer argumentIndex = GormTypes.GORM_CALLABLES.get(descriptor);
if (!hasArgumentAtIndex(goCallExpr, argumentIndex, parameters.getPosition().getParent()) && !(parameters.getPosition().getParent().getParent() instanceof GoKey))
return;
String schema = scanSchema(parameters.getPosition());
if (schema.isEmpty()) return;
List<String> pathList = Objects.requireNonNull(GoORMHelperManager.getInstance(project).getState()).schemaMapping.get(schema);
if (pathList == null) return;
for (String path : pathList) {
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(path);
if (file == null) continue;
GoFile goFile = (GoFile) PsiManager.getInstance(project).findFile(file);
if (goFile == null) continue;
for (GoTypeDeclaration goTypeDeclaration : goFile.findChildrenByClass(GoTypeDeclaration.class)) {
GoTypeSpec goTypeSpec = goTypeDeclaration.getTypeSpecList().get(0);
if (!Objects.equals(goTypeSpec.getName(), schema)) continue;
scanFields(descriptor, result, goTypeSpec);
}
}
}
private void scanFields(GoCallableDescriptor descriptor, @NotNull CompletionResultSet result, @NotNull GoTypeSpec goTypeSpec) {
if (goTypeSpec.getSpecType().getType() instanceof GoStructType goStructType) {
for (GoFieldDeclaration field : goStructType.getFieldDeclarationList()) {
String column = "";
String comment = "";
String type = "";
if (field.getType() != null) {
type = field.getType().getPresentationText();
}
GoTag tag = field.getTag();
if (tag != null && tag.getValue("gorm") != null) {
Map<String, String> tagMap = parseTag(Objects.requireNonNull(tag.getValue("gorm")));
if (tagMap.containsKey("COLUMN")) {
column = tagMap.get("COLUMN");
}
if (tagMap.containsKey("COMMENT")) {
comment = tagMap.get("COMMENT");
}
}
if (column.isEmpty()) {
if (field.getFieldDefinitionList().size() == 0 && field.getAnonymousFieldDefinition() != null) {
GoType goType = field.getAnonymousFieldDefinition().getGoType(ResolveState.initial());
if (goType == null) continue;
GoTypeSpec spec = (GoTypeSpec) goType.resolve(ResolveState.initial());
if (spec == null) continue;
scanFields(descriptor, result, spec);
continue;
}
String name = field.getFieldDefinitionList().get(0).getName();
if (name != null) {
column = Strings.replaceCommonInitialisms(name);
column = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, column);
}
}
if (comment.isEmpty()) {
comment = GoDocumentationProvider.getCommentText(GoDocumentationProvider.getCommentsForElement(field), false);
}
addElement(result, column, comment, type);
List<String> whereExpr = GormTypes.GORM_WHERE_EXPR.get(descriptor);
if (whereExpr != null) {
for (String s : whereExpr) {
addElement(result, String.format(s, column), comment, type);
}
}
}
}
}
private String scanSchema(@NotNull PsiElement psiElement) {
String schema = "";
GoStatement currentStatement = (GoStatement) PsiTreeUtil.findFirstParent(psiElement, element -> element instanceof GoStatement);
if (currentStatement == null) return schema;
schema = findSchema(currentStatement);
if (!schema.isEmpty()) return schema;
GoVarDefinition currentGoVarDefinition = PsiTreeUtil.findChildOfType(currentStatement, GoVarDefinition.class);
if (currentGoVarDefinition != null) {
schema = searchGoVarDefinitionReferences(currentGoVarDefinition);
if (!schema.isEmpty()) return schema;
}
GoReferenceExpression lastGoReferenceExpression = null;
for (GoReferenceExpression goReferenceExpression : PsiTreeUtil.findChildrenOfType(currentStatement, GoReferenceExpression.class)) {
GoType goType = goReferenceExpression.getGoType(ResolveState.initial());
if (goType != null && goType.getPresentationText().equals("*DB")) {
lastGoReferenceExpression = goReferenceExpression;
}
}
if (lastGoReferenceExpression != null) {
GoVarDefinition goVarDefinition = (GoVarDefinition) lastGoReferenceExpression.resolve();
GoStatement resolveStatement = (GoStatement) PsiTreeUtil.findFirstParent(goVarDefinition, element -> element instanceof GoStatement);
if (resolveStatement == null) return schema;
schema = findSchema(resolveStatement);
if (!schema.isEmpty()) return schema;
schema = searchGoVarDefinitionReferences(goVarDefinition);
if (!schema.isEmpty()) return schema;
scanSchema(goVarDefinition);
}
return schema;
}
private String searchGoVarDefinitionReferences(GoVarDefinition goVarDefinition) {
String schema = "";
for (PsiReference psiReference : GoReferencesSearch.search(goVarDefinition)) {
GoStatement statement = (GoStatement) PsiTreeUtil.findFirstParent(psiReference.getElement(), element -> element instanceof GoStatement);
if (statement == null) continue;
System.out.println("statement " + statement.getText());
schema = findSchema(statement);
if (!schema.isEmpty()) return schema;
for (GoVarDefinition varDefinition : PsiTreeUtil.findChildrenOfType(statement, GoVarDefinition.class)) {
GoType goType = varDefinition.getGoType(ResolveState.initial());
if (goType != null && goType.getPresentationText().equals("*DB")) {
return searchGoVarDefinitionReferences(varDefinition);
}
}
}
return schema;
}
private static void addElement(@NotNull CompletionResultSet result, String column, String comment, String type) {
result.addElement(LookupElementBuilder.create(column)
.withTypeText(type)
.withIcon(Icons.Gorm35x12)
.withTailText(" " + comment, true));
}
private static String findSchema(@NotNull GoStatement statement) {
String schema = "";
String comment = GoDocumentationProvider.getCommentText(GoDocumentationProvider.getCommentsForElement(statement), false);
Matcher matcher;
if ((matcher = Types.MODEL_ANNOTATION_PATTERN.matcher(comment)).find()) schema = matcher.group(1);
if (!schema.isEmpty()) return schema;
for (GoCallExpr goCallExpr : PsiTreeUtil.findChildrenOfType(statement, GoCallExpr.class)) {
GoCallableDescriptor descriptor = GormTypes.ORM_MODEL_CALLABLES_SET.find(goCallExpr, false);
if (descriptor == null) continue;
Integer argumentIndex = GormTypes.GORM_MODEL_CALLABLES.get(descriptor);
System.out.println("argumentIndex " + argumentIndex);
System.out.println("getExpressionList " + goCallExpr.getArgumentList().getExpressionList().get(argumentIndex));
GoExpression argument = goCallExpr.getArgumentList().getExpressionList().get(argumentIndex);
if (argument instanceof GoUnaryExpr goUnaryExpr) {
if (goUnaryExpr.getExpression() instanceof GoCompositeLit goCompositeLit) {
if (goCompositeLit.getTypeReferenceExpression() == null) continue;
schema = goCompositeLit.getTypeReferenceExpression().getIdentifier().getText();
} else if (goUnaryExpr.getExpression() instanceof GoReferenceExpression goReferenceExpression) {
GoVarDefinition goVarDefinition = (GoVarDefinition) goReferenceExpression.resolve();
if (goVarDefinition == null) continue;
GoType goType = goVarDefinition.getGoType(ResolveState.initial());
if (goType == null || goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
}
} else if (argument instanceof GoBuiltinCallExpr goBuiltinCallExpr) {
GoType goType = PsiTreeUtil.findChildOfType(goBuiltinCallExpr, GoType.class);
if (goType == null || goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
} else if (argument instanceof GoReferenceExpression goReferenceExpression && goReferenceExpression.resolve() instanceof GoVarDefinition goVarDefinition) {
GoType goType = PsiTreeUtil.findChildOfType(goVarDefinition.getParent(), GoType.class);
if (goType != null) {
if (goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
} else {
GoCompositeLit goCompositeLit = PsiTreeUtil.findChildOfType(goVarDefinition.getParent(), GoCompositeLit.class);
if (goCompositeLit == null || goCompositeLit.getTypeReferenceExpression() == null) continue;
schema = goCompositeLit.getTypeReferenceExpression().getIdentifier().getText();
}
}
}
return schema;
}
public static @NotNull Map<String, String> parseTag(@NotNull String str) {
Map<String, String> settings = new HashMap<>();
String[] names = str.split(";");
for (int i = 0; i < names.length; i++) {
int j = i;
if (names[j].length() > 0) {
while (names[j].charAt(names[j].length() - 1) == '\\') {
i++;
names[j] = names[j].substring(0, names[j].length() - 1) + ";" + names[i];
names[i] = "";
}
}
String[] values = names[j].split(":");
String k = values[0].trim().toUpperCase();
if (values.length >= 2) {
settings.put(k, String.join(":", Arrays.copyOfRange(values, 1, values.length)));
} else if (!k.equals("")) {
settings.put(k, k);
}
}
return settings;
}
}

@ -0,0 +1,35 @@
package com.github.maiqingqiang.goormhelper.orm.gorm.codeInsights.completion;
import com.github.maiqingqiang.goormhelper.orm.gorm.GormTypes;
import com.goide.GoParserDefinition;
import com.goide.psi.GoCallExpr;
import com.intellij.codeInsight.completion.CompletionContributor;
import com.intellij.codeInsight.completion.CompletionType;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.Nullable;
public class GormCompletionContributor extends CompletionContributor {
public GormCompletionContributor() {
extend(CompletionType.BASIC, PlatformPatterns.psiElement()
.withElementType(GoParserDefinition.Lazy.STRING_LITERALS)
.withSuperParent(3, new PsiElementPattern.Capture<>(GoCallExpr.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
return o instanceof GoCallExpr && GormTypes.GORM_CALLABLES_SET.find((GoCallExpr) o, false) != null;
}
}).andOr(PlatformPatterns.psiElement()),
new GormColumnCompletionProvider());
extend(CompletionType.BASIC, PlatformPatterns.psiElement()
.withElementType(GoParserDefinition.Lazy.STRING_LITERALS)
.withSuperParent(7, new PsiElementPattern.Capture<>(GoCallExpr.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
return o instanceof GoCallExpr && GormTypes.GORM_CALLABLES_SET.find((GoCallExpr) o, false) != null;
}
}),
new GormColumnCompletionProvider());
}
}

@ -0,0 +1,15 @@
package com.github.maiqingqiang.goormhelper.orm.gorm.codeInsights.completion;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.CompletionProvider;
import com.intellij.codeInsight.completion.CompletionResultSet;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
public class GormTagCompletionProvider extends CompletionProvider<CompletionParameters> {
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) {
}
}

@ -0,0 +1,58 @@
package com.github.maiqingqiang.goormhelper.orm.xorm;
import com.goide.inspections.core.GoCallableDescriptor;
import com.goide.inspections.core.GoCallableDescriptorSet;
import com.goide.inspections.core.GoMethodDescriptor;
import java.util.List;
import java.util.Map;
public interface XormTypes {
Map<GoCallableDescriptor, Integer> XORM_CALLABLES = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Where"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Where"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).And"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Asc"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Desc"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Select"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Select"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).In"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).In"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Or"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Cols"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Cols"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Omit"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Omit"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Distinct"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Distinct"), -1),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).GroupBy"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).GroupBy"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Having"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Having"), 0)
);
Map<GoCallableDescriptor, Integer> XORM_MODEL_CALLABLES = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Get"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Find"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Count"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Iterate"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Rows"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Sum"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Update"), 0),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Delete"), 0)
);
List<String> OPERATOR_EXPR = List.of(
"%s = ?", "%s <> ?", "%s IN ?", "%s LIKE ?", "%s > ?", "%s BETWEEN ? AND ?");
Map<GoCallableDescriptor, List<String>> XORM_WHERE_EXPR = Map.ofEntries(
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Engine).Where"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Where"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).And"), OPERATOR_EXPR),
Map.entry(GoMethodDescriptor.of("(*xorm.io/xorm.Session).Or"), OPERATOR_EXPR)
);
GoCallableDescriptorSet XORM_MODEL_CALLABLES_SET = new GoCallableDescriptorSet(XORM_MODEL_CALLABLES.keySet());
GoCallableDescriptorSet XORM_CALLABLES_SET = new GoCallableDescriptorSet(XORM_CALLABLES.keySet());
}

@ -0,0 +1,337 @@
package com.github.maiqingqiang.goormhelper.orm.xorm.completion;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.orm.xorm.XormTypes;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperManager;
import com.github.maiqingqiang.goormhelper.ui.Icons;
import com.github.maiqingqiang.goormhelper.utils.Strings;
import com.goide.documentation.GoDocumentationProvider;
import com.goide.inspections.core.GoCallableDescriptor;
import com.goide.psi.*;
import com.goide.psi.impl.GoPsiUtil;
import com.google.common.base.CaseFormat;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.CompletionProvider;
import com.intellij.codeInsight.completion.CompletionResultSet;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiReference;
import com.intellij.psi.ResolveState;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
public class XormColumnCompletionProvider extends CompletionProvider<CompletionParameters> {
private static final Logger LOG = Logger.getInstance(XormColumnCompletionProvider.class);
@lombok.Data
static class Tag {
private String name;
private List<String> params;
public Tag(String name, List<String> params) {
this.name = name;
this.params = params;
}
}
static boolean hasArgumentAtIndex(@NotNull GoCallExpr call, int argumentIndex, @NotNull PsiElement argument) {
if (argumentIndex == -1) return true;
argument = GoPsiUtil.skipParens(argument);
return argument == ContainerUtil.getOrElse(call.getArgumentList().getExpressionList(), argumentIndex, (Object) null);
}
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) {
Project project = parameters.getPosition().getProject();
GoCallExpr goCallExpr = (GoCallExpr) PsiTreeUtil.findFirstParent(parameters.getPosition(), element -> element instanceof GoCallExpr);
if (goCallExpr == null) return;
GoCallableDescriptor descriptor = XormTypes.XORM_CALLABLES_SET.find(goCallExpr, false);
if (descriptor == null) return;
Integer argumentIndex = XormTypes.XORM_CALLABLES.get(descriptor);
if (!hasArgumentAtIndex(goCallExpr, argumentIndex, parameters.getPosition().getParent())) return;
String schema = scanSchema(parameters.getPosition());
if (schema.isEmpty()) return;
List<String> pathList = Objects.requireNonNull(GoORMHelperManager.getInstance(project).getState()).schemaMapping.get(schema);
if (pathList == null) return;
for (String path : pathList) {
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(path);
if (file == null) continue;
GoFile goFile = (GoFile) PsiManager.getInstance(project).findFile(file);
if (goFile == null) continue;
for (GoTypeDeclaration goTypeDeclaration : goFile.findChildrenByClass(GoTypeDeclaration.class)) {
GoTypeSpec goTypeSpec = goTypeDeclaration.getTypeSpecList().get(0);
if (!Objects.equals(goTypeSpec.getName(), schema)) continue;
scanFields(descriptor, result, goTypeSpec);
}
}
}
private void scanFields(GoCallableDescriptor descriptor, @NotNull CompletionResultSet result, @NotNull GoTypeSpec goTypeSpec) {
if (goTypeSpec.getSpecType().getType() instanceof GoStructType goStructType) {
for (GoFieldDeclaration field : goStructType.getFieldDeclarationList()) {
String column = "";
String comment = "";
String type = "";
if (field.getType() != null) {
type = field.getType().getPresentationText();
}
GoTag tag = field.getTag();
if (tag != null && tag.getValue("xorm") != null) {
@NotNull List<Tag> tags = parseTag(tag.getValue("xorm"));
for (Tag t : tags) {
if (t.getName().startsWith("'") && t.getParams().size() == 0) {
column = t.getName().replaceAll("'", "");
}
if (t.getName().equals("comment") && t.getParams().size() > 0) {
comment = t.getParams().get(0).replaceAll("'", "");
}
}
}
if (column.isEmpty()) {
String name = field.getFieldDefinitionList().get(0).getName();
if (name != null) {
column = Strings.replaceCommonInitialisms(name);
column = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, column);
}
}
if (comment.isEmpty()) {
comment = GoDocumentationProvider.getCommentText(GoDocumentationProvider.getCommentsForElement(field), false);
}
addElement(result, column, comment, type);
List<String> whereExpr = XormTypes.XORM_WHERE_EXPR.get(descriptor);
if (whereExpr != null) {
for (String s : whereExpr) {
addElement(result, String.format(s, column), comment, type);
}
}
}
}
}
private String scanSchema(@NotNull PsiElement psiElement) {
String schema = "";
GoStatement currentStatement = (GoStatement) PsiTreeUtil.findFirstParent(psiElement, element -> element instanceof GoStatement);
if (currentStatement == null) return schema;
schema = findSchema(currentStatement);
if (!schema.isEmpty()) return schema;
GoVarDefinition currentGoVarDefinition = PsiTreeUtil.findChildOfType(currentStatement, GoVarDefinition.class);
if (currentGoVarDefinition != null) {
schema = searchGoVarDefinitionReferences(currentGoVarDefinition);
if (!schema.isEmpty()) return schema;
}
GoReferenceExpression lastGoReferenceExpression = null;
for (GoReferenceExpression goReferenceExpression : PsiTreeUtil.findChildrenOfType(currentStatement, GoReferenceExpression.class)) {
GoType goType = goReferenceExpression.getGoType(ResolveState.initial());
if (goType != null && (goType.getPresentationText().equals("*Session") || goType.getPresentationText().equals("*DB"))) {
lastGoReferenceExpression = goReferenceExpression;
}
}
if (lastGoReferenceExpression != null) {
GoVarDefinition goVarDefinition = (GoVarDefinition) lastGoReferenceExpression.resolve();
GoStatement resolveStatement = (GoStatement) PsiTreeUtil.findFirstParent(goVarDefinition, element -> element instanceof GoStatement);
if (resolveStatement == null) return schema;
schema = findSchema(resolveStatement);
if (!schema.isEmpty()) return schema;
schema = searchGoVarDefinitionReferences(goVarDefinition);
if (!schema.isEmpty()) return schema;
scanSchema(goVarDefinition);
}
return schema;
}
private String searchGoVarDefinitionReferences(GoVarDefinition goVarDefinition) {
String schema = "";
for (PsiReference psiReference : GoReferencesSearch.search(goVarDefinition)) {
GoStatement statement = (GoStatement) PsiTreeUtil.findFirstParent(psiReference.getElement(), element -> element instanceof GoStatement);
if (statement == null) continue;
schema = findSchema(statement);
if (!schema.isEmpty()) return schema;
for (GoVarDefinition varDefinition : PsiTreeUtil.findChildrenOfType(statement, GoVarDefinition.class)) {
GoType goType = varDefinition.getGoType(ResolveState.initial());
if (goType != null && (goType.getPresentationText().equals("*Session") || goType.getPresentationText().equals("*DB"))) {
return searchGoVarDefinitionReferences(varDefinition);
}
}
}
return schema;
}
private static void addElement(@NotNull CompletionResultSet result, String column, String comment, String type) {
result.addElement(LookupElementBuilder.create(column)
.withTypeText(type)
.withIcon(Icons.Xorm19x12)
.withTailText(" " + comment, true));
}
private static String findSchema(@NotNull GoStatement statement) {
String schema = "";
String comment = GoDocumentationProvider.getCommentText(GoDocumentationProvider.getCommentsForElement(statement), false);
Matcher matcher;
if ((matcher = Types.MODEL_ANNOTATION_PATTERN.matcher(comment)).find()) schema = matcher.group(1);
if (!schema.isEmpty()) return schema;
for (GoCallExpr goCallExpr : PsiTreeUtil.findChildrenOfType(statement, GoCallExpr.class)) {
GoCallableDescriptor descriptor = XormTypes.XORM_MODEL_CALLABLES_SET.find(goCallExpr, false);
if (descriptor == null) continue;
Integer argumentIndex = XormTypes.XORM_MODEL_CALLABLES.get(descriptor);
System.out.println("argumentIndex " + argumentIndex);
System.out.println("getExpressionList " + goCallExpr.getArgumentList().getExpressionList().get(argumentIndex));
GoExpression argument = goCallExpr.getArgumentList().getExpressionList().get(argumentIndex);
if (argument instanceof GoUnaryExpr goUnaryExpr) {
if (goUnaryExpr.getExpression() instanceof GoCompositeLit goCompositeLit) {
if (goCompositeLit.getTypeReferenceExpression() == null) continue;
schema = goCompositeLit.getTypeReferenceExpression().getIdentifier().getText();
} else if (goUnaryExpr.getExpression() instanceof GoReferenceExpression goReferenceExpression) {
GoVarDefinition goVarDefinition = (GoVarDefinition) goReferenceExpression.resolve();
if (goVarDefinition == null) continue;
GoType goType = goVarDefinition.getGoType(ResolveState.initial());
if (goType == null || goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
}
} else if (argument instanceof GoBuiltinCallExpr goBuiltinCallExpr) {
GoType goType = PsiTreeUtil.findChildOfType(goBuiltinCallExpr, GoType.class);
if (goType == null || goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
} else if (argument instanceof GoReferenceExpression goReferenceExpression && goReferenceExpression.resolve() instanceof GoVarDefinition goVarDefinition) {
GoType goType = PsiTreeUtil.findChildOfType(goVarDefinition.getParent(), GoType.class);
if (goType != null) {
if (goType.getTypeReferenceExpression() == null) continue;
schema = goType.getTypeReferenceExpression().getIdentifier().getText();
} else {
GoCompositeLit goCompositeLit = PsiTreeUtil.findChildOfType(goVarDefinition.getParent(), GoCompositeLit.class);
if (goCompositeLit == null || goCompositeLit.getTypeReferenceExpression() == null) continue;
schema = goCompositeLit.getTypeReferenceExpression().getIdentifier().getText();
}
}
}
return schema;
}
private static @NotNull List<Tag> parseTag(String tagStr) {
tagStr = tagStr.trim();
boolean inQuote = false;
boolean inBigQuote = false;
int lastIdx = 0;
Tag curTag = null;
int paramStart = 0;
List<Tag> tags = new ArrayList<>();
for (int i = 0; i < tagStr.length(); i++) {
char t = tagStr.charAt(i);
switch (t) {
case '\'' -> inQuote = !inQuote;
case ' ' -> {
if (!inQuote && !inBigQuote) {
if (lastIdx < i) {
if (curTag == null || curTag.getName().isEmpty()) {
curTag = new Tag(tagStr.substring(lastIdx, i), new ArrayList<>());
}
tags.add(curTag);
lastIdx = i + 1;
curTag = null;
} else if (lastIdx == i) {
lastIdx = i + 1;
}
} else if (inBigQuote && !inQuote) {
paramStart = i + 1;
}
}
case ',' -> {
if (!inQuote && !inBigQuote) {
throw new IllegalArgumentException("Comma[" + i + "] of " + tagStr + " should be in quote or big quote");
}
if (!inQuote) {
curTag.getParams().add(tagStr.substring(paramStart, i).trim());
paramStart = i + 1;
}
}
case '(' -> {
inBigQuote = true;
if (!inQuote) {
curTag = new Tag(tagStr.substring(lastIdx, i), new ArrayList<>());
paramStart = i + 1;
}
}
case ')' -> {
inBigQuote = false;
if (!inQuote) {
curTag.getParams().add(tagStr.substring(paramStart, i));
}
}
}
}
if (lastIdx < tagStr.length()) {
if (curTag == null || curTag.getName().isEmpty()) {
curTag = new Tag(tagStr.substring(lastIdx), new ArrayList<>());
}
tags.add(curTag);
}
return tags;
}
}

@ -0,0 +1,35 @@
package com.github.maiqingqiang.goormhelper.orm.xorm.completion;
import com.github.maiqingqiang.goormhelper.orm.xorm.XormTypes;
import com.goide.GoParserDefinition;
import com.goide.psi.GoCallExpr;
import com.intellij.codeInsight.completion.CompletionContributor;
import com.intellij.codeInsight.completion.CompletionType;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.Nullable;
public class XormCompletionContributor extends CompletionContributor {
public XormCompletionContributor() {
extend(CompletionType.BASIC, PlatformPatterns.psiElement()
.withElementType(GoParserDefinition.Lazy.STRING_LITERALS)
.withSuperParent(3, new PsiElementPattern.Capture<>(GoCallExpr.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
return o instanceof GoCallExpr && XormTypes.XORM_CALLABLES_SET.find((GoCallExpr) o, false) != null;
}
}),
new XormColumnCompletionProvider());
extend(CompletionType.BASIC, PlatformPatterns.psiElement()
.withElementType(GoParserDefinition.Lazy.STRING_LITERALS)
.withSuperParent(7, new PsiElementPattern.Capture<>(GoCallExpr.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
return o instanceof GoCallExpr && XormTypes.XORM_CALLABLES_SET.find((GoCallExpr) o, false) != null;
}
}),
new XormColumnCompletionProvider());
}
}

@ -0,0 +1,15 @@
package com.github.maiqingqiang.goormhelper.orm.xorm.completion;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.CompletionProvider;
import com.intellij.codeInsight.completion.CompletionResultSet;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
public class XormTagCompletionProvider extends CompletionProvider<CompletionParameters> {
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) {
}
}

@ -0,0 +1,156 @@
package com.github.maiqingqiang.goormhelper.services;
import com.github.maiqingqiang.goormhelper.bean.ScannedPath;
import com.goide.GoFileType;
import com.goide.psi.GoFile;
import com.goide.psi.GoNamedSignatureOwner;
import com.goide.psi.GoStructType;
import com.goide.psi.GoTypeSpec;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.SimpleModificationTracker;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiReference;
import com.intellij.serviceContainer.NonInjectable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@Service(Service.Level.PROJECT)
@State(name = "GoORMHelper", storages = @Storage(value = "goORMHelper.xml"))
public class GoORMHelperManager implements PersistentStateComponent<GoORMHelperManager.State> {
private State state;
private final Project project;
public GoORMHelperManager(@NotNull Project project) {
this(project, new State());
}
@NonInjectable
private GoORMHelperManager(@NotNull Project project, State state) {
this.state = state;
this.project = project;
}
public static GoORMHelperManager getInstance(@NotNull Project project) {
return project.getService(GoORMHelperManager.class);
}
public void addSchemaMapping(String key, @NotNull VirtualFile file) {
String fileUrl = file.getUrl();
if (this.state.schemaMapping.containsKey(key)) {
this.state.schemaMapping.get(key).add(fileUrl);
} else {
List<String> list = new ArrayList<>();
list.add(fileUrl);
this.state.schemaMapping.put(key, list);
}
}
public void addScannedPathMapping(@NotNull VirtualFile file, List<String> structList) {
ScannedPath scanned = new ScannedPath();
scanned.setSchema(structList);
scanned.setLastModified(file.getTimeStamp());
this.state.scannedPathMapping.put(file.getUrl(), scanned);
}
public ScannedPath getScannedPath(@NotNull VirtualFile file) {
return this.state.scannedPathMapping.get(file.getUrl());
}
public void removeScannedPath(@NotNull VirtualFile file) {
this.state.scannedPathMapping.remove(file.getUrl());
}
public void clearScanned(@NotNull VirtualFile file) {
ScannedPath scannedPath = getScannedPath(file);
for (String s : scannedPath.getSchema()) {
this.state.schemaMapping.remove(s);
}
removeScannedPath(file);
}
public void clear() {
this.state.scannedPathMapping.clear();
this.state.schemaMapping.clear();
}
@Override
public @Nullable State getState() {
return this.state;
}
@Override
public void loadState(@NotNull State state) {
this.state = state;
}
public void parseGoFile(@NotNull VirtualFile file) {
if (!(file.isValid() && file.getName().endsWith('.' + GoFileType.DEFAULT_EXTENSION))) return;
DumbService.getInstance(project).runWhenSmart(() -> {
Document document = FileDocumentManager.getInstance().getDocument(file);
if (document != null && PsiManager.getInstance(project).findFile(file) instanceof GoFile goFile) {
List<String> structList = new ArrayList<>();
for (GoTypeSpec typeSpec : goFile.getTypes()) {
if (!(typeSpec.getSpecType().getType() instanceof GoStructType)) continue;
String structName = typeSpec.getName();
addSchemaMapping(typeSpec.getName(), file);
structList.add(structName);
}
addScannedPathMapping(file, structList);
}
});
}
public void scanProject(VirtualFile virtualFile) {
for (VirtualFile file : virtualFile.getChildren()) {
if (!file.isValid()) continue;
if (file.isDirectory()) {
scanProject(file);
} else {
parseGoFile(file);
}
}
}
public void scan() {
GoORMHelperProjectSettings.State state = Objects.requireNonNull(GoORMHelperProjectSettings.getInstance(project).getState());
if (state.enableGlobalScan) {
scanProject(project.getBaseDir());
} else {
for (String path : state.scanPathList) {
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(path);
if (file == null) continue;
scanProject(file);
}
}
}
public static class State extends SimpleModificationTracker {
public final Map<String, List<String>> schemaMapping = new HashMap<>();
public final Map<String, ScannedPath> scannedPathMapping = new HashMap<>();
}
}

@ -0,0 +1,75 @@
package com.github.maiqingqiang.goormhelper.services;
import com.github.maiqingqiang.goormhelper.Types;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.SimpleModificationTracker;
import com.intellij.serviceContainer.NonInjectable;
import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@Service(Service.Level.PROJECT)
@State(name = "GoORMHelperProjectSettings", storages = @Storage("goORMHelperSettings.xml"))
public final class GoORMHelperProjectSettings implements PersistentStateComponent<GoORMHelperProjectSettings.State> {
private State state;
private final Project project;
public GoORMHelperProjectSettings(@NotNull Project project) {
this(project, new State());
}
@NonInjectable
private GoORMHelperProjectSettings(@NotNull Project project, State state) {
this.state = state;
this.project = project;
}
public static GoORMHelperProjectSettings getInstance(Project project) {
return project.getService(GoORMHelperProjectSettings.class);
}
@Override
public State getState() {
return state;
}
@Override
public void loadState(@NotNull GoORMHelperProjectSettings.State state) {
this.state = state;
}
public void setDefaultORM(Types.ORM orm) {
state.defaultORM = orm;
}
public void setDefaultDatabase(Types.Database database) {
state.defaultDatabase = database;
}
public void setEnableGlobalScan(boolean enable) {
state.enableGlobalScan = enable;
}
public void setScanPathList(List<String> scanPathList) {
state.scanPathList = scanPathList;
}
public void setSQLPath(String customTableCompletion) {
state.sqlPath = customTableCompletion;
}
public static class State extends SimpleModificationTracker {
public Types.ORM defaultORM = Types.ORM.AskEveryTime;
public Types.Database defaultDatabase = Types.Database.AskEveryTime;
public boolean enableGlobalScan = true;
public List<String> scanPathList = new SmartList<>();
public String sqlPath = "";
}
}

@ -0,0 +1,5 @@
package com.github.maiqingqiang.goormhelper.sql2struct;
public interface ISQL2Struct {
String convert();
}

@ -0,0 +1,38 @@
package com.github.maiqingqiang.goormhelper.sql2struct.impl;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
import com.github.maiqingqiang.goormhelper.utils.Strings;
import org.jetbrains.annotations.NotNull;
public class SQL2GormStruct extends SQL2Struct {
public SQL2GormStruct(String sql, DbType dbType) {
super(sql, dbType);
}
@Override
protected void generateORMTag(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
stringBuilder.append("gorm:\"")
.append("column:").append(getColumn(definition)).append(";")
.append("type:").append(getDBType(definition)).append(";")
.append("comment:").append(getComment(definition)).append(";");
if (definition.isPrimaryKey()) {
stringBuilder.append("primaryKey;");
}
if (definition.containsNotNullConstaint()) {
stringBuilder.append("not null;");
}
if (definition.getDefaultExpr() != null) {
String def = Strings.clearSingleQuotn(definition.getDefaultExpr().toString());
if (!def.isEmpty()) {
stringBuilder.append("default:").append(def).append(";");
}
}
stringBuilder.append("\" ");
}
}

@ -0,0 +1,153 @@
package com.github.maiqingqiang.goormhelper.sql2struct.impl;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
import com.alibaba.druid.sql.ast.statement.SQLTableElement;
import com.github.maiqingqiang.goormhelper.sql2struct.ISQL2Struct;
import com.github.maiqingqiang.goormhelper.utils.Strings;
import com.google.common.base.CaseFormat;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Map;
public class SQL2Struct implements ISQL2Struct {
private final String sql;
private final DbType dbType;
private static final Map<String, String> dataType = Map.ofEntries(
Map.entry("numeric", "int32"),
Map.entry("integer", "int32"),
Map.entry("int", "int32"),
Map.entry("smallint", "int32"),
Map.entry("mediumint", "int32"),
Map.entry("tinyint", "int32"),
Map.entry("bigint", "int64"),
Map.entry("float", "float32"),
Map.entry("real", "float64"),
Map.entry("double", "float64"),
Map.entry("decimal", "float64"),
Map.entry("char", "string"),
Map.entry("varchar", "string"),
Map.entry("tinytext", "string"),
Map.entry("mediumtext", "string"),
Map.entry("longtext", "string"),
Map.entry("binary", "[]byte"),
Map.entry("varbinary", "[]byte"),
Map.entry("tinyblob", "[]byte"),
Map.entry("blob", "[]byte"),
Map.entry("mediumblob", "[]byte"),
Map.entry("longblob", "[]byte"),
Map.entry("text", "string"),
Map.entry("json", "string"),
Map.entry("enum", "string"),
Map.entry("time", "time.Time"),
Map.entry("date", "time.Time"),
Map.entry("datetime", "time.Time"),
Map.entry("timestamp", "time.Time"),
Map.entry("year", "int32"),
Map.entry("bit", "[]uint8"),
Map.entry("boolean", "bool")
);
private static final String defaultDataType = "string";
public SQL2Struct(String sql, DbType dbType) {
this.sql = sql;
this.dbType = dbType;
}
public String convert() {
StringBuilder stringBuilder = new StringBuilder();
List<SQLStatement> statementList = SQLUtils.parseStatements(sql, dbType);
for (SQLStatement statement : statementList) {
singleConvert(stringBuilder, statement);
}
return stringBuilder.toString();
}
private void singleConvert(@NotNull StringBuilder stringBuilder, SQLStatement statement) {
SQLCreateTableStatement createTableStatement = (SQLCreateTableStatement) statement;
String tableName = Strings.clearQuote(createTableStatement.getTableName());
tableName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName);
stringBuilder.append("type ").append(tableName).append(" struct {\n");
List<SQLTableElement> tableElementList = createTableStatement.getTableElementList();
for (SQLTableElement sqlTableElement : tableElementList) {
if (sqlTableElement instanceof SQLColumnDefinition sqlColumnDefinition) {
generateStructField(stringBuilder, sqlColumnDefinition);
}
}
stringBuilder.append("}\n\n");
}
private String getGoType(String type) {
return dataType.getOrDefault(type, defaultDataType);
}
protected String getGoType(@NotNull SQLColumnDefinition definition) {
return getGoType(definition.getDataType().getName());
}
protected void generateStructField(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
stringBuilder.append("\t")
.append(getField(definition))
.append(" ")
.append(getGoType(definition))
.append(" ");
generateStructTags(stringBuilder, definition);
stringBuilder.append("// ")
.append(getComment(definition))
.append("\n");
}
protected void generateStructTags(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
stringBuilder.append("`");
generateORMTag(stringBuilder, definition);
generateJsonTag(stringBuilder, definition);
stringBuilder.append("`");
}
protected void generateORMTag(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
}
protected void generateJsonTag(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
stringBuilder.append("json:\"").append(getColumn(definition)).append("\"");
}
@NotNull
protected String getField(@NotNull SQLColumnDefinition definition) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, getColumn(definition));
}
protected String getDBType(@NotNull SQLColumnDefinition definition) {
return definition.getDataType().toString();
}
@NotNull
protected String getColumn(@NotNull SQLColumnDefinition definition) {
return Strings.clearQuote(definition.getName().getSimpleName());
}
@NotNull
protected String getComment(@NotNull SQLColumnDefinition definition) {
return Strings.clearSingleQuotn(definition.getComment().toString());
}
}

@ -0,0 +1,43 @@
package com.github.maiqingqiang.goormhelper.sql2struct.impl;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
import com.github.maiqingqiang.goormhelper.utils.Strings;
import org.jetbrains.annotations.NotNull;
public class SQL2XormStruct extends SQL2Struct {
public SQL2XormStruct(String sql, DbType dbType) {
super(sql, dbType);
}
@Override
protected void generateORMTag(@NotNull StringBuilder stringBuilder, @NotNull SQLColumnDefinition definition) {
stringBuilder.append("xorm:\"");
stringBuilder.append(getDBType(definition)).append(" ");
stringBuilder.append("'").append(getColumn(definition)).append("' ");
stringBuilder.append("comment('").append(getComment(definition)).append("') ");
if (definition.isPrimaryKey()) {
stringBuilder.append("pk ");
}
if (definition.isAutoIncrement()){
stringBuilder.append("autoincr ");
}
if (definition.containsNotNullConstaint()) {
stringBuilder.append("notnull ");
}
if (definition.getDefaultExpr() != null) {
String def = Strings.clearSingleQuotn(definition.getDefaultExpr().toString());
if (!def.isEmpty()) {
stringBuilder.append("default ").append(def).append(" ");
}
}
stringBuilder.append("\" ");
}
}

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.github.maiqingqiang.goormhelper.ui.ConvertSettingDialogWrapper">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="48" y="297" width="436" height="49"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4897" class="com.intellij.openapi.ui.LabeledComponent" binding="databaseComponent">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelLocation value="West"/>
<text value="选择数据库"/>
</properties>
</component>
<component id="7396f" class="com.intellij.openapi.ui.LabeledComponent" binding="ormComponent">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelLocation value="West"/>
<text value="选择ORM"/>
</properties>
</component>
</children>
</grid>
</form>

@ -0,0 +1,49 @@
package com.github.maiqingqiang.goormhelper.ui;
import com.github.maiqingqiang.goormhelper.GoORMHelperBundle;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.LabeledComponent;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Objects;
public class ConvertSettingDialogWrapper extends DialogWrapper {
private JPanel contentPane;
@lombok.Getter
private LabeledComponent<JComboBox<Types.Database>> databaseComponent;
@lombok.Getter
private LabeledComponent<JComboBox<Types.ORM>> ormComponent;
public ConvertSettingDialogWrapper(Project project) {
super(true);
GoORMHelperProjectSettings.State state = Objects.requireNonNull(GoORMHelperProjectSettings.getInstance(project).getState());
ComboBox<Types.ORM> ormComboBox = new ComboBox<>(Types.ORM.values());
ormComboBox.removeItem(Types.ORM.AskEveryTime);
ormComboBox.setSelectedItem(state.defaultORM);
ormComponent.setComponent(ormComboBox);
ComboBox<Types.Database> databaseComboBox = new ComboBox<>(Types.Database.values());
databaseComboBox.removeItem(Types.Database.AskEveryTime);
databaseComboBox.setSelectedItem(state.defaultDatabase);
databaseComponent.setComponent(databaseComboBox);
setTitle(GoORMHelperBundle.message("sql.convert.struct"));
init();
}
@Override
protected @Nullable JComponent createCenterPanel() {
return contentPane;
}
}

@ -0,0 +1,158 @@
package com.github.maiqingqiang.goormhelper.ui;
import com.github.maiqingqiang.goormhelper.GoORMHelperBundle;
import com.github.maiqingqiang.goormhelper.Types;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperManager;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.options.ConfigurableUi;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.ui.table.TableView;
import com.intellij.util.ui.FormBuilder;
import com.intellij.util.ui.ListTableModel;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.List;
import java.util.Objects;
public class GoORMHelperSettingForm implements ConfigurableUi<GoORMHelperProjectSettings> {
private final Project project;
private JPanel panel;
private ComboBox<Types.ORM> ormComboBox;
private ComboBox<Types.Database> databaseComboBox;
private JCheckBox enableGlobalScanCheckBox;
private ListTableModel<String> scanPathListTableModel;
// private TextFieldWithBrowseButton sqlPathTextField;
private TableView<String> scanPathTableView;
public GoORMHelperSettingForm(Project project) {
this.project = project;
initComponent();
}
private void initComponent() {
ormComboBox = new ComboBox<>(Types.ORM.values());
databaseComboBox = new ComboBox<>(Types.Database.values());
enableGlobalScanCheckBox = new JCheckBox(GoORMHelperBundle.message("setting.enableGlobalScanCheckBox.title"));
// sqlPathTextField = new TextFieldWithBrowseButton();
// sqlPathTextField.addBrowseFolderListener(GoORMHelperBundle.message("setting.sqlPathTextField.title"), null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
panel = FormBuilder.createFormBuilder()
.addLabeledComponent(GoORMHelperBundle.message("setting.ormComboBox.title"), ormComboBox)
.addLabeledComponent(GoORMHelperBundle.message("setting.databaseComboBox.title"), databaseComboBox)
// .addLabeledComponent(GoORMHelperBundle.message("setting.sqlPathTextField.title"), sqlPathTextField)
.addComponent(enableGlobalScanCheckBox)
.addComponentFillVertically(initScanPathComponent(), 0)
.getPanel();
enableGlobalScanCheckBox.addChangeListener(e -> {
scanPathTableView.setEnabled(!enableGlobalScanCheckBox.isSelected());
});
}
private @NotNull JPanel initScanPathComponent() {
scanPathListTableModel = new ListTableModel<>(new LocationColumn(GoORMHelperBundle.message("setting.tableview.column.location")));
scanPathTableView = new TableView<>(scanPathListTableModel);
scanPathTableView.setStriped(true);
scanPathTableView.setMinRowHeight(25);
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(scanPathTableView, null);
decorator.setAddAction(button -> {
VirtualFile selectedFile =
FileChooser.chooseFile(getFileChooserDescriptor(GoORMHelperBundle.message("setting.decorator.title")), project, null);
if (selectedFile != null) {
scanPathListTableModel.insertRow(0, selectedFile.getUrl());
}
});
JPanel scanPathPanel = decorator.createPanel();
UIUtil.addBorder(scanPathPanel, IdeBorderFactory.createTitledBorder(GoORMHelperBundle.message("setting.decorator.title"), false));
return scanPathPanel;
}
@Override
public void reset(@NotNull GoORMHelperProjectSettings settings) {
loadSettings(settings);
}
private void loadSettings(@NotNull GoORMHelperProjectSettings settings) {
GoORMHelperProjectSettings.State state = Objects.requireNonNull(settings.getState());
ormComboBox.setSelectedItem(state.defaultORM);
databaseComboBox.setSelectedItem(state.defaultDatabase);
// sqlPathTextField.setText(state.sqlPath);
enableGlobalScanCheckBox.setSelected(state.enableGlobalScan);
scanPathListTableModel.setItems(state.scanPathList);
scanPathTableView.setEnabled(!state.enableGlobalScan);
}
@Override
public boolean isModified(@NotNull GoORMHelperProjectSettings settings) {
GoORMHelperProjectSettings.State state = Objects.requireNonNull(settings.getState());
return !(ormComboBox.getSelectedItem() == state.defaultORM
&& databaseComboBox.getSelectedItem() == state.defaultDatabase
// && sqlPathTextField.getText().equals(state.sqlPath)
&& enableGlobalScanCheckBox.isSelected() == state.enableGlobalScan
&& scanPathListTableModel.getItems().equals(state.scanPathList));
}
@Override
public void apply(@NotNull GoORMHelperProjectSettings settings) {
boolean oldEnableGlobalScan = Objects.requireNonNull(settings.getState()).enableGlobalScan;
List<String> oldscanPathList = scanPathListTableModel.getItems();
settings.setDefaultDatabase((Types.Database) databaseComboBox.getSelectedItem());
settings.setDefaultORM((Types.ORM) ormComboBox.getSelectedItem());
settings.setEnableGlobalScan(enableGlobalScanCheckBox.isSelected());
settings.setScanPathList(scanPathListTableModel.getItems());
// settings.setSQLPath(sqlPathTextField.getText());
if (oldEnableGlobalScan != enableGlobalScanCheckBox.isSelected() || !oldscanPathList.equals(scanPathListTableModel.getItems())) {
GoORMHelperManager goORMHelperManager = GoORMHelperManager.getInstance(project);
goORMHelperManager.clear();
goORMHelperManager.scan();
}
}
@Override
public @NotNull JComponent getComponent() {
return panel;
}
private static FileChooserDescriptor getFileChooserDescriptor(@NlsContexts.DialogTitle String title) {
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true)
.withShowFileSystemRoots(true)
.withShowHiddenFiles(true);
if (title != null) {
descriptor.setTitle(title);
}
return descriptor;
}
}

@ -0,0 +1,10 @@
package com.github.maiqingqiang.goormhelper.ui;
import com.intellij.openapi.util.IconLoader;
import javax.swing.*;
public interface Icons {
Icon Gorm35x12 = IconLoader.getIcon("icons/gorm35x12.svg", Icons.class);
Icon Xorm19x12 = IconLoader.getIcon("icons/xorm19x12.svg", Icons.class);
}

@ -0,0 +1,57 @@
package com.github.maiqingqiang.goormhelper.ui;
import com.goide.GoFileType;
import com.goide.GoIcons;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.ui.JBColor;
import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.table.IconTableCellRenderer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.table.TableCellRenderer;
public class LocationColumn extends ColumnInfo<String, String> {
public LocationColumn(@NlsContexts.ColumnName String name) {
super(name);
}
@Override
public @Nullable String valueOf(String s) {
return s;
}
@Override
public @Nullable TableCellRenderer getRenderer(String s) {
return new IconTableCellRenderer<String>() {
@Override
protected @Nullable Icon getIcon(@NotNull String value, JTable table, int row) {
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(value);
if (file != null) {
if (file.isDirectory()) {
return PlatformIcons.FOLDER_ICON;
} else if (file.getPath().endsWith('.' + GoFileType.DEFAULT_EXTENSION)) {
return GoIcons.ICON;
}
}
return AllIcons.General.Error;
}
@Override
protected void setValue(Object value) {
String url = (String) value;
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
if ((file == null)) {
setForeground(JBColor.RED);
}
setText(file != null ? file.getPresentableUrl() : url);
}
};
}
}

@ -0,0 +1,29 @@
package com.github.maiqingqiang.goormhelper.ui;
import com.github.maiqingqiang.goormhelper.GoORMHelperBundle;
import com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings;
import com.github.maiqingqiang.goormhelper.ui.GoORMHelperSettingForm;
import com.intellij.openapi.options.ConfigurableBase;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public class SettingConfigurable extends ConfigurableBase<GoORMHelperSettingForm, GoORMHelperProjectSettings> {
private static final String ID = "go.orm.helper";
private final Project project;
public SettingConfigurable(Project project) {
super(ID, GoORMHelperBundle.message("name"), null);
this.project = project;
}
@Override
protected @NotNull GoORMHelperProjectSettings getSettings() {
return GoORMHelperProjectSettings.getInstance(project);
}
@Override
protected GoORMHelperSettingForm createUi() {
return new GoORMHelperSettingForm(project);
}
}

@ -0,0 +1,40 @@
package com.github.maiqingqiang.goormhelper.utils;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
public class CacheManager {
private static volatile CacheManager instance;
private static final Object monitor = new Object();
private final Cache<String, Object> cache = Caffeine.newBuilder().build();
private CacheManager() {
}
public void put(String cacheKey, Object value) {
cache.put(cacheKey, value);
}
public Object get(String cacheKey) {
return cache.getIfPresent(cacheKey);
}
public void clear(String cacheKey) {
cache.put(cacheKey, null);
}
public void clear() {
cache.cleanUp();
}
public static CacheManager getInstance() {
if (instance == null) {
synchronized (monitor) {
if (instance == null) {
instance = new CacheManager();
}
}
}
return instance;
}
}

@ -0,0 +1,69 @@
package com.github.maiqingqiang.goormhelper.utils;
import java.util.Map;
public class Strings {
// https://github.com/golang/lint/blob/master/lint.go#L770
public static final Map<String, String> COMMON_INITIALISMS = Map.ofEntries(
Map.entry("ACL", "acl"),
Map.entry("API", "api"),
Map.entry("ASCII", "ascii"),
Map.entry("CPU", "cpu"),
Map.entry("CSS", "css"),
Map.entry("DNS", "dns"),
Map.entry("EOF", "eof"),
Map.entry("GUID", "guid"),
Map.entry("HTML", "html"),
Map.entry("HTTP", "http"),
Map.entry("HTTPS", "https"),
Map.entry("ID", "id"),
Map.entry("IP", "ip"),
Map.entry("JSON", "json"),
Map.entry("LHS", "lhs"),
Map.entry("QPS", "qps"),
Map.entry("RAM", "ram"),
Map.entry("RHS", "rhs"),
Map.entry("RPC", "rpc"),
Map.entry("SLA", "sla"),
Map.entry("SMTP", "smtp"),
Map.entry("SQL", "sql"),
Map.entry("SSH", "ssh"),
Map.entry("TCP", "tcp"),
Map.entry("TLS", "tls"),
Map.entry("TTL", "ttl"),
Map.entry("UDP", "udp"),
Map.entry("UI", "ui"),
Map.entry("UID", "uid"),
Map.entry("UUID", "uuid"),
Map.entry("URI", "uri"),
Map.entry("URL", "url"),
Map.entry("UTF8", "utf8"),
Map.entry("VM", "vm"),
Map.entry("XML", "xml")
);
public static String replaceCommonInitialisms(String s) {
for (Map.Entry<String, String> entry : COMMON_INITIALISMS.entrySet()) {
s = s.replaceAll(entry.getKey(), entry.getValue());
}
return s;
}
public static String clearQuote(String s) {
if (s.startsWith("`") && s.endsWith("`")) {
return s.substring(1, s.length() - 1);
}
return s;
}
public static String clearSingleQuotn(String s) {
if (s.startsWith("'") && s.endsWith("'")) {
return s.substring(1, s.length() - 1);
}
return s;
}
}

@ -1,14 +1,12 @@
package org.jetbrains.plugins.template
package com.github.maiqingqiang.goormhelper
import com.intellij.DynamicBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
@NonNls
private const val BUNDLE = "messages.MyBundle"
object MyBundle : DynamicBundle(BUNDLE) {
private const val BUNDLE = "messages.GoORMHelperBundle"
object GoORMHelperBundle: DynamicBundle(BUNDLE) {
@Suppress("SpreadOperator")
@JvmStatic
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
@ -18,4 +16,4 @@ object MyBundle : DynamicBundle(BUNDLE) {
@JvmStatic
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
getLazyMessage(key, *params)
}
}

@ -1,12 +0,0 @@
package org.jetbrains.plugins.template.listeners
import com.intellij.openapi.application.ApplicationActivationListener
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.wm.IdeFrame
internal class MyApplicationActivationListener : ApplicationActivationListener {
override fun applicationActivated(ideFrame: IdeFrame) {
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
}
}

@ -1,17 +0,0 @@
package org.jetbrains.plugins.template.services
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import org.jetbrains.plugins.template.MyBundle
@Service(Service.Level.PROJECT)
class MyProjectService(project: Project) {
init {
thisLogger().info(MyBundle.message("projectService", project.name))
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
}
fun getRandomNumber() = (1..100).random()
}

@ -1,45 +0,0 @@
package org.jetbrains.plugins.template.toolWindow
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBPanel
import com.intellij.ui.content.ContentFactory
import org.jetbrains.plugins.template.MyBundle
import org.jetbrains.plugins.template.services.MyProjectService
import javax.swing.JButton
class MyToolWindowFactory : ToolWindowFactory {
init {
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
}
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val myToolWindow = MyToolWindow(toolWindow)
val content = ContentFactory.getInstance().createContent(myToolWindow.getContent(), null, false)
toolWindow.contentManager.addContent(content)
}
override fun shouldBeAvailable(project: Project) = true
class MyToolWindow(toolWindow: ToolWindow) {
private val service = toolWindow.project.service<MyProjectService>()
fun getContent() = JBPanel<JBPanel<*>>().apply {
val label = JBLabel(MyBundle.message("randomLabel", "?"))
add(label)
add(JButton(MyBundle.message("shuffle")).apply {
addActionListener {
label.text = MyBundle.message("randomLabel", service.getRandomNumber())
}
})
}
}
}

@ -1,18 +1,53 @@
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
<idea-plugin>
<id>org.jetbrains.plugins.template</id>
<name>IntelliJ Platform Plugin Template</name>
<vendor>JetBrains</vendor>
<id>com.github.maiqingqiang.goormhelper</id>
<name>Go ORM Helper</name>
<vendor>John Mai</vendor>
<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.go</depends>
<depends>org.jetbrains.plugins.go</depends>
<resource-bundle>messages.MyBundle</resource-bundle>
<resource-bundle>messages.GoORMHelperBundle</resource-bundle>
<extensions defaultExtensionNs="com.intellij">
<toolWindow factoryClass="org.jetbrains.plugins.template.toolWindow.MyToolWindowFactory" id="MyToolWindow"/>
<projectService serviceImplementation="com.github.maiqingqiang.goormhelper.services.GoORMHelperManager"/>
<projectService
serviceImplementation="com.github.maiqingqiang.goormhelper.services.GoORMHelperProjectSettings"/>
<completion.contributor language="go"
implementationClass="com.github.maiqingqiang.goormhelper.orm.gorm.codeInsights.completion.GormCompletionContributor"/>
<completion.contributor language="go"
implementationClass="com.github.maiqingqiang.goormhelper.orm.xorm.completion.XormCompletionContributor"/>
<highlightVisitor
implementation="com.github.maiqingqiang.goormhelper.codeInsights.GoORMHelperHighlightVisitor"/>
<editorActionHandler action="EditorPaste"
implementationClass="com.github.maiqingqiang.goormhelper.actions.EditorPasteListener"
order="first"/>
<projectConfigurable
parentId="tools"
instance="com.github.maiqingqiang.goormhelper.ui.SettingConfigurable"
displayName="Go ORM Helper"/>
</extensions>
<applicationListeners>
<listener class="org.jetbrains.plugins.template.listeners.MyApplicationActivationListener" topic="com.intellij.openapi.application.ApplicationActivationListener"/>
</applicationListeners>
<extensions defaultExtensionNs="com.goide">
</extensions>
<projectListeners>
<listener class="com.github.maiqingqiang.goormhelper.listeners.MyProjectManagerListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
<listener class="com.github.maiqingqiang.goormhelper.listeners.SchemaFileListener"
topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
</projectListeners>
<actions>
<action class="com.github.maiqingqiang.goormhelper.actions.SQL2StructAction" text="SQL2Struct">
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
</action>
</actions>
</idea-plugin>

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 131 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.4 MiB

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="19px" height="12px" viewBox="0 0 76 48" enable-background="new 0 0 76 48" xml:space="preserve"> <image id="image0" width="76" height="48" x="0" y="0"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAAAwCAYAAAC7d5yRAAAAIGNIUk0AAHolAACAgwAA+f8AAIDp
AAB1MAAA6mAAADqYAAAXb5JfxUYAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAAimkAAIppAbFl
szIAABzJSURBVGje1Zt3mFXl1fZ/u5x+zsw5c850psLQZ+gDjBRBUIogiQVNYqxgxEtjiYmJNdZX
v+jnqzEqxoK9oEgRUYooKCLVocMMM8P0fub0svd+3j9GiX5RIGq+XO99XfuPU/baz7rPetaz1v08
RxKGwSlBkgCo/HQLnR2dTJk7+/h7hqbT2dBOU80xMrKziEZixGMJ+paWgCpRd6AGf0sP7gwP6Vk+
kkLHHw7T2tFNc31TUWtV+1AjkSz0qa7Sw9saJnd3dmenOlRUpwvDil+yqNVKir22PeI/lFDZZ3Kl
rBzYvwRPioVQTMPusBOJ+oknYhiShKJKFBfk0RWI0dDQgElOkJGdzbjxEzHbZJKJU3P5u6D+8FtP
HUIIhCHIyMlATbOzfsXa0pbKuoUpMflMS5fUv09MweawkBl0kqpn4RxUwuSBZdSHmogZhitiJPL8
yTBBk5uWeA+HW7urdnVte0P12JYW9O27Ozs/F6VHI9kdRzcEIP3bfPm3EyYMQUqqC6GaWPvR5sGh
Q823mOpDF4/35lOYmo3FbcZIlYi0J0kaBn4pSUdPkKMtTYSNGEIFYQKPLYV0WxpDXX2ZKLR+Bxrr
bj3Q3Xxra+XBL1pqG96WHfKy7KyMI+lpbiLRMEKI/32ECUNgcVlpaO9g40sfPOSpT9w8Lrc/A4aN
piccIxiKEUpNoLcYJI6CYpJxKGbCUgwtroEEkgDJAM3QSeo6oVgcYRL0zcphWP9+tAcD5Ye76ss7
RfDBw5WVa6pTU28tH1m202qxIAKx/z2E6ZqOJdVKQ2ensmHxW5+frueNLj99FH4tRnNPO7LFhOyV
0NsEWo2BhARmA7NQEJqEkRDIikTvBBPICAwkFMCQJKLhOMF4DCFLDCvqR0a+g5bOzhlLt2ydsXbD
xoWXXfLLZ5xOB4ZhgPzT+fUTmupFb74yyC8p4HBNvfXNe578bP6U0aPLzxlDU7KTqCmGYpchqkN1
EnFERxYysgnQBGYU9ESCZDKBakhImkDSJRRdQk4KJA3kJMgaKEkgKvC3RDhW347ZbOGqGTMY70tf
/O6yFff2RKK4XK6fdHr+pBFm6Dp2uw1nhpc1760f3Ll+97Jz8kv65/n60FLTjtKgYaBDVMIISJAA
xaaALGGI3kStCFB0HZEUSDJIsoQkBALp+K8rJIEelZAUCZtPBieoVgnMSXriAS44YzLrt++8deXy
5WnlEyYs+ilJ+8kIE4bAl5lOQpX5YMk7t0Q37Xng/HEVpPrSaT3SihKWMGpjIClgkpHNKoZDRjIM
ZAGggJCJJwx0Q8YsKSAEsg7CAIQAs4QiCfQYyIrAkqtg9skYCDRNIGISJhf4k13MPG00JrPp6hfW
rMoYOGTg5VNPnxRQFZkfy9tPMiVlVcHbJ4uD9c2eZ+94ZHHuwcYHFs6ZgcnjoCPYjWICYTLAIZBs
BrJZIKEhCwNJEsgYKEJHEQLJDLJdQXFKKA6QHaCaJWQD5LhASoIUB6tPxuqR0CMGIiqQNAktKEh0
GehRg7gewW53ct6IUecarZ2HPtjw6VybCxx2MJt7L6u195LkXiakU7j+5QgTQiDL8vGi9WuseHXZ
L5rXbX58gMmaVjF5OB3hIHrCQPkqciQZhKRDxOiNHFkBRUe2qciKCUnIKC4TNpcZf2cId5oDs0PF
UAEJklGDeLdGMiIQboGaIZGM6MhCR6ggi94h6XEwoVJb00F9QzsTBg5nYllZ1uL3Vi1/4cV3z5k3
Z/qK9rYAqqqgKgrRaBif24FJkdFPIfz+ZcIUVSEajhAPRTDbbUiyxEfvbZjd/u7qVxbNn8v2miaO
+dvx2VMx4gboAsmuoIYE5qSCpSQFkWUhHEvgbwwRqg0S0jQ0FxgWFaPT4EBjPS16Fyabii4MhCJh
UlWUuIlki45VmEnpsuE02XGnOrHazGiKTjgZI5JM4rJY2V1bR5bHhZ6I0dqsceXMs3hq3frnt2QX
ePvlphOKxNm79wAup0r6yH4IGXT930CYqqpoWpKDO3dTOq6ckG7QuOGTxy84YzRxRaAlkxiGhqTq
WK0qLsVO1C5R82kNnYkgAYtKostANmQMq4Hu0zBqdBSbFVm3YDMU8vK86FaBjo6hg67rCEMjocYI
qwm0bg25SgJDBlXCkMHlcpDhdVOSn4NkKIikoCjfRzwQJx7R0V0uCl3etGPVB8cOzM/c2tXeQVtb
K5mZA1BUMyDoLWJ+YsIMw8DpchGPx5HNKg37qnxpIlrk7uMlFI0hKwaqIuHJdLN/VzVVje2EexKI
pjhpYzNJtVixYcFldeC02rGPtGFpViEkI7kVDGRUj6m3wtekXjeEIGkYyGYJV8gJYUEwNYw/FCKg
xQkLjUAySm1jK1VNTdR2tDJqUH+G5uazvf0YiiHh7wow0JvLXj16fiie3NoTDOFxe5AkmX+lmfqX
CcvIzqauuoa6Q1W+rmDQt/GdVfNm90kjbhggGxTmetmyt5qdR48RDyfIyHAzujuNnOkFxAolOqo7
SAqB1+EgJS2dhB6nOyUCMYEIgjArSHEVkQTDkAAJTdfJTPORiMZ548M1VNd1ohabUMwKQhcQS1Bc
kMtZY4YTikVw220crK/judVhJmQPw6RoaFISxaqwfe3Wi7ftq9yZ0OTWrOysDSNHDRaKLKPr2in5
L/2r9ckrjz42vXLHrtv6Dx06RjKZbYqk8OXGT/n1+MEMH1XK+x9Vsq+6kfLh/ZlUMRa2NLPqsRUc
HmTBKEnH7kxBaIJoWzeWUIIxfUsYV15Oz9EA0WQCySQhPCaEWUF81UjnpGfw8SfbeP9AJamleQwY
N4T8vjlYrBa6Ov3s37mf9978kM6jHSy6ZD4Tivvhctr427sfEQjGufTMKeQWerlm8V/pU17MpNHD
aWhpZ90n22ty8vOuu/uWhat6/H70U1BuJCOZPOmXhCGQzSZWvvjStM0ffrj2xv96gMw+fQBo6Ohh
8VULue2yObz36QFae0L8Zv4ssLtZcd8LLF29lYGXn824+WdRNqoMX4oLgGMtbez4bDu7P/gU7/4w
C0bNQhRa6QlHkG0quFU0ySDXl8XyletZ21HDhX+4mAljR3zvOJ957FVWr97ErHMmYv4izNkFY3ml
+jMaYx3cMv88XlizBmVkFtctuvCrOwwuX3QHRSWDhp37s7MrW1pakaQTT05Ji0ZPSphiMtHW1Kg8
ceftrbc9udhrslgASCQN7rzkCq6dVMSxhJlde+q4+hez0WvaeOiRd3hjXyX3rXyO2WdPO6H9/773
KToe3cStV11GNEMhEU8grDKZBRls2rSN16r38PDSh7ErJ88gb7/wHo0tXQwoH8C2O9fxu5+dxwOf
LSMt3cFV02dy7cvP0P/0/kw5bTyjRw2iu6uLa25+aM2ll18xU0agG/oJ7auNtUdPOgib08mHb70+
tqxivNdksdDd3sbDt/yJz3bu59qhWfgMeGvdNhbOnkjbux+xsibELuCVz1YxZHzZSe3/9rbf8IRZ
5enHl/LbRZfQYsRRZQhWdbHqi53c/Nptp0QWwLmXzuaWix9k6qzx6H+cyIt/+YBr583moY/f4VhH
B2cPHc283/4WgGXvvsC8c6ZTPnLA5I/WfWAfMWxIJBaPn5iw6ClEmAY0NzeNGtWvBICqPZXc99yz
TC4s4GczZvLOss8Z5vNha2vmfX+U1pIizj1txCmR9TWu+f2V3L7+IFuXb6F0fCkWu41l76+n35yR
FOfmnPT+zvpu6puaGD52CL+5/Ze8+PBS7nj6eu5dsh2tLcZATy7vbtzCb+f9nLkTZ7Ji07N0dXQB
kOpy2Z5//o2stuZjR5OJEyd/NTsv96SDsdicpLpd8WSyl/2h5WP5xYw5DLEHiMVCBHuCzBvRl/fX
bCbj1vuQj7VQ3L/gpHajHWGWvfQ67lQvsy6fx4y7LuTz855h7IjhEIjT1NlN6cQzT2pn5d8/5Oar
76BV62DOlFm8uOExPFmpRBNxRswdztqnd1AxeQjLG7cQdQUYVpxF0Zh7uPyK+QDU1dRrl11yWfOw
YYOIRk+soamydPJ2UiAYUXHa+xtWLuOscy/E5nSx4IYb8K+4n4PtXaTYZWTNT6BvX3ILCqndup3S
BfNPaLO9rpWrxs3ns5bNtKFz38e3c/Xfb2VviZdQtx/ZUFG8NrL7Zp/QTmtNG79fcAd+/PS15fPS
Ry8z47HTKSnpR8vRdgpH5HM0uYsBgzNJF05qO5rol53N6dedD8Bbb6ygoy10769/fWY0EAjhTjlx
1aA6vRknJQxgzJQZ9Xt2bL/p4T9e//CNDzxK17EjjOibQktnkMxUmfraGjLHXojH5SDS3n7S1ebt
R5fwUcvHVHgqGDymjJUvvs2gyWPIGZJLsN1PmicdFAOhndiB7lY/QboxJJ27H/8TO3ZU8vGqz5h7
0dkYuo7NZsdSYELKk0g75uBoUwuGInjg3r/itJuprap76s/33/tnV6ob3ZBOWsCq8Uj45GwJgawo
XP672x558PqFlkvPnHh/doYPPT1Oe9VRflbWh2MH61DTfGRm+zC8zpOaNJlVEoBA57IbF9DV0k5n
ZwcZbgVbn1QsmalwJEFjdQODSoq+106/EX2ZPfYsFm99kjtuuI9Uh4cHltzO4T1Hycorp7mlC9cA
M6QZpOfa+XhnJUX5ufQJ6jQePcbEismvxINxvji4tVdUOClh4cApRRiAyWrjzLlzDvWJfMKAAT66
awJ06TGsdgXNiBOPRTErErpFpb25hfTsrO+19fPrf82Hb61ifc1HTJ0xigfvfZLx501j/R8ewz13
IEkM8vukUfXFXqbNmPj9DlgUHlv7FwbdMZBte3ex6PorKRqUz4pnP8Bx07n4D1Wj2ozenhMY3LeQ
eWdOgLQU6vbs5c2PqwbUVNVvTsRCp9QfqeFw8JQJ04TE0Zpj6aX5DsqKIKKYiIZdBBMRHE4IxHrJ
dzgcfPDOMn51zdXfa8uT7ePFXe/x9pKXcDhSOeeK+bz0xCtkGALsFtRYkjkzzuDOZ1/gwNE6BhV/
/yJicZm5/v8uOv7693PvZur5EwBoPtiE3TCBaiBJBkI2iCUSqJ1dtHb2YHJKsZxCF6HgqXU8qict
DUVRQZJPKuNKJisDx52x6vO7H6LUHcfuzkYxaURiIYqGFrC/4xhxYO4vL+KBG3/HrAvOJy3d9/2O
ptr4xXULAdix9zD1767jT4uuoOroUXpCUQpz87ls0uk8c/OjXPvcXWSlpp7Uob/esJiUVDszLp5K
VyRM7bY9nF9RTjKhkZA1dF1HMZto62jnUGOLf/DQoRszM1NxOU2nRJgkDI1EPIqMQP1K5vj+b8ug
mHn/jZcu3/Xk1c9OGF3C9kMRzhriZsiQQpYfljGPX8jMWVPY+vFG3nzueW59+GHSfL4TDmLPwWpe
u+HPnD+sjNXVNWzcWYlm6MjITBs5mqEOL4eVBMN+eRbTpk34Thut9W089bvFaEmDe965gwTw+G2P
Mc7lZfiwITjSbLy7YxP7amsoG9IfdMEHm7avCsTjc1x220mJ0g0di8WCiqQQCAdRtAQWRT6xIiQE
VmcqHpe5u0+mjGoBSYVjgQRDIm1MHj6cNz59k61eH2Mnn46m69x/yy2cNmUKs887D/NXLdU38dTj
z1G3ej03T5/II8vXcd8nbzPSNxiHzUkoFuZP7zzOgtJZ/HzYWI4+uZoHlm4kd0x/hg4fTKrNQaDd
z5Hdh2mobWHkWaOYc/lMtlfuY8vr6xhl8zCmvJRwIk7TkU7q93dw0fRp6JJOisVOTWZPoCESJcVq
+d5VXQiBJMtYrWaaGhqRhDDo6mzBbFIxK+qJIwwJxWTjnf++6aXhwRd/VVI2gki34OnVbcwc7GDg
kGKa7SWs3BHAN3wWPz93NoFYkpUvLiHS1U2ax4vT58UQCtu27GDr++spz3Aye/hgPg/oSH2L6W5p
45P3NxAOhrBZ7JRPrmDkmafhr2/FWdmMr83Cpt372Ke3Yba4SClMJ60gnYlzJ5Kdk8mBFbuIHuxg
3M8HUDKoL13+EJleD08vW0lhdhZnjB5JOBql8sAhDunGgqkzpv+9s6UdWf5nwr7WyRRFxWZ28vmO
zb16mDAMZFXFbPcghI4kKd9DXK8mqcq6UygKbR1h0hxWKoY6WPFlmGz3MbLTk1wwpA+bD77Ni/d/
Qv7AMYyfPJWD+w5yYNt26tdtJNrSgmhv4w+D+lM+fgT37apm+rWLmFQxEoCOpuvoaG8jzeMlI/8f
K+1f/vI3HO808udLbqKzqYqGnh6MdDu6QybwTjWdgSOMcPgoHjyJaJ5EVI2R6XLyX089j9Pn5qwJ
Y2hsbcNmseJy2fEfrSuVrTp5JekkEsnvchezWWX/tmrQA4RCod4I6+xoxm63Y7U6CXfUI0sSfFdN
IkmYbG7ee/rWxfltSxYU9etPNGqQ7baxbkeQXVUxFk704Laa0DJK6IhKVB1pxR9VMTu9uFwe7IqJ
bI+TjNQUgmt2cfVbn3D95vcZPaTkpHkEYMHQi5imZTHR25ecEYMh0wmShogbxDSDaDKJ7FdxV7ip
9TSwZXcNNapgdKqPacNLafH7MQxId6fy3sZP8WemzJ0xd8pKf4f/n54lqzJaTGPv1mpysvqw98ju
fyiuhqEjySpWl5tooPurkuT/DVMDIxnD5MyoizTpKCYJKQGtgShnjHRhsZj52/oGxmbFqBgjyCoe
Tlb+CDC+0t8VM8QM6nZV8epbtUijppM5zYQt0POtp3S3dfbu4OgGvpx/dCKbXv2QgZOGkzFnPGue
3YSj8iM8FhtpVhdeZyoWxUYiodPU1EHtvgD+KVbGXziTOUP7s+HBF4nF4khIyAL8wTCTTh/Kq6t3
XPvxksqVVqvMNzcthRDYrHbaQy30xHso6dcf+A6JWrG6INiDrmlI3xFlhhDYvIV7ooYVs9kgHJUQ
Ri9pkwYkqQoPZm/GabTv+wDnl2txuT0oZheJhEQkaSaspxBz9CFz4XxmzJvBaQeP8Nfrb2PYWZOR
VBPhnhDhYJiGunr6lvRHtZiRhETMH6H9cDOX3X8NhaX9mDhzErt2VtK+p5bmtgitnQliwQ5Usw1R
7iO9XynnzZ2EWZYIRWMkVAgnQmBTkUwSmATikMBcZcp2T0sn2+Mm+Q0xVVYUjIigvqkR2f6Pkuuf
CJMkGVd6LolIAFn5alPwG/lMtThw5Qw43CBcqFICFBWQsZpktu8+TH7ZuUy78k5qmq6jZscmYt3N
IKsoFjup7gz6Fw2gf78+x+3lDyzhxice4o/zL6dg8CB++btFWG123n7mZa64/VraG1pY/PtHSMQT
3PX6w1gctuMDHzOyDEaWHU/QUQSWrw6sfBNOmxVzups9W6sorxhBoDFMolZg7EogJw0yhrvIcriJ
xxLH55WiKFidFvZ2SMRj3/D/n0JI6F/NXwuKrCCZTHx7g1ym36Cy6uaMwc3BUGU2SRNgwupw0RpV
sKYPAKAox0NRztxTyktZfQuYc9F5DBo/ipKywbTVNKDENcxmM7nF+Uw/bybhYOg4Wd8FCbCfoLcp
Lh/KzmffZWybRrIriREH1Saja1K86ZN2wqYghm70bgZrBrIsU1iRi6TISN9YQdXvfLTUW6MePvwl
hw7WISvS8fktSRJRQ0lGLAO3JvPy56nJKHqgCVmrQ9cNUrwn19e+C4GeLnTdOO68+ZvpQIGeto4f
ZPdr5A7I5Ui+l0BbF3KKCWuKlZrqetQC+5fjpg8l0RE/7mMyoZFdkE7EEiceSXwrlatfk/Dtwk0m
Fg+jqoKSgUOIRcOIr7RuWVHwh5J0dHvSLZn9SGoCJS2MpDegbn+VRKj9Bznk7+zA16dX+4rH4+zf
seP4Z621DURORVU5AVRFRXWpGGhIThWv1cHaWCPWvH7PiLhBLBzrPZIQ1/CkpWBJM9HTFfqnglYF
CZc7HdO3NHOBoevk9ilk6xc7SU1xUzayHF1LYDJb2XegKiVwuGOc0+KjMxoEPUIidQDe4WfT3d38
gxzKKS7g+bvvoWTcWGq3VWJOd/H0TXchHCaaK+u49J6bfhRhLfWtRFo7cecXEDRpNHc3Ei20VJ4x
c8znii5weewAaMkk6fkeoPfogBACRVWwWq3IstybnJYsfvjOj9ct/RVw/CiLJEmYzVZqqg/R3NyA
opp6D43ICq2NVXNdDqdiWAqR7UVgK8Bhc5CUbcSUlB/k0AU3XU9pxXha6uuZs+AS/s/bL1M6eTxm
u5WrH72DotIBP4qwph1HsXcmUZ0qHouNLxoO4htS9IfivBwcsg27YsYmmcnKSUd2yhAHs8WE1Wql
tbmNwweOuIPBEOrypU9drQaW3tWwr4jm0ikv+zxWhGEghI5hGNgdzuPTUZJlAuEY/rbahROGDCMU
N2HIdlxeH9F4kL3NFmZcNPUHO3X2giu+9bpi7llUzD3rRxH1NXr2N5LrdhIjjhwz6E7hyLgRg9ZU
bT5CIBxANmTaGzoZM7scd1oKOMDQJbqCPefl98v+Q2qubVBqJGWNfGTnK3+79PLTyPRo1FbtLJFl
CcNIHj+SJEkyVpuNYKAbRVGpP1afr8TbJmZmpxNPBHBaZaxynNdWbaHs9IspzP9hSf/fjWibn5x0
N5qRQLEqeGWTd+OmjRUt8S5C0V5NMBaO957icgF2eO6R525v3Hf4rdkXzhh92rQxjqyMzLnywHEL
Hvp07U7SrDXoyViZotowtAgudx6Y3ASjMrrkJBiF15Yut+3fse6pilG9VW9WYSYYEX5/z1PYckdS
MXbkf5qX74W52MtnX+7G63Ag2RWmFA1IS9/f9umqt5bfGlA1cvJySCSSRANxcMGzD75+/bAD5rtz
uuy8vHiF/veHXlkSDcXzpEA4zuuLL39/esnnM/b3zFvVER/0m3Sf3WFXQ/NEcPfw1m7dbLFniOys
PF9XZ6CstK8nTdMFDS2dyJJK0HCv7Ixat+ZkZ95z+pQz/n3/KPiRiGpJ3nxgCZZP65k+dATezGwQ
gs+2V7KlpX6/p3zwlYXegi0VU8bxRe3e4sP3r64e0q+ANUrjg0OGlz4Rknrqs0t8SEIIacP65eat
7113+OKzc/Mb2iRUSXD04BfEozq5JROx2AtRVAt5xafx5eFWXbf22aYZYtntt/5xw6VXXrddi0Ud
hcUFoQt/ccl/mpeT4r/vfkKvfG5t5fnlk0ZMGjgEuyWX7q21vFq9Ff8gz/zU/Ixa75HQS2k19K8c
a/xh0qypD8lJg+q2aqweFRXIH1BSXLdoxbFhXd2hhyaPzZ4Vj0m6rWjBlvScmVtbGytb6vbtaAsn
4s4Dr72i3HjzXVvGjz+tubOzBav1Thqqv2RvZWXxdTff/p/m4pQwcEChFDlj3PzwoELPC+s+eXN4
wFdQUVjGNeVns/3YwTeO1XcyNXUgbzkqtcnT5j1U7EqnobOdaDSK3ZuKCkjejGJGlOX4l33YtHDJ
si4qxg/mtbdvx2bP4egRL/HoMUJRBy1dMmVfLe9VRw4we9ZsbrjxRjZv/iSQ0PQf58n/J3S3dsuZ
Jkf+OXNnr/9QdfT/YsPOP1Y3fH5JumIt8kopTEjLZ3X1F6ReUHpt+dQSaAdflpuDLftJJJPIQLvV
6mDSlAswyVDUB/KzbSSiva1IwN+BlkiiawkkDMKhEADFxf34zbU34PblIRSbORgO/ae5OCUYmk79
7qPuvR9+QXFKRmLmr37255x5FcUtA7xFXw4WM5fajj7aMy7jyguumvcUGmABPGCzWtF0HRUIQ68M
K9F7Evnrf3OcCOkZeYCBoRtMmDDVmkgkT32/7j8Ip8VOZkFW0J3nJeQPk+juIc+VjrOPqdZekFKb
muJb093aAd0CLFKvDJLoPaoqSRL/A86FlK4DMfd6AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIzLTA2
LTI1VDA4OjQ4OjQxKzAwOjAw3W1oJQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wNi0yNVQwODo0
ODo0MSswMDowMKww0JkAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjMtMDYtMjVUMDg6NDg6NDEr
MDA6MDD7JfFGAAAAAElFTkSuQmCC" />
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,17 @@
name=Go ORM Helper
# intializing
initializing.title=Intializing go ORM helper
# convert struct
sql.convert.struct=SQL Convert Struct
# setting
setting.tableview.column.location=Location
setting.decorator.title=Scan Path
setting.ormComboBox.title=ORM
setting.databaseComboBox.title=Database
setting.sqlPathTextField.title=SQL File Path
setting.enableGlobalScanCheckBox.title=Global Scan
# database
database.AskEveryTime=Ask every time
# orm
orm.AskEveryTime=Ask every time
orm.General=General

@ -1,39 +0,0 @@
package org.jetbrains.plugins.template
import com.intellij.ide.highlighter.XmlFileType
import com.intellij.openapi.components.service
import com.intellij.psi.xml.XmlFile
import com.intellij.testFramework.TestDataPath
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.util.PsiErrorElementUtil
import org.jetbrains.plugins.template.services.MyProjectService
@TestDataPath("\$CONTENT_ROOT/src/test/testData")
class MyPluginTest : BasePlatformTestCase() {
fun testXMLFile() {
val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "<foo>bar</foo>")
val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)
assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))
assertNotNull(xmlFile.rootTag)
xmlFile.rootTag?.let {
assertEquals("foo", it.name)
assertEquals("bar", it.value.text)
}
}
fun testRename() {
myFixture.testRename("foo.xml", "foo_after.xml", "a2")
}
fun testProjectService() {
val projectService = project.service<MyProjectService>()
assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber())
}
override fun getTestDataPath() = "src/test/testData/rename"
}

@ -1,3 +0,0 @@
<root>
<a<caret>1>Foo</a1>
</root>

@ -1,3 +0,0 @@
<root>
<a2>Foo</a2>
</root>
Loading…
Cancel
Save