File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
main/kotlin/cc/unitmesh/database/provider
java/src/main/kotlin/cc/unitmesh/idea/actions Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import com.intellij.openapi.editor.SelectionModel
8
8
import com.intellij.psi.PsiElement
9
9
import com.intellij.psi.PsiNameIdentifierOwner
10
10
import com.intellij.psi.codeStyle.CodeStyleManager
11
+ import com.intellij.sql.psi.SqlDefinition
11
12
12
13
class SqlLivingDocumentationProvider : LivingDocumentation {
13
14
override val forbiddenRules: List <String >
@@ -34,6 +35,13 @@ class SqlLivingDocumentationProvider : LivingDocumentation {
34
35
}
35
36
36
37
override fun findNearestDocumentationTarget (psiElement : PsiElement ): PsiNameIdentifierOwner ? {
38
+ // todo: find nearest sql definition
39
+ when (psiElement) {
40
+ is SqlDefinition -> {
41
+ return psiElement
42
+ }
43
+ }
44
+
37
45
return null
38
46
}
39
47
Original file line number Diff line number Diff line change
1
+ -- sample for create blog
2
+ CREATE TABLE `blog `
3
+ (
4
+ ` id` int (11 ) NOT NULL AUTO_INCREMENT,
5
+ ` title` varchar (255 ) DEFAULT NULL ,
6
+ ` content` varchar (255 ) DEFAULT NULL ,
7
+ ` create_time` datetime DEFAULT NULL ,
8
+ ` update_time` datetime DEFAULT NULL ,
9
+ PRIMARY KEY (` id` )
10
+ ) ENGINE= InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8mb4;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import cc.unitmesh.devti.intentions.action.base.AbstractChatIntention
5
5
import cc.unitmesh.devti.llms.LlmFactory
6
6
import cc.unitmesh.devti.provider.DevFlowProvider
7
7
import cc.unitmesh.devti.gui.sendToChatPanel
8
+ import com.intellij.lang.java.JavaLanguage
8
9
import com.intellij.openapi.diagnostic.logger
9
10
import com.intellij.openapi.editor.Editor
10
11
import com.intellij.openapi.progress.ProgressIndicator
@@ -22,8 +23,11 @@ class AutoCrudAction : AbstractChatIntention() {
22
23
23
24
24
25
override fun isAvailable (project : Project , editor : Editor ? , file : PsiFile ? ): Boolean {
26
+ if (editor == null || file == null ) return false
27
+ if (file.language !is JavaLanguage ) return false
28
+
25
29
val isEnvironmentAvailable = super .isAvailable(project, editor, file)
26
- return isEnvironmentAvailable && editor? .selectionModel?.hasSelection() == true
30
+ return isEnvironmentAvailable && editor.selectionModel?.hasSelection() == true
27
31
}
28
32
29
33
override fun invoke (project : Project , editor : Editor ? , file : PsiFile ? ) {
You can’t perform that action at this time.
0 commit comments