[java] IDEA-190628 Disable spell checking for resolved Maven dependencies

GitOrigin-RevId: 40e59f0aebd77614cd7c8ffd76aa19e72f15c3a4
This commit is contained in:
Yuriy Artamonov
2023-10-21 23:45:16 +02:00
committed by intellij-monorepo-bot
parent f4a5e969a6
commit 7e849e9dd3
7 changed files with 70 additions and 127 deletions

View File

@@ -6,7 +6,7 @@
<extensionPoint name="spellchecker.bundledDictionaryProvider" interface="com.intellij.spellchecker.BundledDictionaryProvider" dynamic="true"/>
<extensionPoint name="spellchecker.dictionary.customDictionaryProvider" interface="com.intellij.spellchecker.dictionary.CustomDictionaryProvider" dynamic="true"/>
<extensionPoint name="spellchecker.dictionary.runtimeDictionaryProvider" interface="com.intellij.spellchecker.dictionary.RuntimeDictionaryProvider" dynamic="true"/>
<extensionPoint name="spellchecker.dictionary.checker" interface="com.intellij.spellchecker.dictionary.DictionaryCheckerProvider" dynamic="true"/>
<extensionPoint name="spellchecker.dictionary.checker" interface="com.intellij.spellchecker.dictionary.DictionaryChecker" dynamic="true"/>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">

View File

@@ -62,15 +62,6 @@ class SpellCheckerManager(val project: Project) : Disposable {
private val userDictionaryListenerEventDispatcher = EventDispatcher.create(DictionaryStateListener::class.java)
@Volatile
private var dictionaryCheckers: List<DictionaryChecker>? = null
init {
DictionaryCheckerProvider.EP_NAME.addChangeListener(Runnable {
dictionaryCheckers = null
}, this)
}
// used in Rider
@get:Suppress("unused")
var spellChecker: SpellCheckerEngine? = null
@@ -243,13 +234,7 @@ class SpellCheckerManager(val project: Project) : Disposable {
}
private fun isCorrectExtensionWord(word: String): Boolean {
var currentCheckers = dictionaryCheckers
if (currentCheckers == null) {
currentCheckers = DictionaryCheckerProvider.EP_NAME.extensionList.map { it.getChecker(project) }
dictionaryCheckers = currentCheckers
}
return currentCheckers.any { it.isCorrect(word) }
return DictionaryChecker.EP_NAME.extensionList.any { it.isCorrect(project, word) }
}
fun acceptWordAsCorrect(word: String, project: Project) {

View File

@@ -1,13 +1,16 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.dictionary;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/**
* Checks if words are correct in the context of Project.
*
* @see DictionaryCheckerProvider
*/
public interface DictionaryChecker {
boolean isCorrect(@NotNull String word);
ExtensionPointName<DictionaryChecker> EP_NAME =
new ExtensionPointName<>("com.intellij.spellchecker.dictionary.checker");
boolean isCorrect(@NotNull Project project, @NotNull String word);
}

View File

@@ -1,16 +0,0 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.dictionary;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/**
* Provides dictionaries that are always project-bound, e.g. provide names of libraries used in the Project.
*/
public interface DictionaryCheckerProvider {
ExtensionPointName<DictionaryCheckerProvider> EP_NAME =
new ExtensionPointName<>("com.intellij.spellchecker.dictionary.checker");
@NotNull DictionaryChecker getChecker(@NotNull Project project);
}