mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
IJPL-198335 Only checking supported languages' typo and ignoring other unsupported languages like Bulgarian
Co-authored-by: Peter Gromov <peter.gromov@jetbrains.com> Merge-request: IJ-MR-170350 Merged-by: Ilia Permiashkin <ilia.permiashkin@jetbrains.com> (cherry picked from commit dc696f6772e22b88d0c9edff535aff4da15c24bf) IJ-MR-170350 GitOrigin-RevId: 115225541d617cec514e7d04219429b3173173cf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cdd431e967
commit
8917e8fbea
@@ -16,7 +16,9 @@ import org.jetbrains.annotations.ApiStatus
|
||||
class PyPackagesDictionary : Dictionary {
|
||||
override fun getName(): String = message("python.packages.dictionary.name")
|
||||
|
||||
override fun contains(word: String): Boolean? = service<PypiPackageCache>().contains(word)
|
||||
override fun contains(word: String): Boolean? = throw UnsupportedOperationException()
|
||||
|
||||
override fun lookup(word: String): Dictionary.LookupStatus = service<PypiPackageCache>().lookup(word)
|
||||
|
||||
override fun getWords(): MutableSet<String> = throw UnsupportedOperationException()
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.spellchecker.dictionary.Dictionary.LookupStatus
|
||||
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
|
||||
import com.intellij.util.io.SafeFileOutputStream
|
||||
import com.jetbrains.python.Result
|
||||
@@ -33,6 +34,7 @@ import java.util.*
|
||||
import kotlin.io.path.exists
|
||||
|
||||
private val LOG = logger<PypiPackageCache>()
|
||||
private val ALPHABET_REGEX = Regex("[-a-z0-9]+")
|
||||
|
||||
@ApiStatus.Internal
|
||||
@Service
|
||||
@@ -42,6 +44,12 @@ class PypiPackageCache : PythonPackageCache<String> {
|
||||
|
||||
override operator fun contains(key: String): Boolean = key in cache
|
||||
|
||||
fun lookup(word: String): LookupStatus {
|
||||
if (word in cache) return LookupStatus.Present
|
||||
if (!ALPHABET_REGEX.matches(word.lowercase())) return LookupStatus.Alien
|
||||
return LookupStatus.Absent
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean = cache.isEmpty()
|
||||
|
||||
@Volatile
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# This is <GRAMMAR_ERROR descr="EN_A_VS_AN">a</GRAMMAR_ERROR> error
|
||||
# (in a multiline comment
|
||||
# with parentheses)
|
||||
# Я - Пришелец!
|
||||
|
||||
def foo():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user