-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from mdddj/1.3.3
1.3.3
- Loading branch information
Showing
9 changed files
with
193 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/kotlin/shop/itbug/salvorstool/intention/CopyAntdTableColumnAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package shop.itbug.salvorstool.intention | ||
|
||
import com.intellij.codeInsight.intention.IntentionAction | ||
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction | ||
import com.intellij.openapi.editor.Editor | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiElement | ||
import org.rust.lang.core.psi.impl.RsStructItemImpl | ||
import shop.itbug.salvorstool.tool.antdTableColumnItem | ||
import shop.itbug.salvorstool.tool.copy | ||
import shop.itbug.salvorstool.tool.myManager | ||
|
||
class CopyAntdTableColumnAction: PsiElementBaseIntentionAction(),IntentionAction { | ||
|
||
override fun getFamilyName(): String { | ||
return "SalvoRsTool: Copy Antd Table Column" | ||
} | ||
|
||
override fun getText(): String { | ||
return familyName | ||
} | ||
|
||
override fun isAvailable(project: Project, editor: Editor?, element: PsiElement): Boolean { | ||
return element.parent is RsStructItemImpl | ||
} | ||
|
||
override fun invoke(project: Project, editor: Editor?, element: PsiElement) { | ||
val rs = element.parent as? RsStructItemImpl ?: return | ||
val manager = rs.myManager | ||
val sb = StringBuilder() | ||
sb.appendLine("[") | ||
manager.jsModelList.map { | ||
sb.append("\n\t\t") | ||
sb.append(it.antdTableColumnItem) | ||
sb.append(",\n") | ||
} | ||
sb.appendLine("]") | ||
sb.toString().copy() | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/shop/itbug/salvorstool/intention/CopyTSInterfaceAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package shop.itbug.salvorstool.intention | ||
|
||
import com.intellij.codeInsight.intention.IntentionAction | ||
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction | ||
import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo | ||
import com.intellij.openapi.editor.Editor | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.PsiFile | ||
import org.rust.lang.core.psi.impl.RsStructItemImpl | ||
import shop.itbug.salvorstool.tool.copy | ||
import shop.itbug.salvorstool.tool.myManager | ||
|
||
class CopyTSInterfaceAction: PsiElementBaseIntentionAction(),IntentionAction { | ||
override fun getFamilyName(): String { | ||
return "SalvoRsTool: Copy TS interface" | ||
} | ||
|
||
override fun getText(): String { | ||
return familyName | ||
} | ||
|
||
override fun isAvailable(project: Project, editor: Editor?, element: PsiElement): Boolean { | ||
return element.parent is RsStructItemImpl | ||
} | ||
override fun invoke(project: Project, editor: Editor?, element: PsiElement) { | ||
val rs = element.parent as? RsStructItemImpl ?: return | ||
rs.myManager.getTSInterface.copy() | ||
} | ||
|
||
override fun generatePreview(project: Project, editor: Editor, file: PsiFile): IntentionPreviewInfo { | ||
var preview = IntentionPreviewInfo.Html("") | ||
val psiElement = getElement(editor,file)?.parent as? RsStructItemImpl | ||
psiElement?.let { | ||
preview = IntentionPreviewInfo.Html(it.myManager.getTSInterface) | ||
} | ||
return preview | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/resources/intentionDescriptions/CopyAntdTableColumnAction/description.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<html> | ||
<body> | ||
Write your description here. | ||
Start the description with a verb in 3rd person singular, like reports, detects, highlights. | ||
In the first sentence, briefly explain what exactly the inspection helps you detect. | ||
Make sure the sentence is not very long and complicated. | ||
<p> | ||
The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the | ||
description easier to read. | ||
Make sure the description doesn’t just repeat the inspection title. | ||
</p> | ||
<p> | ||
See https://jetbrains.design/intellij/text/inspections/#descriptions for more information. | ||
</p> | ||
<p> | ||
Embed code snippets: | ||
</p> | ||
<pre><code> | ||
// automatically highlighted according to inspection registration 'language' attribute | ||
</code></pre> | ||
<!-- tooltip end --> | ||
<p>Text after this comment will only be shown in the settings of the inspection.</p> | ||
|
||
<p>To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to | ||
pre-select a UI element.</p> | ||
</body> | ||
</html> |