File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed
exts/ext-wechat/src/243/main
kotlin/cc/unitmesh/wechat Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.wechat
2
+
3
+ class PlaceHolder {
4
+ }
Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.wechat.provider.bridge
2
+
3
+ import cc.unitmesh.devti.bridge.archview.model.UiComponent
4
+ import cc.unitmesh.devti.bridge.provider.ComponentViewMode
5
+ import cc.unitmesh.devti.bridge.provider.ComponentViewProvider
6
+ import com.intellij.openapi.project.Project
7
+ import com.intellij.psi.PsiManager
8
+ import com.intellij.psi.search.FileTypeIndex
9
+ import com.intellij.psi.search.GlobalSearchScope
10
+ import com.intellij.psi.search.ProjectScope
11
+ import com.intellij.wechat.miniprogram.lang.wxml.WxmlFileType
12
+ import com.intellij.wechat.miniprogram.lang.wxml.psi.impl.WxmlFile
13
+
14
+ class WechatComponentViewProvider : ComponentViewProvider () {
15
+ override fun isApplicable (project : Project ): Boolean {
16
+ return false
17
+ }
18
+
19
+ override fun collect (
20
+ project : Project ,
21
+ mode : ComponentViewMode
22
+ ): List <UiComponent > {
23
+ val searchScope: GlobalSearchScope = ProjectScope .getContentScope(project)
24
+ val psiManager = PsiManager .getInstance(project)
25
+
26
+ val virtualFiles = FileTypeIndex .getFiles(WxmlFileType , searchScope)
27
+
28
+ val components = mutableListOf<UiComponent >()
29
+ virtualFiles.forEach { file ->
30
+ val wxmlFile = (psiManager.findFile(file) ? : return @forEach) as ? WxmlFile ? : return @forEach
31
+ components + = buildComponent(wxmlFile) ? : return @forEach
32
+ }
33
+
34
+ return components
35
+ }
36
+
37
+ companion object {
38
+ fun buildComponent (wxmlFile : WxmlFile ): List <UiComponent >? {
39
+ return emptyList()
40
+ }
41
+ }
42
+ }
Original file line number Diff line number Diff line change 5
5
</dependencies >
6
6
7
7
<extensions defaultExtensionNs =" cc.unitmesh" >
8
-
8
+ < componentProvider implementation = " cc.unitmesh.wechat.provider.bridge.WechatComponentViewProvider " />
9
9
</extensions >
10
10
</idea-plugin >
You can’t perform that action at this time.
0 commit comments