File tree Expand file tree Collapse file tree 5 files changed +56
-7
lines changed
src/main/kotlin/co/anbora/labs/firebase/lang/core Expand file tree Collapse file tree 5 files changed +56
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ plugins {
4
4
id ' java'
5
5
id ' org.jetbrains.intellij' version ' 0.6.5'
6
6
id ' org.jetbrains.kotlin.jvm' version ' 1.4.10'
7
- id " org.jetbrains.grammarkit" version " 2020.2.1 "
7
+ id " org.jetbrains.grammarkit" version " 2020.3.2 "
8
8
}
9
9
10
10
grammarKit {
@@ -13,7 +13,7 @@ grammarKit {
13
13
}
14
14
15
15
group ' co.anbora.labs'
16
- version ' 2.4 .0-SNAPSHOT'
16
+ version ' 2.5 .0-SNAPSHOT'
17
17
18
18
repositories {
19
19
mavenCentral()
@@ -61,7 +61,7 @@ sourceSets {
61
61
62
62
// See https://github.com/JetBrains/gradle-intellij-plugin/
63
63
intellij {
64
- version = ' LATEST-EAP-SNAPSHOT '
64
+ version = ' 2020.3.3 '
65
65
}
66
66
67
67
tasks. withType(JavaCompile ) { options. encoding = ' UTF-8' }
@@ -77,6 +77,12 @@ publishPlugin {
77
77
patchPluginXml {
78
78
changeNotes """
79
79
<ul>
80
+ <li><b>2.5.0</b> <em>(2021-03-17)</em> - Added basic code completation</li>
81
+ <ul>
82
+ <li>Added basic code completation </li>
83
+ <li>Fixed issue with access index array </li>
84
+ </ul>
85
+ </li>
80
86
<li><b>2.4.0</b> <em>(2021-02-14)</em> - Added code folding</li>
81
87
<ul>
82
88
<li>Added code folding </li>
Original file line number Diff line number Diff line change @@ -23,11 +23,11 @@ object FirebasePsiPatterns {
23
23
fun serviceStatement (): PsiElementPattern .Capture <PsiElement > =
24
24
psiElementWithParent<FirebaseRulesServiceDef >()
25
25
26
- fun serviceBlock (): PsiElementPattern .Capture <PsiElement > =
27
- psiElementWithParent<FirebaseRulesServiceBlock >()
26
+ fun pathStatement (): PsiElementPattern .Capture <PsiElement > =
27
+ psiElementWithParent<FirebaseRulesPathStatement >()
28
28
29
- fun matchStatement (): PsiElementPattern .Capture <PsiElement > =
30
- psiElementWithParent<FirebaseRulesMatchDef >()
29
+ fun permissionStatement (): PsiElementPattern .Capture <PsiElement > =
30
+ psiElementWithParent<FirebaseRulesPermissionStatement >()
31
31
32
32
fun allowStatement (): PsiElementPattern .Capture <PsiElement > =
33
33
psiElementWithParent<FirebaseRulesAllowStatement >()
Original file line number Diff line number Diff line change 1
1
package co.anbora.labs.firebase.lang.core.completion
2
2
3
3
import co.anbora.labs.firebase.lang.FirebaseRulesLanguage
4
+ import co.anbora.labs.firebase.lang.core.FirebasePsiPatterns.pathStatement
5
+ import co.anbora.labs.firebase.lang.core.FirebasePsiPatterns.permissionStatement
6
+ import co.anbora.labs.firebase.lang.core.FirebasePsiPatterns.serviceStatement
4
7
import com.intellij.codeInsight.completion.CompletionContributor
5
8
import com.intellij.codeInsight.completion.CompletionType.BASIC
6
9
import com.intellij.patterns.PlatformPatterns.psiElement
@@ -17,5 +20,20 @@ class FirebaseCompletionContributor: CompletionContributor() {
17
20
psiElement().withLanguage(FirebaseRulesLanguage ),
18
21
FirebaseCompletionProvider ()
19
22
)
23
+ extend(
24
+ BASIC ,
25
+ serviceStatement(),
26
+ KeywordCompletionProvider (* serviceNameCompletion)
27
+ )
28
+ extend(
29
+ BASIC ,
30
+ pathStatement(),
31
+ KeywordCompletionProvider (* matchPathCompletion)
32
+ )
33
+ extend(
34
+ BASIC ,
35
+ permissionStatement(),
36
+ KeywordCompletionProvider (* allowPermissionCompletion)
37
+ )
20
38
}
21
39
}
Original file line number Diff line number Diff line change
1
+ package co.anbora.labs.firebase.lang.core.completion
2
+
3
+ import com.intellij.codeInsight.completion.CompletionParameters
4
+ import com.intellij.codeInsight.completion.CompletionProvider
5
+ import com.intellij.codeInsight.completion.CompletionResultSet
6
+ import com.intellij.codeInsight.lookup.LookupElementBuilder
7
+ import com.intellij.util.ProcessingContext
8
+
9
+ class KeywordCompletionProvider (private vararg val keywords : String ) : CompletionProvider<CompletionParameters>() {
10
+ override fun addCompletions (
11
+ parameters : CompletionParameters ,
12
+ context : ProcessingContext ,
13
+ result : CompletionResultSet
14
+ ) {
15
+ keywords.forEach { keyword ->
16
+ result.addElement(LookupElementBuilder .create(keyword))
17
+ }
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ package co.anbora.labs.firebase.lang.core.psi.mixings
2
+
3
+ import com.intellij.psi.PsiNamedElement
4
+
5
+ abstract class MatchDefMixing : PsiNamedElement {
6
+ }
You can’t perform that action at this time.
0 commit comments