mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IJPL-192715 Incorrectly spelled words are considered aliens even though they're not
Merge-request: IJ-MR-167371 Merged-by: Ilia Permiashkin <ilia.permiashkin@jetbrains.com> GitOrigin-RevId: 0ed8649c3df9d9c2e71159ec74399550a036c6ae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a786616ba1
commit
35062d25e4
@@ -1705,6 +1705,46 @@ jvm_import(
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "grazie-tests-jetbrains-intellij-deps-languagetool-language-be",
|
||||
exports = [
|
||||
":language-be-6_5_0_12_http_import",
|
||||
":linguistics_grammardb_spell_languagetool-1_0_2_http_import",
|
||||
],
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
||||
jvm_import(
|
||||
name = "language-be-6_5_0_12_http_import",
|
||||
jar = "@language-be-6_5_0_12_http//file",
|
||||
source_jar = "@language-be-6_5_0_12-sources_http//file"
|
||||
)
|
||||
|
||||
jvm_import(
|
||||
name = "linguistics_grammardb_spell_languagetool-1_0_2_http_import",
|
||||
jar = "@linguistics_grammardb_spell_languagetool-1_0_2_http//file"
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "grazie-tests-jetbrains-intellij-deps-languagetool-language-uk",
|
||||
exports = [
|
||||
":language-uk-6_5_0_12_http_import",
|
||||
":morfologik-ukrainian-lt-6_5_2_http_import",
|
||||
],
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
||||
jvm_import(
|
||||
name = "language-uk-6_5_0_12_http_import",
|
||||
jar = "@language-uk-6_5_0_12_http//file",
|
||||
source_jar = "@language-uk-6_5_0_12-sources_http//file"
|
||||
)
|
||||
|
||||
jvm_import(
|
||||
name = "morfologik-ukrainian-lt-6_5_2_http_import",
|
||||
jar = "@morfologik-ukrainian-lt-6_5_2_http//file"
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "grazie-tests-org-jetbrains-intellij-deps-languagetool-language-de",
|
||||
exports = [
|
||||
|
||||
@@ -2203,6 +2203,48 @@ http_file(
|
||||
downloaded_file_path = "uom-lib-common-1.1-sources.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "language-be-6_5_0_12_http",
|
||||
url = "https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-dependencies/org/jetbrains/intellij/deps/languagetool/language-be/6.5.0.12/language-be-6.5.0.12.jar",
|
||||
sha256 = "bd1887ce9a41765b30098c4e1de1b7fb44f85a2753c38e9ab6f809c5462904a8",
|
||||
downloaded_file_path = "language-be-6.5.0.12.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "linguistics_grammardb_spell_languagetool-1_0_2_http",
|
||||
url = "https://cache-redirector.jetbrains.com/repo1.maven.org/maven2/io/github/belarus/linguistics.grammardb.spell.languagetool/1.0.2/linguistics.grammardb.spell.languagetool-1.0.2.jar",
|
||||
sha256 = "1d1a55e905faa9740d648144cf05c4a460f0f26416d2ee01157bad0877be31c2",
|
||||
downloaded_file_path = "linguistics.grammardb.spell.languagetool-1.0.2.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "language-be-6_5_0_12-sources_http",
|
||||
url = "https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-dependencies/org/jetbrains/intellij/deps/languagetool/language-be/6.5.0.12/language-be-6.5.0.12-sources.jar",
|
||||
sha256 = "a179feba0e4ba6af0d30494c4c06a1a7b60553027259fc95af876b3b77bc001c",
|
||||
downloaded_file_path = "language-be-6.5.0.12-sources.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "language-uk-6_5_0_12_http",
|
||||
url = "https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-dependencies/org/jetbrains/intellij/deps/languagetool/language-uk/6.5.0.12/language-uk-6.5.0.12.jar",
|
||||
sha256 = "d1d6335aa10c9a109d64b9eb05128e5993fb2f88549f446b9b2b91a728a95da2",
|
||||
downloaded_file_path = "language-uk-6.5.0.12.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "morfologik-ukrainian-lt-6_5_2_http",
|
||||
url = "https://cache-redirector.jetbrains.com/repo1.maven.org/maven2/ua/net/nlp/morfologik-ukrainian-lt/6.5.2/morfologik-ukrainian-lt-6.5.2.jar",
|
||||
sha256 = "6f720beda15abe1c3517d2105043e33da3786dcc92a6803e42f1b246de6af3ac",
|
||||
downloaded_file_path = "morfologik-ukrainian-lt-6.5.2.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "language-uk-6_5_0_12-sources_http",
|
||||
url = "https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-dependencies/org/jetbrains/intellij/deps/languagetool/language-uk/6.5.0.12/language-uk-6.5.0.12-sources.jar",
|
||||
sha256 = "872e8c9852e6b17ecfdf57942731122abdd04fdb1c0c17e67943afcd1b9bb3ab",
|
||||
downloaded_file_path = "language-uk-6.5.0.12-sources.jar"
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "language-de-6_5_0_12_http",
|
||||
url = "https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-dependencies/org/jetbrains/intellij/deps/languagetool/language-de/6.5.0.12/language-de-6.5.0.12.jar",
|
||||
|
||||
@@ -32,6 +32,8 @@ jvm_library(
|
||||
"@lib//:grazie-tests-org-jetbrains-intellij-deps-languagetool-language-ru",
|
||||
"@lib//:grazie-tests-org-jetbrains-intellij-deps-languagetool-language-de",
|
||||
"@lib//:grazie-tests-org-jetbrains-intellij-deps-languagetool-language-it",
|
||||
"@lib//:grazie-tests-jetbrains-intellij-deps-languagetool-language-uk",
|
||||
"@lib//:grazie-tests-jetbrains-intellij-deps-languagetool-language-be",
|
||||
"@lib//:grazie-tests-org-jetbrains-intellij-deps-languagetool-language-pt",
|
||||
"//libraries/ai.grazie.spell.gec.engine.local",
|
||||
"@lib//:grazie-tests-org-languagetool-portuguese-pos-dict",
|
||||
|
||||
@@ -150,6 +150,56 @@
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="jetbrains.intellij.deps.languagetool.language.uk" type="repository">
|
||||
<properties maven-id="org.jetbrains.intellij.deps.languagetool:language-uk:6.5.0.12">
|
||||
<verification>
|
||||
<artifact url="file://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-uk/6.5.0.12/language-uk-6.5.0.12.jar">
|
||||
<sha256sum>d1d6335aa10c9a109d64b9eb05128e5993fb2f88549f446b9b2b91a728a95da2</sha256sum>
|
||||
</artifact>
|
||||
<artifact url="file://$MAVEN_REPOSITORY$/ua/net/nlp/morfologik-ukrainian-lt/6.5.2/morfologik-ukrainian-lt-6.5.2.jar">
|
||||
<sha256sum>6f720beda15abe1c3517d2105043e33da3786dcc92a6803e42f1b246de6af3ac</sha256sum>
|
||||
</artifact>
|
||||
</verification>
|
||||
<exclude>
|
||||
<dependency maven-id="org.jetbrains.intellij.deps.languagetool:languagetool-core" />
|
||||
</exclude>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-uk/6.5.0.12/language-uk-6.5.0.12.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/ua/net/nlp/morfologik-ukrainian-lt/6.5.2/morfologik-ukrainian-lt-6.5.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-uk/6.5.0.12/language-uk-6.5.0.12-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="jetbrains.intellij.deps.languagetool.language.be" type="repository">
|
||||
<properties maven-id="org.jetbrains.intellij.deps.languagetool:language-be:6.5.0.12">
|
||||
<verification>
|
||||
<artifact url="file://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-be/6.5.0.12/language-be-6.5.0.12.jar">
|
||||
<sha256sum>bd1887ce9a41765b30098c4e1de1b7fb44f85a2753c38e9ab6f809c5462904a8</sha256sum>
|
||||
</artifact>
|
||||
<artifact url="file://$MAVEN_REPOSITORY$/io/github/belarus/linguistics.grammardb.spell.languagetool/1.0.2/linguistics.grammardb.spell.languagetool-1.0.2.jar">
|
||||
<sha256sum>1d1a55e905faa9740d648144cf05c4a460f0f26416d2ee01157bad0877be31c2</sha256sum>
|
||||
</artifact>
|
||||
</verification>
|
||||
<exclude>
|
||||
<dependency maven-id="org.jetbrains.intellij.deps.languagetool:languagetool-core" />
|
||||
</exclude>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-be/6.5.0.12/language-be-6.5.0.12.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/belarus/linguistics.grammardb.spell.languagetool/1.0.2/linguistics.grammardb.spell.languagetool-1.0.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/languagetool/language-be/6.5.0.12/language-be-6.5.0.12-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="org.jetbrains.intellij.deps.languagetool:language-pt" type="repository">
|
||||
<properties include-transitive-deps="false" maven-id="org.jetbrains.intellij.deps.languagetool:language-pt:6.5.0.12">
|
||||
|
||||
@@ -41,23 +41,7 @@ abstract class GrazieTestBase : BasePlatformTestCase() {
|
||||
super.setUp()
|
||||
myFixture.enableInspections(*inspectionTools)
|
||||
|
||||
GrazieConfig.update { state ->
|
||||
val checkingContext = state.checkingContext.copy(
|
||||
isCheckInStringLiteralsEnabled = true,
|
||||
isCheckInCommentsEnabled = true,
|
||||
isCheckInDocumentationEnabled = true,
|
||||
enabledLanguages = additionalEnabledContextLanguages.map { it.id }.toSet(),
|
||||
)
|
||||
state.copy(
|
||||
enabledLanguages = enabledLanguages,
|
||||
userEnabledRules = enabledRules + additionalEnabledRules,
|
||||
checkingContext = checkingContext
|
||||
)
|
||||
}
|
||||
|
||||
service<GrazieCheckers>().awaitConfiguration()
|
||||
|
||||
PlatformTestUtil.dispatchAllEventsInIdeEventQueue()
|
||||
configureGrazieSettings()
|
||||
|
||||
val newExtensions = TextChecker.allCheckers().map { if (it is LanguageToolChecker) LanguageToolChecker.TestChecker() else it }
|
||||
ExtensionTestUtil.maskExtensions(ExtensionPointName("com.intellij.grazie.textChecker"), newExtensions, testRootDisposable)
|
||||
@@ -77,6 +61,25 @@ abstract class GrazieTestBase : BasePlatformTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun configureGrazieSettings(enabledLanguages: Set<Lang> = GrazieTestBase.enabledLanguages) {
|
||||
GrazieConfig.update { state ->
|
||||
val checkingContext = state.checkingContext.copy(
|
||||
isCheckInStringLiteralsEnabled = true,
|
||||
isCheckInCommentsEnabled = true,
|
||||
isCheckInDocumentationEnabled = true,
|
||||
enabledLanguages = additionalEnabledContextLanguages.map { it.id }.toSet(),
|
||||
)
|
||||
state.copy(
|
||||
enabledLanguages = enabledLanguages,
|
||||
userEnabledRules = enabledRules + additionalEnabledRules,
|
||||
checkingContext = checkingContext
|
||||
)
|
||||
}
|
||||
|
||||
service<GrazieCheckers>().awaitConfiguration()
|
||||
PlatformTestUtil.dispatchAllEventsInIdeEventQueue()
|
||||
}
|
||||
|
||||
protected open fun runHighlightTestForFile(file: String) {
|
||||
myFixture.configureByFile(file)
|
||||
myFixture.checkHighlighting(true, false, false)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.grazie.ide.language
|
||||
|
||||
import com.intellij.grazie.GrazieTestBase
|
||||
import com.intellij.grazie.jlanguage.Lang
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
@@ -27,6 +28,7 @@ class JavaSupportTest : GrazieTestBase() {
|
||||
}
|
||||
|
||||
fun `test grammar check in comments`() {
|
||||
configureGrazieSettings(setOf(Lang.AMERICAN_ENGLISH, Lang.GERMANY_GERMAN, Lang.UKRAINIAN, Lang.BELARUSIAN))
|
||||
runHighlightTestForFile("ide/language/java/Comments.java")
|
||||
}
|
||||
|
||||
|
||||
@@ -99,4 +99,12 @@ class ForMultiLanguageSupport {
|
||||
// print(f'
|
||||
// print(f')
|
||||
// print(f' world')
|
||||
|
||||
// Українська. У мене хороші будинки.
|
||||
// Граматична помилка: Поверталися на <GRAMMAR_ERROR descr="VYSHIDNYI_VYHIDNYI">висхідну</GRAMMAR_ERROR> позицію.
|
||||
// Друкувати словом: У мене хороші <TYPO descr="Typo: In word 'будінки'">будінки</TYPO>.
|
||||
|
||||
// Беларускі. У мяне добры дом.
|
||||
// Граматычная памылка: А <GRAMMAR_ERROR descr="pa_fakcie">па факту</GRAMMAR_ERROR> атрымалася, што сіл няма.
|
||||
// Памылка друку ў word: У мяне добры <TYPO descr="Typo: In word 'домн'">домн</TYPO>.
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import ai.grazie.spell.lists.WordList
|
||||
|
||||
internal class WordListAdapter : WordList, EditableWordListAdapter() {
|
||||
fun isAlien(word: String): Boolean {
|
||||
return !dictionaries.values.any { it.contains(word) ?: false } && !aggregator.contains(word)
|
||||
return dictionaries.values.all { it.contains(word) == null } && !aggregator.contains(word)
|
||||
}
|
||||
|
||||
override fun contains(word: String, caseSensitive: Boolean): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user