Skip to content

Commit 747070f

Browse files
committed
Add support for basic spell checker
1 parent 3d44704 commit 747070f

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# intellij-runescript Changelog
22

33
## [Unreleased]
4+
### Added
5+
- Support for basic spell checking and custom dictionary.
46

57
## [1.1.0] - 2023-08-11
68

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.runescript.plugin.ide.spellchecker
2+
3+
import com.intellij.spellchecker.BundledDictionaryProvider
4+
5+
class RsBundledDictionaryProvider : BundledDictionaryProvider {
6+
override fun getBundledDictionaries() = arrayOf("runescript.dic")
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.runescript.plugin.ide.spellchecker
2+
3+
import com.intellij.psi.PsiElement
4+
import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy
5+
import io.runescript.plugin.lang.RuneScript
6+
7+
class RsSpellcheckingStrategy : SpellcheckingStrategy() {
8+
9+
override fun isMyContext(element: PsiElement) = RuneScript.`is`(element.language)
10+
}

src/main/resources/META-INF/plugin.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
<codeInsight.parameterInfo language="RuneScript" implementationClass="io.runescript.plugin.ide.codeInsight.RsGosubParameterInfoProvider"/>
6565
<documentationProvider implementation="io.runescript.plugin.ide.doc.RsDocumentationProvider"/>
6666

67+
<!-- Spell Checking -->
68+
<spellchecker.support language="RuneScript" implementationClass="io.runescript.plugin.ide.spellchecker.RsSpellcheckingStrategy"/>
69+
<spellchecker.bundledDictionaryProvider implementation="io.runescript.plugin.ide.spellchecker.RsBundledDictionaryProvider"/>
70+
6771
<intentionAction>
6872
<language>RuneScript</language>
6973
<className>io.runescript.plugin.ide.codeInsight.intention.RsNumberConversionIntention</className>

src/main/resources/runescript.dic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
runescript
2+
clientscript
3+
proc

0 commit comments

Comments
 (0)