Skip to content

Commit

Permalink
Merge pull request #75 from anboralabs/spell-checker
Browse files Browse the repository at this point in the history
Spell checker
  • Loading branch information
dalgarins authored Jun 12, 2021
2 parents 4277394 + 4463dbc commit 0315487
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: 'org.jetbrains.grammarkit'
import org.jetbrains.grammarkit.tasks.*

group 'co.anbora.labs'
version '2.6.0'
version '2.6.2'

repositories {
mavenCentral()
Expand Down
13 changes: 11 additions & 2 deletions src/main/html/change-notes.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
Versions:
<ul>
<li>All Intellij products support: 2.6.0</li>
<li>Android Studio support: 2.5.9</li>
<li>All Intellij products support: 2.6.2</li>
<li>Android Studio support: 2.6.1</li>
</ul>
<br>
Plugin updates:
<ul>
<li><b>2.6.2</b> <em>(2021-06-11)</em> - SpellChecking</li>
<ul>
<li>Added feature: spellchecking. </li>
</ul>
<li><b>2.6.1</b> <em>(2021-06-10)</em> - Code Style - Android version</li>
<ul>
<li>Added code style configuration. </li>
<li>Fixed issue with code formatting. </li>
</ul>
<li><b>2.6.0</b> <em>(2021-06-07)</em> - Code Style</li>
<ul>
<li>Added code style configuration. </li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package co.anbora.labs.firebase.ide.spelling

import co.anbora.labs.firebase.lang.FirebaseRulesLanguage
import co.anbora.labs.firebase.lang.core.psi.FirebaseRulesTypes
import com.intellij.psi.PsiElement
import com.intellij.psi.util.elementType
import com.intellij.spellchecker.inspections.PlainTextSplitter
import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy
import com.intellij.spellchecker.tokenizer.Tokenizer
import com.intellij.spellchecker.tokenizer.TokenizerBase

class FirebaseSpellCheckingStrategy: SpellcheckingStrategy() {

override fun getTokenizer(element: PsiElement?): Tokenizer<*> =
when (element?.elementType) {
FirebaseRulesTypes.STRING -> FIREBASE_STRING_TOKENIZER
else -> super.getTokenizer(element)
}

override fun isMyContext(element: PsiElement): Boolean =
element.language.`is`(FirebaseRulesLanguage)
}

val FIREBASE_STRING_TOKENIZER =
TokenizerBase<PsiElement>(PlainTextSplitter.getInstance())
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
implementation="co.anbora.labs.firebase.ide.style.FirebaseCodeStyleSettingsProvider"/>
<langCodeStyleSettingsProvider
implementation="co.anbora.labs.firebase.ide.style.FirebaseLanguageCodeStyleSettingProvider"/>
<spellchecker.support language="firebase_rules" implementationClass="co.anbora.labs.firebase.ide.spelling.FirebaseSpellCheckingStrategy"/>
</extensions>

<actions>
Expand Down

0 comments on commit 0315487

Please sign in to comment.