Skip to content

Commit cdd56d4

Browse files
committed
docs(intentions): add description for AutoSqlAction
Add a detailed description for the AutoSqlAction intention.
1 parent ced76d9 commit cdd56d4

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

exts/database/src/main/kotlin/cc/unitmesh/database/actions/AutoSqlAction.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class AutoSqlAction : ChatBaseIntention() {
2626

2727
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean {
2828
DbPsiFacade.getInstance(project).dataSources.firstOrNull() ?: return false
29-
return true
29+
val hasSelectionText = editor?.selectionModel?.selectedText
30+
return hasSelectionText != null
3031
}
3132

3233
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<html>
2+
<body>
3+
Write your description here.
4+
Start the description with a verb in 3rd person singular, like reports, detects, highlights.
5+
In the first sentence, briefly explain what exactly the inspection helps you detect.
6+
Make sure the sentence is not very long and complicated.
7+
<p>
8+
The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the
9+
description easier to read.
10+
Make sure the description doesn’t just repeat the inspection title.
11+
</p>
12+
<p>
13+
See https://jetbrains.design/intellij/text/inspections/#descriptions for more information.
14+
</p>
15+
<p>
16+
Embed code snippets:
17+
</p>
18+
<pre><code>
19+
// automatically highlighted according to inspection registration 'language' attribute
20+
</code></pre>
21+
<!-- tooltip end -->
22+
<p>Text after this comment will only be shown in the settings of the inspection.</p>
23+
24+
<p>To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to
25+
pre-select a UI element.</p>
26+
</body>
27+
</html>

0 commit comments

Comments
 (0)